
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 6,718 Views
Does anyone here know how to manipulate the "name" field in the inventory when using the LDAP plugin with Ansible Automation Controller? I have the plugin working fine, thanks to Zack and this article Ansible Inventory: Microsoft AD Plugin (autodotes.com)
The import pulls the hostname into the name field, and I wanted the FQDN, but I am unsure how to manipulate it.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 5,209 Views
Ultimately this is how I ended up solving this:
I setup my microsoft.ad.ldap.yml file to look like below, and it returned the FQDN as desired.
plugin: microsoft.ad.ldap
attributes:
inventory_hostname: ansible_host

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 3,891 Views
@rrathbun Thank you for reaching out.
I hope the links help.
https://docs.ansible.com/automation-controller/latest/html/administration/ldap_auth.html
https://docs.ansible.com/ansible/latest/collections/microsoft/ad/docsite/guide_ldap_inventory.html

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 3,881 Views
Hello @rrathbun !
Thanks for reaching out!
Refer this doc for help in this query : https://docs.ansible.com/ansible/latest/collections/microsoft/ad/docsite/guide_ldap_inventory.html#a...
https://github.com/joshinryz/ansible_ldap_inventory

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 3,752 Views
you should be able to adjust the value returned by selecting `dnsHostName` instead of `Name`.
# from the module documentation
By default the inventory_hostname for a found host will be based on the name LDAP attribute value. If the dNSHostName attribute is set for the computer account found, it will be set as the ansible_host fact

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 3,219 Views
@milang seems your last sentence was incomplete..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 3,170 Views
@Chetan_Tiwary_ yeah thanks .. copy&paste with a mobile doesn't seem to be working fine

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 3,126 Views
no problem at all @milang Thanks for your inputs !

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 3,087 Views
You need to add:
Enter the user attributes in the LDAP User Attribute Map the text field. In this example, use:
{ "first_name": "givenName", "last_name": "sn", "email": "mail" }

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 3,076 Views
Awesome, thanks for sharing @Psehgaf

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 3,059 Views
Thanks @Psehgaf !