Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The pexpect python module is required error even-though it is installed on host machine #21416

Closed
alirezamansoori opened this issue Feb 14, 2017 · 1 comment
Assignees
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. module This issue/PR relates to a module.

Comments

@alirezamansoori
Copy link

alirezamansoori commented Feb 14, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME

expect module

ANSIBLE VERSION
ansible 2.2.0.0
CONFIGURATION

Mention any settings you have changed/added/removed in ansible.cfg
(or using the ANSIBLE_* environment variables).
default

OS / ENVIRONMENT

Mention the OS you are running Ansible from, and the OS you are
managing, or say “N/A” for anything that is not platform-specific.
Host Machine: 2.6.32-431.23.3.el6.x86_64
Target Machine: 2.6.32-431.23.3.el6.x86_64
Python version on both machines: 2.6.6
pexpect installed on Host machine
pexpect NOT installed on host machine

SUMMARY

When using the expect module I get the "The pexpect python module is required" error message. I'm testing with just a simple expect command from the module documents.
This is puzzling because the documents clearly state that pexpect >3.3 is a requirement for Host machine. I have installed pexpect on Host machine and it imports successfully and I can use pexpect.run as well.

STEPS TO REPRODUCE
- expect:
    command: passwd replace-with-activeuseraccount
    responses:
      (?i)password: "MySekretPa$$word"
EXPECTED RESULTS

change pass

ACTUAL RESULTS
Using module file /usr/lib/python2.6/site-packages/ansible/modules/extras/commands/expect.py
<target ip> ESTABLISH CONNECTION FOR USER: removed-userinfo on PORT 22 TO 135.69.202.198
<target ip> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /tmp/ansible-tmp-1487093318.99-115071363562773 `" && echo ansible-tmp-1487093318.99-115071363562773="` echo /tmp/ansible-tmp-1487093318.99-115071363562773 `" ) && sleep 0'
<target ip> PUT /tmp/tmpmo3UW4 TO /tmp/ansible-tmp-1487093318.99-115071363562773/expect.py
<target ip> EXEC /bin/sh -c 'setfacl -m u:removed-userinfo:rx /tmp/ansible-tmp-1487093318.99-115071363562773/ /tmp/ansible-tmp-1487093318.99-115071363562773/expect.py && sleep 0'
<target ip> EXEC /bin/sh -c 'sudo -H -S -n -u removed-userinfo /bin/sh -c '"'"'echo BECOME-SUCCESS-naybhwekalujahnhjhhfzdogadztqeeb; /usr/bin/python /tmp/ansible-tmp-1487093318.99-115071363562773/expect.py'"'"' && sleep 0'
<target ip> EXEC /bin/sh -c 'rm -f -r /tmp/ansible-tmp-1487093318.99-115071363562773/ > /dev/null 2>&1 && sleep 0'
fatal: [target ip]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "chdir": null,
            "command": "removed",
            "creates": null,
            "echo": true,
            "removes": null,
            "responses": {
                "Question": [
                    "removed",
                    "removed"
                ]
            },
            "timeout": 15
        },
        "module_name": "expect"
    },
    "msg": "The pexpect python module is required"
<!--- Paste verbatim command output between quotes below -->
@sivel
Copy link
Member

sivel commented Feb 14, 2017

pexpect must be installed on the remote host that you are managing. In your output, that host is identified by 135.69.202.198

If you have further questions please stop by IRC or the mailing list:

@sivel sivel closed this as completed Feb 14, 2017
@ansibot ansibot added affects_2.2 This issue/PR affects Ansible v2.2 bug_report module This issue/PR relates to a module. labels Feb 14, 2017
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. module This issue/PR relates to a module.
Projects
None yet
Development

No branches or pull requests

3 participants