API & Integration, DevOps,NetOps,SecOps

Reply

Ansible Forward to external DNS server

Member
Posts: 2
590     0

Hi

 

I'm got a playbook that can create a zone on InfoBlox when Infoblox is Authorative for that zone, but I am wondeirng if it's possible to create a forward zone with Ansible. I'm read the docs but found them confusing.

Re: Ansible Forward to external DNS server

Adviser
Posts: 164
591     0

Hi,

 

We don't have in-built Ansible modules for forward zones. However, you can leverage the URI module available in Ansible to fire up the REST API for forward zones. Here is a snippet you can use:

---
  
- hosts: localhost
  vars:
    host: grid-master.demo.com
    username: cloudadmin
    password: pwd
    wapi_version: 'v2.10'

  connection: local
  tasks:
   - name: Create a forward zone
     uri:
       url: "https://{{ host }}/wapi/{{ wapi_version }}/zone_forward"
       user: "{{ username }}"
       password: "{{ password }}"
       validate_certs: no
       return_content: yes
       method: POST
       force_basic_auth: yes
       status_code: 201, 302, 200
       headers:
         Content-Type: "application/json"
       body:
         fqdn: infoblox.com
         forward_to:
            - address: 10.10.10.11
              name: host.infoblox.com
       body_format: json

Hope this helps,

Krishna Vasudevan

Re: Ansible Forward to external DNS server

Member
Posts: 2
591     0

Thanks, this worked.

As a follow up is it possible to just modify the addess's being used with that snippet?

Showing results for 
Search instead for 
Did you mean: 

Recommended for You