Introducing SOC Insights for BloxOne Threat Defense: Boost your SOC efficiency with AI-driven insights to eliminate manual work and accelerate investigation and response times. Read the blog announcement here.

API & Integration, DevOps,NetOps,SecOps

Reply

Ansible Forward to external DNS server

New Member
Posts: 2
3515     1

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: 181
3515     1

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

New Member
Posts: 2
3516     1

Thanks, this worked.

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

Re: Ansible Forward to external DNS server

New Member
Posts: 1
3516     1

This worked to add a forward zone and set the forward IPs.  However, it does not work (on my setup at least) because it does not set anything under the 'Name Servers' tab (see below).  How would I add these using the playbook?

Screenshot 2023-02-14 122757.png 

Re: Ansible Forward to external DNS server

Techie
Posts: 12
3516     1

how do you then update this as I get an error saying you must have a ref to patch.  Are we suppose to query to see if it exist and then pass the ref on a update?

Showing results for 
Search instead for 
Did you mean: 

Recommended for You