Setup and configuration of my own Raspberry Pi fleet via Ansible Collection (use by your own risk).
Fleet Members (Metal Gear Characters)
-
Pi-hole DNS sinkhole instance.
-
services:
-
jump: Simple startpage. otacon.local
-
pihole: The Pi-hole DNS sinkhole instance. Available at pihole.otacon.local
-
whoami: Tiny Go webserver that prints os information and HTTP request to output. Available at whoami.otacon.local
-
netdata: Monitor everything in real time. Available at netdata.otacon.local
-
-
variables:
-
rpi_locale: Raspberry Pi locale config. (Default:en_US.UTF-8) -
rpi_layout: Raspberry Pi keyboard layout config. (Default:us) -
rpi_dist_upgrade: If Raspberry Pi should do a dist-upgrade. (Default:no) -
rpi_tz: Raspberry Pi Time Zone config. (Default:'Europe/Amsterdam') -
rpi_wifi_country: Raspberry Pi Wifi Country config. (Default:NL) -
rpi_pihole_password: pihole.otacon.localAdmin password. (Default:random) -
rpi_swap_config: Raspberry Pi swap config. (Default:CONF_SWAPSIZE: 100) -
rpi_open_weather_map_key: An API key for Open Weather Map, LATLONG (below) must also be defined. -
rpi_latlong: A latitude and longitude for the default location. (Default:51.9812,5.6584)
-
-
-
Ocelot (Revolver Ocelot)
OctoPrint an snappy web interface for my 3D printer.
-
services:
-
jump: Simple startpage. ocelot.local
-
octoprint: The snappy web interface for your 3D printer! octoprint.ocelot.local
-
whoami: Tiny Go webserver that prints os information and HTTP request to output. Available at whoami.ocelot.local
-
netdata: Monitor everything in real time. Available at netdata.ocelot.local
-
-
variables:
-
rpi_locale: Raspberry Pi locale config. (Default:en_US.UTF-8) -
rpi_layout: Raspberry Pi keyboard layout config. (Default:us) -
rpi_dist_upgrade: If Raspberry Pi should do a dist-upgrade. (Default:no) -
rpi_tz: Raspberry Pi Time Zone config. (Default:'Europe/Amsterdam') -
rpi_wifi_country: Raspberry Pi Wifi Country config. (Default:NL) -
rpi_swap_config: Raspberry Pi swap config. (Default:CONF_SWAPSIZE: 100) -
rpi_open_weather_map_key: An API key for Open Weather Map, LATLONG (below) must also be defined. -
rpi_latlong: A latitude and longitude for the default location. (Default:51.9812,5.6584)
-
-
-
more coming ...
-
Clone this repository.
-
Install dependencies:
$ poetry install --no-root Creating virtualenv raspberry-pi in .venv Using virtualenv: .venv Installing dependencies from lock file Package operations: 95 installs, 0 updates, 0 removals ... -
Activate the virtual environment:
$ poetry shell Spawning shell within .venv (raspberry-pi)$
-
Install required Ansible roles:
(raspberry-pi)$ ansible-galaxy install -r requirements.yml
or
(raspberry-pi)$ inv galaxy-install
-
Configure the
inventoryfile, e.g.:[otacon] 127.0.0.1 ansible_python_interpreter=/usr/bin/python3 ansible_user=pi ansible_password=somepassword ansible_become_password=somepassword -
Run the playbook:
(raspberry-pi)$ ansible-playbook main.yml -i inventory
or
(raspberry-pi)$ inv playbook
-
Enjoy!
The tags available are:
alwaysdockerfirewallgitinitlcdmdns-beaconpipsecurityservicessshsupervisor
You can override the defaults configured in default.<fleet-member>.config.yml by creating a <fleet-member>.config.yml file and setting the overrides in that file. e.g.:
security_ssh_password_authentication: "yes"
security_ssh_permit_root_login: "yes"
security_autoupdate_mail_to: example@example.comAny variable can be overridden in <fleet-member>.config.yml; see the supporting roles documentation for a complete list of available variables.
To display available tasks run:
(raspberry-pi)$ inv --list
Available tasks:
ansible-lint Run ansible linter.
clean Run all clean sub-tasks.
clean-python Clean up python file artifacts.
format Format code.
galaxy-install Install ansible-galaxy requirements.
hooks Run pre-commit hooks.
install-hooks Install pre-commit hooks.
lint Run all linting.
mypy Run mypy.
playbook Run Ansible playbooks, executing the defined tasks on the targeted hosts.
ruff Run ruff.
security Run security related checks.
tests Run ansible molecule test.
version Bump version.
yamllint Run yamllint, a linter for YAML files.MIT / BSD
This playbook was created in 2020 by Federico Jaureguialzo.