Ansible期望不传递回应

我正在试图使用期望模块的Ansiblejoin一个Linux服务器与sssd的活动目录。

来自任务的代码:

- name: join domain expect: command: /bin/bash -c "/usr/sbin/realm join --user=join-user domain.loc" response: password: "secret" 

我从这个链接得到的代码,因为我之前googlesearch: https ://groups.google.com/forum/#!msg/ansible-project/L0Es3aGAKV8/DmPRaiGcBwAJ

实际的问题是,Ansible似乎并没有真正回应提示。 因为当我运行剧本时,它只是超时。 我没有直接通过SSHtesting,它的工作原理。 凭据很好,连接到域控制器的工作。

剧本在超时时输出:

 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: " ] } 

任何帮助是极大的赞赏。

响应必须匹配标准输出string,或者你可以使用正则expression式,在你的情况下你可以使用:

 response: Password for join-user: "secret" 

要么

 response: Password for .*: "secret" 

从doc

在响应下的问题或关键是一个python正则expression式匹配。 不区分大小写的search用前缀“i”表示