Hello,
I’ve been researching this for a while now. I’m convinced the solution must be easy to find and feel pretty dumb, but I’d appreciate some input from the community here.
I’m trying to use the pexpect module with ansible on redhat 6.
When I execute my ansible .yml, I get the following error: “The pexpect python module is required”
pexpect is installed on the machine that runs ansible. So, I assume I need to have it installed on the host that I’m reaching with ansible.
When I have it installed on the host, my error then becomes this: Insufficient version of pexpect installed (2.3), this module requires pexpect>=3.3. Error was ‘module’ object has no attribute ‘runu’
This is where my nightmare starts…
I have tried looking for different versions of pexpect, but got nothing. Online, I have found that I actually needed to update python. I have then managed to install rh-python34, but I still get the same error in ansible when I’m trying to use pexpect. I have tried updating expect with yum and pip, but it does not find anything.
Since the installation of rh-python34 does not replace the other one (python 2.6.6), I wonder if ansible sees rh-python34 on the host.
Basically, I’d like to get pexpect to work with ansible on hosts that run with redhat 6 redhat 7. Can anyone give me a walkthrough of how to get it to work?
Here are the versions on my ansible machine:
$ ansible --version
ansible 2.2.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = [‘/usr/share/ansible’]
$ python -V
Python 2.7.8
$ rpm -qa | grep -i pexpect
pexpect-2.3-6.el6.noarch
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)
Here are the versions on the remote host:
python -V
Python 2.6.6
scl enable rh-python34 bash
python -V
Python 3.4.2
rpm -qa | grep -i pexpect
pexpect-2.3-6.el6.noarch
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.9 (Santiago)
Thank you.
Thierry.