Reply
Accepted Solution

Restart DHCP services with ansible?

rblumenthal
Techie
Posts: 4
237     0

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?

rblumenthal
Techie
Posts: 4
238     0

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: 15
238     0

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"
 }
]

 

Showing results for 
Search instead for 
Do you mean 

Recommended for You