Ansible is an open source project sponsored by RedHat, and is the simplest way to automate IT tasks. Used by systems and network administrators, as well as developers and managers, its human-readable data-serialization language can be used to build lists of specific, ordered tasks or 'plays' that are then automated using metadata which determines which user will execute it, when and where. Here's one example of how Ansible can be used with your load balancer....
Ansible is orchestrated by using "Playbooks". These playbooks are simple YAML formatted text files; which are then used to automate common tasks to a predetermined list of targets, in this case a Loadbalancer.org appliance.
In the context of a Loadbalancer.org appliance, what will Ansible do for you?
Automate deployments: VIPs, RIPs etc.
Automate the movement of files, certificates and scripts.
Free up your time to do more with less.
Allow the same tasks to be repeated with reduced risk of human error.
Ansible connects with remote machines over the SSH protocol. By default, Ansible uses OpenSSH and connects to remote machines using a valid user account, just as SSH does.
Before we start...
The Loadbalancer.org IP address used in the following examples is 192.168.83.70. Replace this with your own appliance’s IP address.
Before we can connect to the Loadbalancer appliance using Ansible (which uses SSH), we first need to allow this action through the Appliance Security Options via Local Configuration and then, Security.
Here, you will need to change Appliance Security Mode to Custom. This will then reveal additional security options.
Un-check the Disable SSH Password Access options, as per the example below, then Update:
Connect to the load balancer appliance using SSH with the root user (in the example below we assume that 192.168.83.70 is the appliance IP address being used):
Enter your password for the root user when prompted (this is set during the initial configuration of the appliance).
Once connected, from the terminal prompt, enable API access with the following command (we’ll keep the user and password credentials the same):
lbcli --action api --function enable --username loadbalancer --password loadbalancer
This should output something similar to the following:
LBCLI API Credentials have been set as
NOTE: Now we have our API key; which we will need to use in our Playbook.
We won't go into how to install Ansible here, however we recommend you head over to the Ansible website and follow their guides for installation (make sure you choose the one specific to your environment).
How to deploy your first Ansible Playbook
Now let's look at a simple playbook below which will add a virtual service, terminate it, and add a Web Application Firewall (WAF) and a real server all in a single playbook.
Please remember to update your API key that was issued previously.
After the execution of the playbook has completed, head over to the Loadbalancer appliance (in this example our appliance IP address is 192.168.83.70). You should now see the results on the System Overview page:
This is just one example that demonstrates the simplicity of Ansible. Watch this space for more to come!
Want more on Ansible?
How to solve the Layer 4 ARP problem on Linux with Ansible