single-bigip

Using ansible and an xlsx spreadsheet to set up a single device

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 device will need to have its management IP, netmask, and management gateway configured

It will also need to be licensed and provisionned with ltm (default). It is possible to both provision and license 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 the bigip device
$ 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/single-bigip/
$ cd single-bigip

Executing the playbook

You will then need to edit the single-bigip.xlsx file to your preferences

Then execute the playbook

$ ansible-playbook single-bigip.yml

NOTES:

I have added only Standard Virtual Servers with http, client & server ssl profiles, but hopefully it is pretty obvious from the single-bigip.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 single-bigip.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 device to factory defaults.
To run the reset.yml playbook:
$ ansible-playbook reset.yml

To set up an HA pair, please see https://github.com/bwearp/simple-ha-pair