Hi,
When I ran this sample:
- expect:
command: passwd master
responses:
(?i)password: “234567”
sudo: yes
register: hello
name: Debug hello.stdout as part of a string
- debug: msg={{ hello.stdout }}
Print all contents of the shell task’s output.
- debug: var=hello
It threw these exception:
TASK [router : expect command=passwd master responses={u’Enter new UNIX password’: u’234567’}] ***
fatal: [147.128.112.106]: FAILED! => {“changed”: false, “failed”: true, “msg”: "
BECOME-SUCCESS-djevcomgojpacemokygqkwzibvtnyxno
Traceback (most recent call last):
File "/home/xjigzho_local/.ansible/tmp/ansible-tmp-1454491175.33-231534496369283/expect", line 2084, in
main()
File "/home/xjigzho_local/.ansible/tmp/ansible-tmp-1454491175.33-231534496369283/expect", line 155, in main
events=events, cwd=chdir, echo=echo)
File "/usr/lib/python2.7/dist-packages/pexpect/init.py", line 224, in runu
env=env, _spawn=spawnu, **kwargs)
File "/usr/lib/python2.7/dist-packages/pexpect/init.py", line 233, in _run
cwd=cwd, env=env, **kwargs)
File "/usr/lib/python2.7/dist-packages/pexpect/init.py", line 1754, in init
super(spawnu, self).init(*args, **kwargs)
TypeError: init() got an unexpected keyword argument ‘echo’
Exception AttributeError: "‘spawnu’ object has no attribute ‘closed’" in <bound method spawnu.del of <pexpect.spawnu object at 0x7f346cfad410>> ignored
", “parsed”: false}
Something wrong with expect module. Why it threw excption?
Thanks.