pexpect must be installed on the hosts that you are targeting. So if you want to run a command with expect on a remote server called server1, pexpect must be installed on server1.
You may wish to run an apt task to instal pexpect on all remote servers before trying to use the expect module. On Saturday, January 16, 2016, jaadu <[email protected]> wrote: > I am playing around with Ansible on Ubuntu 14.04 VMs and can't seem to get > expect to work. I have tried installing ansible and pexpect via apt-get and > pip, but keep getting the following error: > > fatal: [vagrant]: FAILED! => {"changed": false, "failed": true, > "invocation": {"module_args": {"chdir": null, "command": "domainjoin-cli > leave user", "creates": null, "echo": false, "removes": null, "responses": > {"password": "password"}, "timeout": 30}, "module_name": "expect"}, "msg": > "The pexpect python module is required"} > > > "pip freeze" says: > > Jinja2==2.8 > Landscape-Client==14.12 > MarkupSafe==0.23 > PAM==0.4.2 > PyYAML==3.11 > Twisted-Core==13.2.0 > ansible==2.0.0.2 > apt-xapian-index==0.45 > argparse==1.2.1 > chardet==2.0.1 > colorama==0.2.5 > configobj==4.7.2 > ecdsa==0.13 > html5lib==0.999 > paramiko==1.16.0 > pexpect==4.0.1 > ptyprocess==0.5 > pyOpenSSL==0.13 > pycrypto==2.6.1 > pyserial==2.6 > python-apt==0.9.3.5ubuntu2 > python-debian==0.1.21-nmu2ubuntu2 > requests==2.2.1 > six==1.5.2 > ssh-import-id==3.21 > urllib3==1.7.1 > wheel==0.24.0 > wsgiref==0.1.2 > zope.interface==4.0.5 > > > my playbook code: > > - hosts: local_lab > remote_user: vagrant > become: true > vars: > admin_user: "{{user}}" > admin_pass: "{{pass}}" > tasks: > - name: pbis-open - remove old - leave domain > expect: > command: domainjoin-cli leave {{admin_user}} > responses: > (?i)password: "{{admin_pass}}" > > > my cli command: > > ansible-playbook -vvvv pbis-open.yml --inventory-file=lab > --extra-vars="user=user pass=password" > > > Thanks for your time. Any help is greatly appreciated. > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/74da8bea-97f8-451b-9c4b-430d2ded0c10%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/74da8bea-97f8-451b-9c4b-430d2ded0c10%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v9weX-60WvFXXhw47nXJ-utp%3DacBFpjZyU7z5Si6YjztA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
