- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Ansible NIOS schedule options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 04:03 AM
We regulary create TXT records via Ansible on a NIOS environment. These only have to be there for a week or so.
I have seen the API allows access to the scheduling options of NIOS and perhaps a scheduled delete is possible in that way, but I can't find this on Ansible. Is that correct, is there another way to do this via Ansible?
Re: Ansible NIOS schedule options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 11:53 AM
You are correct, this has not been added to the Ansible module. You could potentially call the API directly from Ansible, using the built in uri module if you need to use API functions not available in the Infoblox modules. https://docs.ansible.com/ansible/latest/collections/ansible/builtin/uri_module.html
Re: Ansible NIOS schedule options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 07:36 AM
Thanks Jason, that turned out to be easier then expected. Still it feels like a small change to the NIOS Ansible collection.
For reference and perhaps others with the same challenge this is what i did.
- name: Find reference for created TXT record, search based on text ansible.builtin.uri: # start with basic auth force_basic_auth: true user: "{{ username }}" password: "{{ password }}" # GET request on TXT records with text equal to TXT string url: https://gridmaster/wapi/v2.12.3/record:txt?text={{ txt_string }}&_return_as_object=1 - name: Schedule delete that record reference ansible.builtin.uri: # start with basic auth force_basic_auth: true user: "{{ username }}" password: "{{ password }}" # set HTTP method, for this delete method: DELETE # first variable is the reference looked up in previous request # second variable is the current epoch time + 7 times 1 day in seconds, so scheduled delete in 7 days url: https://gridmaster/wapi/v2.12.3/{{ record_reference.json.result[0]._ref }}?_schedinfo.scheduled_time={{ ansible_date_time.epoch | int + ( 86400 * 7 ) }}