![]() ![]() Target hosts are defined in an inventory file. Groups of tasks and related metadata (variables, templates) can be specified by “roles”. Ansible is a provisioning and configuration management tool which allows one to script tasks to be executed on multiple target hosts. ![]() Having to SSH into 4 machines and run the same commands to update and install the software sounded tedious - and what happens if I need to start over and repeat the steps? This is where Ansible comes in. I am positive there is a better way to use Ansible, hopefully I end up learning it! I’ve done a bunch of copying, pasting and tweaking from various sources to cobble together enough to get things working for me. Monitoring With Prometheus Using Ansible by Mitesh Sharmaĭisclaimer: I am not an Ansible expert.I’m not sure it’s possible to write anything about Raspberry Pi clusters without mentioning Alex Ellis :).Monitor your Raspberry Pi cluster with Prometheus by Alex Ellis.Raspberry Pi CPU temperature measurements are supplied by another Prometheus exporter tool aptly named RPi exporter. To provide the Prometheus server with measurements I am using the popular node_exporter package which makes a multitude of system resources available for metrics collection. I chose the popular combination of Prometheus for metrics collection and Grafana for dashboard visualisation as my monitoring suite. Softwareįor this phase of the project I want to install some monitoring software to track system resources, and especially the Pi CPU temperatures. $ ssh-copy-id ssh-copy-id ssh-copy-id ssh-copy-id will allow me to SSH in to each Pi without being prompted for a username and password, and will also make execution of the the Ansible tasks much easier. ![]() Next I copied across the SSH public key from my laptop to each Pi: This makes it easier to troubleshoot network issues by knowing which Pi is assigned to which IP address. Doing it one-by-one makes it more obvious which MAC address belongs to which Pi. The reason behind plugging in the power cable one-by-one for each Pi is that at the same time as configuring the OS described above I also configured a static IP address for each Pi on my Netgear router. Reduce the GPU memory to 16 MB (I set it to the minimum as I’ll likely never connect a display to any of the Pi).As I have a different colour Ethernet cable for each Pi, I used the colour as part of the hostname, e.g. Once logged into the Pi, I ran sudo raspi-config to enter the Raspberry Pi configuration tool, and modified the following:.SSH into the Pi from my laptop, using the default username ( pi) and password ( raspberry).Wait around 30 seconds for the Pi to boot up and start the SSH server.I inserted the microSD cards into the slots on each of the Pi, and then one Pi at a time performed the following: I flashed the latest release () of Raspbian Lite to each of the microSD cards, and also enabled SSH access on boot by adding an empty ssh file on the boot partition. If I decide to go “mobile” with the cluster I will think about getting a smaller router, one that may be powered from 5V USB as I have an unused port on the Anker PowerPort. I can see why one might opt to use “flat” network cables, but at the time they were quite a bit more expensive than the pack of 5 that I ended up buying. So far all my choices are serving me well. 4x Samsung EVO Select 32 GB micro SD card.4x AmazonBasics 0.3m USB Type-C to Type-A cable.I’ve connected a cable from my ISP router to the Internet port, plugged the 4x Pi into the remaining LAN ports and I connect my laptop to this network via WiFi. It has 1x Internet port, 4x LAN ports and dual band WiFi.Originally purchased in 2012, I’ve had this router sitting unused in a cupboard for a few years.1x Netgear N600 Wireless Dual Band Gigabit Router WNDR3700v3.Includes fans and heat sinks for 4x Pi.I found a local seller on eBay who had a decent price on some unopened Pi 4 models.These are the various hardware components which make up my cluster: This first post details my hardware set-up as well as how I used Ansible to “remote control” the installation of monitoring software on each of the Pi hosts, with the goal to observe the Raspberry Pi CPU temperatures. I decided to build a Raspberry Pi cluster to give me a platform with which I can practice distributed computing technologies without needing to rely on a cloud provider. ![]()
0 Comments
Leave a Reply. |