I am very new to ansible and I am trying to run a playbook to change root password of hosts so I am using the expect command of pexpect module. I successfully managed to install pexpect v4.7 with python 2.7 on the hosts and on the local server running the playbook. However when the playbook is being run, it fails with error: "The pexpect python module is required"

According to the requirements, pexpect and python are of the correct version

Files installed on hosts for pexpect and python: 

The playbook is as follows:

- hosts: all
  become: true

    - name: change password for root user
        command: passwd root
           (?i)password: "password"

Am I doing something wrong? Please help!

1 Answers

Omar Hesham On Best Solutions

I managed to fix the issue by removing pexpect from all hosts then installing epel-release, pip and pexpect packages accordingly.