Add README.md

This commit is contained in:
Jeffrey Serio 2023-10-02 10:26:26 -05:00
parent a4c332d36e
commit 486608c005

85
README.md Normal file
View File

@ -0,0 +1,85 @@
# ansible-homelab
I use(d) these roles to automate the setup of my LXC homelab. They are highly tailored to my use-case and would require substantial review and editing for anyone else to use them.
## Example
``` bash
lxc init images:debian/12/cloud debian-archive --storage lxd-pool
```
Configure the instance for cloud-init:
``` bash
lxc config set debian-archive cloud-init.user-data - <<- EOF
#cloud-config
users:
- name: debian
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIOmibToJQ8JZpSFLH3482oxvpD56QAfu4ndoofbew5t jas@si.local
sudo: 'ALL=(ALL) NOPASSWD: ALL'
shell: /bin/bash
lock_passwd: true
apt:
sources_list: |
deb http://deb.debian.org/debian $RELEASE main
deb http://deb.debian.org/debian $RELEASE-updates main
deb http://deb.debian.org/debian-security/ $RELEASE-security main
deb http://deb.debian.org/debian $RELEASE-backports
package_update: true
package_upgrade: true
packages:
- curl
- debian-keyring
- debsig-verify
- git
- nodejs
- npm
- notmuch
- offlineimap3
- pass
- python3-dev
- python3-pip
- ripgrep
- ssh
- wget
- xauth
- youtube-dl
rsyslog:
configs:
- content: "*.* @10.0.0.41:514"
filename: 99-forward.conf
remotes:
moonshadow: 10.0.0.41
timezone: America/Chicago
EOF
```
Start the instance, then check the cloud-init status:
``` bash
lxc start debian-archive
lxc exec debian-archive -- cloud-init status --wait
```
SSH into the new instance to accept the host key:
``` bash
ssh debian@10.227.115.42
```
Once that's done, you should be able to SSH directly to the debian user, and Ansible will be ready to run.
Add the instance's IP address to hosts.ini:
``` yaml
[homelab]
10.227.115.42
```
Run the setup.yml playbook for all roles, or choose specific roles with --tags:
``` bash
ansible-playbook -i hosts.ini setup.yml -u debian -b
ansible-playbook -i hosts.ini setup.yml --tags debian-archive -u debian -b
```