Reply

Restart DHCP services with ansible?

New Member
Posts: 4
5692     1

As the title suggests, is it possible to restart the DHCP services using ansible with the Infoblox module? I have a playbook that does a whole slew of tasks but this is the one part that I am stuck. I am hoping there is a way since the the entire playbook relies on this. Thanks

Re: Restart DHCP services with ansible?

New Member
Posts: 4
5692     1

I was able to get this figured out by converting the curl API command to the URI method within ansible.

 

In case anything looks for this. This is what worked for me:

 

    - name: Restart Infoblox Services
      uri:
        url: 'https://x.x.x.x/wapi/v2.9/grid/b45lLmNssXN6ZGIkMA:Infoblox?_function=restartservices'
        user: username
        password: password
        method: POST
        body: '{"restart_option": "RESTART_IF_NEEDED"}'
        body_format: json
        headers:
          Content-Type: "application/json"
        validate_certs: False
      delegate_to: localhost

Re: Restart DHCP services with ansible?

Authority
Posts: 30
5693     1

I tried your example and it didn't work.

Reason was that your URL doesn't work when the name of the Infoblox grid was changed.

I found this in another thread:

curl -k1 -u user:password 'https://x.x.x.x/wapi/v2.5/grid'

will give you the _ref-link that is necessary for the URL to work:

 

[
 {
 "_ref": "grid/XXXXXXXXXXXXXXXXXX:MY_DDI"
 }
]

 

Re: Restart DHCP services with ansible?

New Member
Posts: 2
5693     1

You could also use the ansible infoblox module to restart the services:  https://docs.ansible.com/ansible/latest/collections/infoblox/nios_modules/nios_restartservices_modul...

 

Complete documentation and installation guide is here: https://docs.ansible.com/ansible/latest/scenario_guides/guide_infoblox.html

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You