Forum Discussion

Royce_110733's avatar
Royce_110733
Icon for Nimbostratus rankNimbostratus
May 21, 2016

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.

 

5 Replies

  • 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.

     

  • 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.

     

    • ARsenthil_30459's avatar
      ARsenthil_30459
      Icon for Nimbostratus rankNimbostratus

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

       

    • Nazir_52641's avatar
      Nazir_52641
      Icon for Cirrus rankCirrus
      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