THE GAME HAS CHANGED

Introducing Infoblox Universal DDI ManagementTM

Watch the launch to discover the new era of management for critical network services. Watch Now

API & Integration, DevOps,NetOps,SecOps

Reply

Inconsistent behavior with TXT records via API

New Member
Posts: 2
1331     0

Hello.

I've been recently working to automate some common tasks for my enterprise's helpdesk. While doing some testing, I noticed strange behavior from the API and by extension the Ansible module for creating a TXT record. https://docs.ansible.com/ansible/2.8/modules/nios_txt_record_module.html

 

The best way I can describe the problem is if you supply the "text" parameter for a TXT record of a single word without spaces enclosed with double quotes, Ansible/Infoblox's API will create it fine the first time. However, when you re-run the playbook with the same params, the playbook will fail with the error Client.Ibap.Data.Conflict "The record 'recordname' already exists.".

The expected behavior for this would be to return an "ok" since you're supplying the same info and it already exists.

 

The interesting part is that the API/Ansible module works as expected if you supply the "text" parameter without escaping the quotes if the text you're adding is a single word, or if you are supplying a word with spaces. 

To better illustrate...

  - name: "Configure internal TXT Record"
    infoblox.nios_modules.nios_txt_record:
      name     : "server.company.com"
      text     : "\"hello2 quotes pls\""
      view     : "Internal"
      state    : present
      provider : "{{ infoblox_credentials }}"
      comment  : "DNS Record via automation"

and

  - name: "Configure internal TXT Record"
    infoblox.nios_modules.nios_txt_record:
      name     : "server.company.com"
      text     : "hello2quotespls"
      view     : "Internal"
      state    : present
      provider : "{{ infoblox_credentials }}"
      comment  : "DNS Record via automation"

both work every time they're run. The first time they run, they create the record. All subsequent times they run, they return an "ok" which is expected behavior.

The problem lays in an example like this:

  - name: "Configure internal TXT Record"
    infoblox.nios_modules.nios_txt_record:
      name     : "server.company.com"
      text     : "\"hello2quotespls\""
      view     : "Internal"
      state    : present
      provider : "{{ infoblox_credentials }}"
      comment  : "DNS Record via automation"

The above code will work once, creating the record, and fail every other time it's ran with the error about a conflicting record.

 

This isn't a huge problem that is a pressing issue, but I think it is a bug since the API is able to deal with essentially the same data and do the correct type of enforcements for the previous two examples but not for a string without spaces enclosed by a \". Since I'm dealing with user input data, I enclose everything with \" since a user can opt to supply a TXT record with spaces or not, and figured doing so every time would be a good idea. Sorry if this is dumb of me, I'm but a lowly Linux server guy doing automation.

 

My apologies if this has been posted before, I did a search but I didn't see posts about this problem.

 

Re: Inconsistent behavior with TXT records via API

Moderator
Moderator
Posts: 315
1331     0

I would expect different results when using escaped double quotes, as compred with no escaped double quotes.   While the end result may be the same in a lot of cases, there is a difference between having quotes in the record RDATA vs. not having quotes.

 

Have you tried recreating the issue with Infoblox WAP calls?  I am not an Ansible user, so maybe someone else with more experience there might chime.   However this seems like a behavior issue with the Ansuible playbook, and not with the Infoblox API.

Re: Inconsistent behavior with TXT records via API

New Member
Posts: 2
1331     0

True, it could be Ansible-only.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You