This repo contains automation that bootstraps Raspberry Pis with services bound for my home network. The automation in this project includes the following:
- Ansible plays that manage the configuration of services on the device.
- Docker containers that host and run services.
- Wrapper scripts that ease the usage of the Ansible commands.
If this is your first time setting up the development environment for this project, please refer to the instructions in ubuntu-dev-environment.md first.
The following instructions will assume that you've already done this.
This project uses pyenv to manage and track its Python version.
Run the following command to instruct pyenv to switch to the Python version specified in the
.python-version
file located at the root of this project: Run the
following command to instruct
eval "$(pyenv init -)"
Tip
This can be run from any folder in this project. Additionally, this command will need to be run every time you open a new terminal to work on this project.
Install Ansible and its dependencies with PDM:
./pw pdm sync
Ansible uses SSH to connect to managed nodes. To avoid repeatedly entering the private key passphrase, load your SSH private key into ssh-agent with the following command:
ssh-add ~/.ssh/id_rsa
Ping the managing node (probably your localhost
) to verify the connection:
./pw pdm run --venv in-project ansible localhost -m ping
Tip
See hosts.ini
for other managed nodes.
In order to run this role your playbook must make use of the following:
- Elevated privileges using
become: yes
- Collect system information using
gather_facts: yes
To run this role, your playbook must include the following:
- Elevated privileges: Use
become: yes
to execute tasks requiring administrative access. - System information collection: Enable
gather_facts: yes
to collect essential system details before executing tasks.
For example:
- hosts: servers
name: Configure security settings
become: yes
gather_facts: yes
tasks:
- import_role: name=security