I am trying to use Ansible with the expect module to join a linux server to a active directory with sssd.
code from the task:
- name: join domain
expect:
command: /bin/bash -c "/usr/sbin/realm join --user=join-user domain.loc"
response:
password: "secret"
I got the code from this link since I googled around before asking here: https://groups.google.com/forum/#!msg/ansible-project/L0Es3aGAKV8/DmPRaiGcBwAJ
The actual problem is that Ansible does not seem to actually respond to the prompt. Because when I run the playbook it just times out. I did test this directly via ssh and it works. Credentials are fine and the connection to the domain controller works.
Output of the playbook when it times out:
fatal: [192.168.11.1]: FAILED! => {
"changed": true,
"cmd": "/bin/bash -c \"/usr/sbin/realm join --user=join-user domain.loc\"",
"delta": "0:00:30.112149",
"end": "2017-03-22 08:37:18.320832",
"failed": true,
"invocation": {
"module_args": {
"chdir": null,
"command": "/bin/bash -c \"/usr/sbin/realm join --user=join-user domain.loc\"",
"creates": null,
"echo": false,
"removes": null,
"responses": {
"password": "secret"
},
"timeout": 30
},
"module_name": "expect"
},
"msg": "command exceeded timeout",
"rc": null,
"start": "2017-03-22 08:36:48.208683",
"stdout": "Password for join-user: ",
"stdout_lines": [
"Password for join-user: "
]
}
Any help is greatly appreciated.