This repo contains automation that bootstraps Raspberry Pis with services bound for my home
network, dubbed netdavis.net
. The automation in this project includes the following:
- Ansible plays that manage the setup of services on the device.
- 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 its Python version.
Run the following command to instruct pyenv to switch to the version of Python tracked in the
.python-version
file, which is located in the root of this project:
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 connects to managed nodes via SSH. Load your SSH private key into ssh-agent
by
running 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
Here is an example:
- hosts: servers
name: Configure security settings
become: yes
gather_facts: yes
tasks:
- import_role: name=security