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

Add CAA Record Using Ansible URI module

[ Edited ]
Authority
Posts: 18
727     0

I'm trying to add a CAA recording using Ansible but I don't see a module for this so I'm trying to add the record using the Ansible URI module.  It works when I use postman but fails using Ansible with a Bad Request error.  I have also tried a simple GET from an example from Infoblox and it also fails.  Not sure why.  Here's my code for the simple GET request for a member.

 

- name: Add CAA Record
  hosts: Infoblox
  collections: 
   - infoblox.nios_modules
  connection: local
  gather_facts: false
  vars_files: 
    - defaults/main.yml

  tasks:

    - name: Get object reference of the DNS service
      uri:
        url: https://GRD02NODE1.site/wapi/v2.11.2/member:dns?host_name=dns.net
        user: "{{ nios_provider.username }}"
        password: "{{ nios_provider.password }}"
        validate_certs: no
        return_content: yes
        method: GET
        force_basic_auth: yes
        status_code: 200
      register: content

This is the error:
    "msg": "Status code was 400 and not [200]: HTTP Error 400: Bad Request",
    "redirected": false,
    "referrer_policy": "no-referrer-when-downgrade",
    "status": 400,
    "strict_transport_security": "max-age=31536000; includeSubDomains",
    "url": "https://GRD02NODE1.site/wapi/v2.11.2/member:dns?host_name=dns.net",
    "x_content_type_options": "nosniff",
    "x_frame_options": "SAMEORIGIN",
    "x_xss_protection": "1; mode=block"

 

Re: Add CAA Record Using Ansible URI module

Superuser
Posts: 17
727     0

Have you tried specifically setting the accept-header to application/json?, i.e.

 

- name: Get object reference of the DNS service
      uri:
        url: https://GRD02NODE1.site/wapi/v2.11.2/member:dns?host_name=dns.net
        user: "{{ nios_provider.username }}"
        password: "{{ nios_provider.password }}"
        validate_certs: no
        return_content: yes
        method: GET
        headers:
          Accept: application/json
        force_basic_auth: yes
        status_code: 200
      register: content 

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You