Skip to content

A place to hold Ansible roles that have proved useful in more than one project

License

Notifications You must be signed in to change notification settings

mcqn/handy-ansible-roles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

handy-ansible-roles

A place to hold Ansible roles that have proved useful in more than one project

Generally for projects involving Raspberry Pi. Use this entire repository as a template for building out an Ansible-based project.

Steps:

  1. Install Ansible on your computer
  2. Install the latest Raspbian lite image onto a micro-SD card
  3. Create a file called ssh on the /boot partition of the SD card. The contents don't matter, it's just to enable the SSH server. E.g. on Ubuntu touch /media/myusername/boot/ssh
  4. Boot the Raspberry Pi with the micro-SD card, while plugged into a network via Ethernet
  5. Find out the IP address of the Raspberry Pi
  • Use nmap (eg: nmap -p 22 192.168.0.* --open), router or monitor to find IP address of Pi once booted.
  1. Copy your SSH credentials onto the Pi ssh-copy-id pi@<ip-address-of-the-pi>
  2. Edit the hosts file so ansible knows which computer to configure. Change the IP address in it to match the one you just found out.
  3. Check you can run commands on the Pi using Ansible ansible controlled-pi -i hosts -a "hostname" -u pi
  4. Edit custom-install-steps.yml to set the roles that you want for this Pi, add any installation steps, etc. that you need to provision the Pi for the task you need it to do.
  5. Update the Pi, using the playbook you customised in the last step, e.g. ansible-playbook custom-install-steps.yml -i hosts

Roles

These are some of the roles (sets of Ansible commands to fulfil a particular function) that you might want to use:

  • base-nodered Bare minimum Node RED installation, which runs automatically when the Pi is started up
  • renamed-pi Change the hostname of the Pi
  • nm-wireless Use NetworkManager to configure networking, and pre-define Wifi network details. Copy roles/nm-wireless/vars/main-example.yml to roles/nm-wireless/vars/main.yml and edit it to include the details of the Wifi networks to be set up

About

A place to hold Ansible roles that have proved useful in more than one project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published