Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Clear all filters
Answers

Create HTTPS Pool Monitor on LTM using Ansible

My team recently started testing Ansible functionality for building objects on our F5 LTMs. Part of the process that we would like to automate is the creation of pool monitors. I can successfully create HTTP and TCP monitors using the bigip_monitor_http and bigip_monitor_tcp modules but am having problems creating an HTTPS monitor.

At first I thought I could use the bigip_monitor_http module and just set the type and parent options to https but the module doesn't appear to support an option for type and if I try to set parent to https, it fails since the parent doesn't match the monitor's default type which is http. Trusty google didn't seem to provide any help and I don't see a bigip_monitor_https module in the Ansible documentation.

My guess is that this functionality is not supported based on the available modules/options in Ansible but I wanted to verify before I proceed with going down a different path.

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Have you tried using iControl in Python and then use that script within Ansible ?

A bit of digression, don't use the default profiles. Create custom profiles using the default profile as the parent profile.

0
Comments on this Answer
Comment made 25-May-2016 by Royce 2
At this point I haven't tried writing my own python scripts to make calls to the F5 API but that is a valid recommendation. We were hoping that we could use the pre-built F5 modules in Ansible (http://docs.ansible.com/ansibl/list_of_network_modules.html_) and use customized options in a playbook as needed. Is this not recommended? It looks like the pre-built Ansible F5 modules are python scripts so perhaps they were just meant to be a starting point. If I were to start writing python scripts to automate creating certain objects on the F5 LTMS do you have recommendation on which library to import bigsuds, pycontrol v2, or the F5 python SDK? I am not a developer so the different options are a bit confusing.
0
Comment made 25-May-2016 by Vijay 4916
I am not a dev guy either but that is the way of the future :) If I have to recommend based on my experience, I would say go with F5 Python SDK. It relies on iControl REST. You can also script directly using iControl REST.
0
Comment made 25-May-2016 by Royce 2
Thanks for the recommendation Odaah! I will head down that path and see what I can come up with.
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

In the end, I decided to use Ansible to build a python script that makes cURL posts to the iControl REST API in order to build objects on the LTM. I used the requests and json libraries in python and the total work was only a few hours. I decided to go down this path so the python script could go through a review workflow before it was executed.

If anyone is interested I can provide some examples of the Ansible and Python configs.

0
Comments on this Answer
Comment made 12-Aug-2016 by jbilbro 51

Yes, please post your example Ansible and Python code!

0
Comment made 02-Feb-2017 by ARsenthil 2

@Royce, Even i am also trying to do a similar stuff , it would be great if you can share the example Thanks

0
Comment made 23-May-2017 by Nazir 252
Hi Senthil,jbilbro,

You can use iControl REST API using uri module to create any object in F5. Below sample code is used to create node in F5.

 - name: " Create node"
   uri:
     url: "https://bigip1.example.com/mgmt/tm/ltm/node/"
     method: "POST"
     validate_certs: no
     username: "admin"
     password: "admin"
     body_format: "json"
     body:
       name: "192.168.5.100"
       partition: "Common"
       address: "192.168.5.100"
   delegate_to: localhost

Thanks
Syed Nazir
0