- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Add CAA Record Using Ansible URI module
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2023 11:29 AM - edited 01-06-2023 11:30 AM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2023 05:57 AM
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
Re: Add CAA Record Using Ansible URI module
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
I realize this is a late reply but if you're still stuck, I always place quotes around the URL value in the URI definition in the playbook. That may be what is creating the bad request.