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.
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
@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
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
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
@milang seems your last sentence was incomplete..
@Chetan_Tiwary_ yeah thanks .. copy&paste with a mobile doesn't seem to be working fine
no problem at all @milang Thanks for your inputs !
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" }
Awesome, thanks for sharing @Psehgaf
Thanks @Psehgaf !
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.