rrathbun
Mission Specialist
Mission Specialist
  • 3,447 Views

Ansible AAP 2.4 Microsoft LDAP Plugin

Jump to solution

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.

Labels (3)
1 Solution

Accepted Solutions
rrathbun
Mission Specialist
Mission Specialist
  • 1,940 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

View solution in original post

0 Kudos
13 Replies
Chetan_Tiwary_
Moderator
Moderator
  • 2,069 Views
0 Kudos
milang
Mission Specialist
Mission Specialist
  • 1,940 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

Chetan_Tiwary_
Moderator
Moderator
  • 1,407 Views

@milang seems your last sentence was incomplete..

0 Kudos
milang
Mission Specialist
Mission Specialist
  • 1,359 Views

@Chetan_Tiwary_ yeah thanks .. copy&paste with a mobile doesn't seem to be working fine  

Chetan_Tiwary_
Moderator
Moderator
  • 1,315 Views

no problem at all @milang Thanks for your inputs !

0 Kudos
Psehgaf
Flight Engineer
Flight Engineer
  • 1,276 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"
}
• ╚╬╦╬Psehgaft╬╦╬╝ ◦
Wasim_Raja
Moderator
Moderator
  • 1,265 Views

Awesome, thanks for sharing @Psehgaf 

0 Kudos
Chetan_Tiwary_
Moderator
Moderator
  • 1,248 Views

Thanks @Psehgaf !

0 Kudos
Join the discussion
You must log in to join this conversation.