Here is the scnario which we tried last week with Pranav Goel in order to login the Ansible remote server which is enlabe with LDAP and become a su to execute any playbook tasks. Here are the steps given as below;
[root@ussltcovm498 ansible]# cat inventory hostname.demo.com ansible_user=adname\\aduser ansible_ssh_pass=password ansible_become_pass=password
Ansible Configuration File)
[privilege_escalation] become=True become_method=su become_user=oracle #become_ask_pass=True
In order to pass LDAP user use “\\”
Command to Check:
ansible all -i inventory -m command -a "whoami"