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 framboos 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 && \
pip3 install --user pipenv
# Create pipenv with installed dependencies
PATH=~/.local/bin:$PATH && \
pipenv && \
pipenv update
# If you use the default system Python
sudo apt install python3-debian
# If you use Pyenv
pip install python-debian
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
-
Install the SSH server:
sudo apt install openssh-server
-
(Optional, this might have been done already) Enable and start SSH:
sudo systemctl enable ssh sudo systemctl start ssh
-
(Optional, this might have been done already) Create SSH directory:
cd ~ install -d -m 700 ~/.ssh
-
Run from the main machine:
Copy public key to authorized_keys:ssh-copy-id <user>@<host>
-
Run from the main machine:
(Optional) Copy the public/private key pair:scp ~/.ssh/id_rsa* <user>@<host>:~/.ssh