Infrastructure/ansible/README.md

30 lines
1.2 KiB
Markdown

# Ansible
Run from David's Linux PC over SSH — nothing is installed on the managed hosts.
Run all commands from inside this `ansible/` directory so `ansible.cfg` is picked up.
## Prerequisites
- `sudo pacman -S ansible`
- One SSH key per client device (`~/.ssh/id_ed25519_homelab`), copied to each host with `ssh-copy-id`.
- A `~/.ssh/config` entry per host (`User`, `IdentityFile`, `IdentitiesOnly yes`). The inventory
only lists host names, so these must match the `Host` lines exactly.
## Hosts
| Group | Host | Notes |
|---|---|---|
| `octoprint` | `octopi.home.staffenberger.at` | RPi4, IoT VLAN — the learning guinea pig |
## Usage
```bash
ansible octoprint -m ping # connectivity check
ansible-playbook playbooks/update.yml --list-hosts # which hosts would this touch?
ansible-playbook playbooks/update.yml --check --diff # dry run
ansible-playbook playbooks/update.yml # apt upgrade + reboot if required
ansible-playbook playbooks/octoprint.yml --check --diff # dry run of the Pi's configuration
ansible-playbook playbooks/octoprint.yml # apply the Pi's configuration (after changes or a fresh flash)
```
Add `-K` if a play fails with "Missing sudo password".