Ansible HA pair deployment using excel spreadsheet. No Ansible knowledge required

Problem this snippet solves:

No Ansible knowledge required. Just fill in the spreadsheet and run the playbook. Easily customisable if you want to get more complex

Please see: https://github.com/bwearp/simple-ha-pair

How to use this snippet:

simple-ha-pair

Using ansible and an xlsx spreadsheet to set up an HA pair

Tested on BIG-IP Software version 12.1.2

The default admin password of admin has been used

This project uses the xls_to_facts.py module by Matt Mullen
https://github.com/mamullen13316/ansible_xls_to_facts

Requirements:

BIG-IP Requirements
The BIG-IP devices will need to have their management IP, netmask, and management gateway configured

They will also need to be licensed and provisionned with ltm. It is possible to both provision and license the devices with ansible but it is not within the remit of this project.

For additional information on Ansible and F5 Ansible modules, please see: http://clouddocs.f5.com/products/orchestration/ansible/devel/index.html

Ansible Control Machine Requirements
I am using Centos, other OS are available

Note: It will be easiest to carry out the below as the root user

You will need Python 2.7+
$ yum install python

You will need pip
$ curl 'https://bootstrap.pypa.io/get-pip.py' > get-pip.py && sudo python get-pip.py

You will need ansible 2.5+
$ pip install ansible

If 2.5+ is not yet available, which it wasn't at the time of writing, please download directly from git
$ yum install git
$ pip install --upgrade git+https://github.com/ansible/ansible.git

You will need to add a few other modules
$ pip install f5-sdk bigsuds netaddr deepdiff request objectpath openpyxl

You will need to create and copy a root ssh-key to BOTH the bigip devices
$ ssh-keygen
Accept the defaults
$ ssh-copy-id -i /root/.ssh/id_rsa.pub root@<bigip-management-ip>
Example:
$ ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.1.203

You will need to download the files using git - see above for git installation
$ git clone https://github.com/bwearp/simple-ha-pair/
$ cd simple-ha-pair

Executing the playbook

You will then need to edit the simple-ha-pair.xlsx file to your preferences

Then execute the playbook as root

$ ansible-playbook simple-ha-pair.yml

NOTES:

In the simple-ha-pair.xlsx spreadsheet:
The HA VLAN must be called 'HA'
The settings where yes/no are required must be yes/no and not YES/NO or Yes/No
One device must have primary=yes and the other must have primary=no

I have added only Standard Virtual Servers with http, client & server ssl profiles, but hopefully it is pretty obvious from the simple-ha-pair.yml playbook how to add in others.

Trunks haven't been added. This is because you can't have trunks in VE and also there is no F5 ansible module to add trunks. It could be done relatively easily using the bigip_command module, and hopefully the bigip_command examples in the simple-ha-pair.yml file will show that.

I haven't added in persistence settings, as this would require a dropdown list of some kind. Is simple enough to do.

Automation does not sit well with complication

To update if there are any changes, please cd to the same folder and run:
$ git pull

You will notice there is also a reset.yml playbook to reset the devices to factory defaults.
To run the reset.yml playbook as root:
$ ansible-playbook reset.yml

Code :

https://github.com/bwearp/simple-ha-pair/blob/master/simple-ha-pair.yml

Tested this on version:

12.1
Published Feb 12, 2018
Version 1.0
No CommentsBe the first to comment