Skip to content

stuartellis/rpi-management

Repository files navigation

Raspberry Pi Management

A set of Ansible playbooks to configure a Raspberry Pi. These use Podman for running containers on the Pi.

These playbooks currently support Ubuntu 22.04 LTS (64-bit) on Raspberry Pi 4 devices.

  • baseline_ubuntu.yml - Standard setup for Ubuntu
  • cockpit_linux.yml - Cockpit Web interface for administration
  • podman_ubuntu_host.yml - Add Podman to Ubuntu
  • update_ubuntu.yml - Apply operating system updates
  • podman_node_red.yml - Run a Node-RED container with Podman

Setting Up Ansible

To set up Ansible on the computer that will manage the Raspberry Pi devices:

  1. Clone this Git repository to the computer.
  2. Install Ansible on the computer
  3. Edit the inventory to list your Raspberry Pi devices

You can then run the Ansible playbooks.

Installing Ansible

Install Ansible:

pip3 install --user pipx
pipx install ansible-core
ansible-galaxy install -r requirements.yml

Updating the Ansible Inventory

Edit the file inventory/hosts. For each Raspberry Pi device, list the IP address of the device and the name of your user account on that device.

Running Playbooks

Always use syntax-check to validate a playbook before you run it:

ansible-playbook --syntax-check -i inventory/hosts baseline_ubuntu.yml

To carry out a dry-run of a playbook, use --check to enable check mode:

ansible-playbook --check -i inventory/hosts update_ubuntu.yml

To run a playbook:

ansible-playbook -i inventory/hosts update_ubuntu.yml

Diagnostics

To check that Ansible can successfully connect to the devices in the inventory, use the ping module:

ansible -m ping -i inventory/hosts all

To get the Ansible facts for the devices, use the setup module:

ansible -m setup -i inventory/hosts all > all.txt

Resources

About

Administration for Raspberry Pi with Ansible

Topics

Resources

License

Stars

Watchers

Forks