This is an Ansible Playbook for my home infrastructure (mostly Raspberry Pi's, so far).
(See below for setup instructions)
- Modify
hosts
andsite.yml
as appropriate. - Make sure you have defined all secrets: rename all
vault.yaml.default
files tovault.yaml
and fill in the values as appropriate. -
pipenv run ansible-galaxy collection install -r requirements.yml pipenv run ansible-galaxy install -r requirements.yml -p roles/ pipenv run ansible-playbook site.yml -i hosts pipenv run ansible-playbook site.yml -i hosts -l media_center --tags raspotify # --ask-vault-pass # --ask-become-pass
On the machine you would like to run this playbook on, run:
# Install pip3 and pipenv
sudo apt install python3-pip python3-debian && \
pip3 install --user pipenv
# Create pipenv with installed dependencies
PATH=~/.local/bin:$PATH && \
pipenv && \
pipenv update
On every target machine you would like to mananage, execute the following steps:
-
(Raspberry Pi only) Execute
sudo raspi-config
to setup keyboard, locale, hostname, etc. -
(Raspberry Pi only) Force audio through 3.5 mm jack:
sudo raspi-config
-
(Raspberry Pi only) Upgrade the firmware:
sudo rpi-update
-
Enable and start SSH:
sudo systemctl enable ssh sudo systemctl start ssh
-
Create SSH directory:
cd ~ install -d -m 700 ~/.ssh
-
Run from the master machine:
Copy public key to authorized_keys:cat ~/.ssh/id_rsa.pub | ssh <user>@<host> 'cat >> .ssh/authorized_keys'