When I use ansible module expect, I get this msg: The pexpect python module is required












1














Some code from yml file:



- name: --- run /opt/installer/bin/install.sh ---
expect:
command: /opt/installer/bin/install.sh
responses:
'Are you installing the application at the central data center? [yes/no default: yes]? [yes]': "n"
'What is the code of central data center [default: 01]? [01]': "n"
'What is ip or hostname of your server [default: localhost]? [localhost]': 'portal'


and I installed pexpect 3.3 modules on both servers (ansible and target machines).



[root@portal pexpect-3.3]# python setup.py install
running install
running build
running build_py
running install_lib
running install_egg_info
Removing /usr/lib/python2.7/site-packages/pexpect-3.3-py2.7.egg-info
Writing /usr/lib/python2.7/site-packages/pexpect-3.3-py2.7.egg-info


when I run playbook I get this error :



TASK [ansible-portal : --- run /opt/installer/bin/install.sh ---] *************************************************************************
fatal: [portal]: FAILED! => {"changed": false, "msg": "The pexpect python module is required"}


More information :



[root@ansible ansible]# ansible --version
ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]









share|improve this question





























    1














    Some code from yml file:



    - name: --- run /opt/installer/bin/install.sh ---
    expect:
    command: /opt/installer/bin/install.sh
    responses:
    'Are you installing the application at the central data center? [yes/no default: yes]? [yes]': "n"
    'What is the code of central data center [default: 01]? [01]': "n"
    'What is ip or hostname of your server [default: localhost]? [localhost]': 'portal'


    and I installed pexpect 3.3 modules on both servers (ansible and target machines).



    [root@portal pexpect-3.3]# python setup.py install
    running install
    running build
    running build_py
    running install_lib
    running install_egg_info
    Removing /usr/lib/python2.7/site-packages/pexpect-3.3-py2.7.egg-info
    Writing /usr/lib/python2.7/site-packages/pexpect-3.3-py2.7.egg-info


    when I run playbook I get this error :



    TASK [ansible-portal : --- run /opt/installer/bin/install.sh ---] *************************************************************************
    fatal: [portal]: FAILED! => {"changed": false, "msg": "The pexpect python module is required"}


    More information :



    [root@ansible ansible]# ansible --version
    ansible 2.4.2.0
    config file = /etc/ansible/ansible.cfg
    configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
    ansible python module location = /usr/lib/python2.7/site-packages/ansible
    executable location = /usr/bin/ansible
    python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]









    share|improve this question



























      1












      1








      1







      Some code from yml file:



      - name: --- run /opt/installer/bin/install.sh ---
      expect:
      command: /opt/installer/bin/install.sh
      responses:
      'Are you installing the application at the central data center? [yes/no default: yes]? [yes]': "n"
      'What is the code of central data center [default: 01]? [01]': "n"
      'What is ip or hostname of your server [default: localhost]? [localhost]': 'portal'


      and I installed pexpect 3.3 modules on both servers (ansible and target machines).



      [root@portal pexpect-3.3]# python setup.py install
      running install
      running build
      running build_py
      running install_lib
      running install_egg_info
      Removing /usr/lib/python2.7/site-packages/pexpect-3.3-py2.7.egg-info
      Writing /usr/lib/python2.7/site-packages/pexpect-3.3-py2.7.egg-info


      when I run playbook I get this error :



      TASK [ansible-portal : --- run /opt/installer/bin/install.sh ---] *************************************************************************
      fatal: [portal]: FAILED! => {"changed": false, "msg": "The pexpect python module is required"}


      More information :



      [root@ansible ansible]# ansible --version
      ansible 2.4.2.0
      config file = /etc/ansible/ansible.cfg
      configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python2.7/site-packages/ansible
      executable location = /usr/bin/ansible
      python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]









      share|improve this question















      Some code from yml file:



      - name: --- run /opt/installer/bin/install.sh ---
      expect:
      command: /opt/installer/bin/install.sh
      responses:
      'Are you installing the application at the central data center? [yes/no default: yes]? [yes]': "n"
      'What is the code of central data center [default: 01]? [01]': "n"
      'What is ip or hostname of your server [default: localhost]? [localhost]': 'portal'


      and I installed pexpect 3.3 modules on both servers (ansible and target machines).



      [root@portal pexpect-3.3]# python setup.py install
      running install
      running build
      running build_py
      running install_lib
      running install_egg_info
      Removing /usr/lib/python2.7/site-packages/pexpect-3.3-py2.7.egg-info
      Writing /usr/lib/python2.7/site-packages/pexpect-3.3-py2.7.egg-info


      when I run playbook I get this error :



      TASK [ansible-portal : --- run /opt/installer/bin/install.sh ---] *************************************************************************
      fatal: [portal]: FAILED! => {"changed": false, "msg": "The pexpect python module is required"}


      More information :



      [root@ansible ansible]# ansible --version
      ansible 2.4.2.0
      config file = /etc/ansible/ansible.cfg
      configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python2.7/site-packages/ansible
      executable location = /usr/bin/ansible
      python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]






      debian python ansible python3






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 9 at 20:06









      Rui F Ribeiro

      39k1479129




      39k1479129










      asked Jul 6 at 13:41









      pyramid13

      115315




      115315






















          1 Answer
          1






          active

          oldest

          votes


















          0














          As is typical with some of the modules in ansible you have to install certain Python modules on the remote server's side.




          • https://github.com/ansible/ansible/issues/21416


          You can use the pip module to facilitate this through your ansible playbook like so:



          - name install pexpect
          pip:
          name: pexpect
          become: yes


          Your distro may have these available as DEB or RPM files as well. If so you might want to install this Python module using the distro's package manager instead.



          In your case it's likely that the Python you installed the pexpect module into is not the same one that ansible is using. In this case I'd use the system's package manager to install pexpect.



          via package managers



          on Debian/Ubuntu systems the DEB is:



          $ sudo apt-get install python-pexpect


          On Redhat distros (Fedora/CentOS):



          $ sudo yum install -y pexpect


          References




          • https://docs.ansible.com/ansible/latest/modules/pip_module.html

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






          share|improve this answer























          • @RuiFRibeiro - thanks & done.
            – slm
            Jul 6 at 16:28











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f453859%2fwhen-i-use-ansible-module-expect-i-get-this-msg-the-pexpect-python-module-is-r%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          As is typical with some of the modules in ansible you have to install certain Python modules on the remote server's side.




          • https://github.com/ansible/ansible/issues/21416


          You can use the pip module to facilitate this through your ansible playbook like so:



          - name install pexpect
          pip:
          name: pexpect
          become: yes


          Your distro may have these available as DEB or RPM files as well. If so you might want to install this Python module using the distro's package manager instead.



          In your case it's likely that the Python you installed the pexpect module into is not the same one that ansible is using. In this case I'd use the system's package manager to install pexpect.



          via package managers



          on Debian/Ubuntu systems the DEB is:



          $ sudo apt-get install python-pexpect


          On Redhat distros (Fedora/CentOS):



          $ sudo yum install -y pexpect


          References




          • https://docs.ansible.com/ansible/latest/modules/pip_module.html

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






          share|improve this answer























          • @RuiFRibeiro - thanks & done.
            – slm
            Jul 6 at 16:28
















          0














          As is typical with some of the modules in ansible you have to install certain Python modules on the remote server's side.




          • https://github.com/ansible/ansible/issues/21416


          You can use the pip module to facilitate this through your ansible playbook like so:



          - name install pexpect
          pip:
          name: pexpect
          become: yes


          Your distro may have these available as DEB or RPM files as well. If so you might want to install this Python module using the distro's package manager instead.



          In your case it's likely that the Python you installed the pexpect module into is not the same one that ansible is using. In this case I'd use the system's package manager to install pexpect.



          via package managers



          on Debian/Ubuntu systems the DEB is:



          $ sudo apt-get install python-pexpect


          On Redhat distros (Fedora/CentOS):



          $ sudo yum install -y pexpect


          References




          • https://docs.ansible.com/ansible/latest/modules/pip_module.html

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






          share|improve this answer























          • @RuiFRibeiro - thanks & done.
            – slm
            Jul 6 at 16:28














          0












          0








          0






          As is typical with some of the modules in ansible you have to install certain Python modules on the remote server's side.




          • https://github.com/ansible/ansible/issues/21416


          You can use the pip module to facilitate this through your ansible playbook like so:



          - name install pexpect
          pip:
          name: pexpect
          become: yes


          Your distro may have these available as DEB or RPM files as well. If so you might want to install this Python module using the distro's package manager instead.



          In your case it's likely that the Python you installed the pexpect module into is not the same one that ansible is using. In this case I'd use the system's package manager to install pexpect.



          via package managers



          on Debian/Ubuntu systems the DEB is:



          $ sudo apt-get install python-pexpect


          On Redhat distros (Fedora/CentOS):



          $ sudo yum install -y pexpect


          References




          • https://docs.ansible.com/ansible/latest/modules/pip_module.html

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






          share|improve this answer














          As is typical with some of the modules in ansible you have to install certain Python modules on the remote server's side.




          • https://github.com/ansible/ansible/issues/21416


          You can use the pip module to facilitate this through your ansible playbook like so:



          - name install pexpect
          pip:
          name: pexpect
          become: yes


          Your distro may have these available as DEB or RPM files as well. If so you might want to install this Python module using the distro's package manager instead.



          In your case it's likely that the Python you installed the pexpect module into is not the same one that ansible is using. In this case I'd use the system's package manager to install pexpect.



          via package managers



          on Debian/Ubuntu systems the DEB is:



          $ sudo apt-get install python-pexpect


          On Redhat distros (Fedora/CentOS):



          $ sudo yum install -y pexpect


          References




          • https://docs.ansible.com/ansible/latest/modules/pip_module.html

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







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 6 at 16:28

























          answered Jul 6 at 14:27









          slm

          247k66510676




          247k66510676












          • @RuiFRibeiro - thanks & done.
            – slm
            Jul 6 at 16:28


















          • @RuiFRibeiro - thanks & done.
            – slm
            Jul 6 at 16:28
















          @RuiFRibeiro - thanks & done.
          – slm
          Jul 6 at 16:28




          @RuiFRibeiro - thanks & done.
          – slm
          Jul 6 at 16:28


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f453859%2fwhen-i-use-ansible-module-expect-i-get-this-msg-the-pexpect-python-module-is-r%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Morgemoulin

          Scott Moir

          Souastre