My professional day-to-day role sees me administrating Windows OS based systems using Microsoft System Centre Configuration Manager (SCCM) and Active Directory/Group Policy. Knowing what tools are available to manage so many Windows systems at once I’m looking for something similar to manage several Raspberry Pi (Linux) systems at once. Previously I have looked at network booting a Pi and BASH scripting installs, however today I am going to start investigating Ansible.
Ansible is a piece of agentless configuration management software that can connect via SSH to unix-like (e.g. Linux) and Windows based computers to deliver instructions. These instructions are normally written in YAML (which stands for YAML Ain’t Markup Language) files called playbooks. Playbooks contain plays, which contain tasks (that run sequentially) and tasks can call on modules (which can be written in my favourite language, Python).
Don’t worry if this sounds confusing, for this initial blog post I’m looking at the install of Ansible, with future blog posts looking at more of Ansible.
For this project I am using my trusty Raspberry Pi 3 and Raspbian Buster.
Installing Ansible takes a few lines, one if your apt is up to date 🙂
- sudo apt-get update
- sudo apt-get upgrade
- sudo apt install ansible
Ansible only needs installing on the device that is doing the controlling, it does not need to be installed on the devices receiving the instructions.
Check Ansible Version
To check which version of Ansible is installed, type:
- ansible –version
Ansible Hosts File
Ansible has a hosts file located at /etc/ansible/hosts and this is an inventory of the remote hosts that you want Ansible to look after.
The entries in the host file can be put in line by line (ungrouped) or grouped with a heading in braces e.g. [GROUP_HEADING]. I’m going to add my Raspberry Pi IP addresses into a group called Pi_Collection.
To see if Ansible can correctly read the edited hosts file a quick ping can be done:
- ansible GROUP_HEADING -m ping
For me this is ansible Pi_Collection -m ping. The -m tells Ansible that you want to use a module, in this case the ping module. At this point I feel like I should quote Douglas Adams, “Don’t Panic!”. The response will contain SSH failure messages as the SSH connections have not been set up, this ping is just to check that the Group_Heading / hosts file is set up correctly and as long as all the hosts are there (for me 192.168.1.16, 192.168.1.28 and 192.168.1.3) then all is good.
My next Ansible blog post will be around the SSH set up.
6 thoughts on “Installing Ansible (Raspberry Pi)”
Comments are closed.