- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Ansible lookups
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-16-2019 10:58 AM
Hi all,
I'm trying to use Infoblox with Ansible for both A-Record and PTR. How can I do this? I'm trying to find a fqdn from an ip, or an ip from a fqdn.
Thanks.
Re: Ansible lookups
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-20-2019 11:19 PM
Hi,
You can do so by using the lookup plugins in your playbook as below.
--- - hosts: localhost vars: nios_provider: host: grid-master username: admin password: infoblox connection: local tasks: # Get the list of A records - name: get member list set_fact: arecords: "{{ lookup('nios', 'record:a', provider=nios_provider) }}" - name: display all A records debug: msg: "{{ arecords}}" # Get an A record using its name - name: get A record set_fact: arecord: "{{ lookup('nios', 'record:a', filter={'name': 'a.demo.com'}, provider=nios_provider) }}" - name: display A record a.demo.com debug: msg: "{{ arecord}}" # Get an A record using its IP address - name: get A record set_fact: arecord: "{{ lookup('nios', 'record:a', filter={'ipv4addr': '192.168.1.2'}, provider=nios_provider) }}" - name: display A record for 192.168.1.2 debug: msg: "{{ arecord}}" # Get all PTR records - name: get all PTR records set_fact: ptrrecord: "{{ lookup('nios', 'record:ptr', provider=nios_provider) }}" - name: display list of PTR records debug: msg: "{{ ptrrecord}}" # Get PTR record using its name - name: get PTR record set_fact: ptrrecord: "{{ lookup('nios', 'record:ptr', filter={'ptrdname': 'a.demo.com'}, provider=nios_provider) }}" - name: display PTR record a.demo.com debug: msg: "{{ ptrrecord}}"
Hope this helps,
Krishna Vasudevan
Re: Ansible lookups
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-19-2020 03:51 PM
Is there any way to get records from specific dns view instead of getting all the records
Re: Ansible lookups
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-03-2020 09:06 AM
Hi,
You can add it as part of filters.
# Get an A record in a view - name: get A record set_fact: arecord: "{{ lookup('nios', 'record:a', filter={'view': 'test'}, provider=nios_provider) }}" - name: display A records in view test debug: msg: "{{ arecord}}"
Hope this helps,
Krishna