Ansible playbooks to setup machines on my own hobby infra / home lab.
It is split into 2 playbooks, server_install.yml
and user_install.yml
, the
first one runs commands as root, the other runs only rootless commands as the
configured user.
The server playbook is responsible for OS-level setup, such as setting up the hostname and installing packages.
The user playbook is responsible for installing "user apps", such as userland systemd services and apps.
- Python, only tested with 3.10+
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# Run server setup on all machines
# -K to pass sudo password, as I do not use passwordless sudo
ansible-playbook server_install.yml -K
# Run server setup on only one machine
ansible-playbook -l laffey server_install.yml -K
# Run user setup
ansible-playbook user_install.yml
# Run only a specific tag / task
ansible-playbook user_install.yml -t containers
- vagrant, only tested with v2.4.1 on WSL2 with VirtualBox on Windows
molecule converge
-
Go to where molecule has generated the Vagrantfile, should be
~/.cache/molecule/tina-infra/default
-
Run
vagrant ssh laffey -- -NL 8080:localhost:80
where laffey is the host you want to connect to, 8080 is the port you want to bind to on your host, and 80 is the port you want to bind to in the VM.
Machine | Share | Authentication |
---|---|---|
Freebox | SMB //mafreebox.freebox.fr/freebox | guest |
Nagato | SMB //nagato.lan/Public | guest |
Nagato | SMB //nagato.lan/tina-data | password |
Machine | Target | Method |
---|---|---|
Turbo | Freebox | fstab |
Turbo | Sakura Public | systemd mount (system in /usr/local) |
Turbo | Sakura tina | users-fstab (see Ansible task) |
Laffey | Turbo ~tina | user-mount (~/.local/bin) |
- Configure network mounts via Ansible
- users-fstab configs
- user-mount script (see Laffey)