I’m working on some automation tasks and will be using golang to consume a RESTful API and generate reports on data. I’ve already had vscode installed on my personal computer but I also had a few things to do to get my environment set up for learning and iterating. For my full-time job I work using Mac OS and my PC is a Windows machine for gaming; this is the first blog post I’ve written from my PC!
Through the powerful features offered by the git version control system (VCS) I will be able to keep a public log of my golang areas of interest as well as use private repositories to solve problems and complete tasks. I installed Git for Windows with the option to also install git bash for Windows. I’m interested in seeing how compatible all of this is with the Windows Subsystem for Linux – which I love using!
I added a new public repo called hello-go where I will document some of the tutorial code I find in a place where I can play around with it.
I also added a new private repo for code related to my automation task.
C Spire Business is bringing back its premier tech event Bytes & Bites in Birmingham, AL (and beyond!) on 21 October 2021. If you’re a business or IT leader register now for this free event.
Ansible is an IT automation tool provided by RedHat. It is designed to operate agentless, which means that nodes don’t need separate agent applications to be used in an Ansible automation.
Ansible runs playbooks which execute a series of tasks on a given set of hosts. Tasks are performed in order. It is supposed to be easy to use and understand so that anyone in an IT organization can read a playbook and know what it is doing.
There’s a number of reasons why, rooted generally in the use cases Ansible is known for:
I refered to the latest Ansible community installation guide to figure out what I needed to do to get the tool working on my cluster.
Because Ansible is agentless, I only need a single control node to be able to run playbooks or ad-hoc tasks on managed nodes.
I installed Ansible on
node1 using the system package manager
sudo apt-get install ansible
Ansible allows users to define lists of hosts as inventory.
node1 I opened
/etc/ansible/hosts which is the file containing the hosts I want to run playbooks on and added my cluster. This file has examples of how to add inventory. Following one of those examples resulted in this straightforward definition of my cluster.
At this point I am ready to see whether Ansible is set up and working properly.
ansible all -m ping
This runs the
ping module against all hosts in inventory.
As depicted below, all the hosts were successfully
I’ve got a control node ready to execute playbooks on the cluster.
The only other cluster-related topic I want to delve into now is Kubernetes, so that is what I’ll be working to set up this week.
Yesterday’s post included a reminder that when setting up a new Pi it is important to change the default password of the
pi user. In most distributed computing environments is it also best practice to create individual user accounts to manage access to the various nodes on the network.
My preference is to have a user that can access each node without needing to type a password. This is accomplished with our favorite remote access tool SSH.
I followed the steps outlined below with reference to this guideline from the RPi Foundation.
pi user I can set up a new user for myself.
sudo adduser michael
sudo usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi michael
michael then has permission to act as a sudoer, so I finished the rest of my work on the node logged in as this user using
su (swtich user).
sudo su - michael
raspi-configas new user
raspi-config brings up an interactive menu. Here I set the hostname and timezone.
From my main computer I use
ssh-copy-id which will install my public key onto the node.
The resulting output:
Number of key(s) added: 1
Following this process on each node makes it easy to use my main computer as a workspace and perform tasks. Now that I can connect to each node individually, my next goal is to install Ansible and dive into what sort of automations I can tinker with.
Additionally, because I know Ansible only needs to be installed on one node and its agentless operation requires SSH access, I have also generated an SSH key on
node1 and copied the ID to all the other nodes so that Ansible will be able to perform actions as