Infoblox’s global team of threat hunters uncovers a DNS operation with the ability to bypass traditional security measures and control the Great Firewall of China. Read about “Muddling Meerkat” and the many other threat actors discovered by Infoblox Threat Intel here.

API & Integration, DevOps,NetOps,SecOps

Reply

Ansible Forward to external DNS server

New Member
Posts: 2
4775     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: 181
4775     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

New Member
Posts: 2
4775     0

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
4776     0

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
4776     0

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