Python pexpect issue

36 views
Skip to first unread message

Rene Paquin

unread,
Jan 22, 2021, 3:40:37 PM1/22/21
to ansible...@googlegroups.com

Running the playbook below to join a linux server to our AD domain.  The screenshot below displays the version of ansible.  The issue I am having is with the pexpect module.  I am getting the following error at the point when the task is to join the domain.   

 

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot import name 'use_native_pty_fork'

fatal: [10.10.87.200]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (pexpect) on qictanstest.wlu.ca's Python /usr/bin/python3.6. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}

 

The task of installing the pexpect module was successful.  Not sure where to go next.  I cannot find any information on that error.

 

 

 

- name: Join Domain

  hosts: xxxxxxxx

  gather_facts: false

  vars_files:

     - group_vars/ol8

 

  vars_prompt:

    - name: "bind_password"

      prompt: "Password for "

      private: yes

 

  tasks:

    - name: install pexpect

      pip:

        name: pexpect

 

    - name: Install the required packages

      yum:

        name: realmd,sssd,oddjob,oddjob-mkhomedir,adcli,samba-common,samba-common-tools,samba-client,samba-winbind,samba-winbind-clients

        state: present

      notify:

        - restart realmd

 

    - name: Join system to AD

      expect:

        command: /bin/bash -c "/usr/sbin/realm join --user=xxxxxxxxxxx"

        responses:

          Password for *: "{{ bind_password }}"

 

    - name: Add default_domain_suffix to sssd.conf

      lineinfile:

        dest: /etc/sssd/sssd.conf

        line: 'default_domain_suffix = xxxxxxxxx

        insertafter: '^\[sssd\]'

 

    - name: Allow the LinuxAdmins AD group to logon to the system

      command: /bin/bash -c "/usr/sbin/realm permit -g xxxxxxxx"

 

    - name: Add the LinuxAdmins AD Group to sudoers

      lineinfile:

        dest: /etc/sudoers

        line: '%xxxxxxxxca        ALL=(ALL)       ALL'

        insertafter: '^%wheel'   

   

  handlers:

    - name: restart realmd

      service:

       name: realmd

        state: restarted

 

    - name: restart sssd

      service:

        name: sssd

        state: restarted

 

...       

 

********************************
Rene Paquin - Systems Administrator
Wilfrid Laurier University
Waterloo, Ontario
(519)884-0710 x3795
rpa...@wlu.ca

 

Dick Visser

unread,
Jan 23, 2021, 1:25:39 AM1/23/21
to ansible...@googlegroups.com
According to 
To be fair it's not immediately obvious what that is, but since you have the module on one end, it must mean that it is required on the other end (the host you're managing).

So install that prior to the pexpect task.

--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/YTXPR0101MB1295535E3E9D9BECFAC55C52D8A00%40YTXPR0101MB1295.CANPRD01.PROD.OUTLOOK.COM.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Rene Paquin

unread,
Jan 25, 2021, 9:34:28 AM1/25/21
to ansible...@googlegroups.com

Thanks for the response but I do have pexpect3 installed on both the ansible server as well as the server I am managing. 

 

Rene

Stefan Hornburg (Racke)

unread,
Jan 25, 2021, 9:53:16 AM1/25/21
to ansible...@googlegroups.com
On 1/25/21 3:34 PM, Rene Paquin wrote:
> Thanks for the response but I do have pexpect3 installed on both the ansible server as well as the server I am managing. 
>
>  
>
> Rene

The question is if you installed pexpect into your Python3 instance. If you have also a Python2 instance on the target
server, ansible pip module might have installed it there.

Regards
Racke

>
>  
>
> *From:*ansible...@googlegroups.com <ansible...@googlegroups.com> *On Behalf Of *Dick Visser
> *Sent:* January 23, 2021 1:25 AM
> *To:* ansible...@googlegroups.com
> *Subject:* Re: [ansible-project] Python pexpect issue
>
>  
>
> According to 
>
> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/expect_module.html#requirements
> <https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.ansible.com%2Fansible%2Flatest%2Fcollections%2Fansible%2Fbuiltin%2Fexpect_module.html%23requirements&data=04%7C01%7Crpaquin%40wlu.ca%7Ceb5f86c742294ab4904908d8bf67b0c1%7Cb45a5125b29846bc8b89ea5a7343fde8%7C1%7C0%7C637469799368471658%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PfWQThmqt2MmnoH7u3p0hXMYy4hYuPyPpxvgyT%2BKsmg%3D&reserved=0>
> the module needs to be available on the host that executes it. 
>
> To be fair it's not immediately obvious what that is, but since you have the module on one end, it must mean that it is
> required on the other end (the host you're managing).
>
>  
>
> So install that prior to the pexpect task.
>
>  
>
> On Fri, 22 Jan 2021 at 21:40, Rene Paquin <rpa...@wlu.ca <mailto:rpa...@wlu.ca>> wrote:
>
> Running the playbook below to join a linux server to our AD domain.  The screenshot below displays the version of
> ansible.  The issue I am having is with the pexpect module.  I am getting the following error at the point when the
> task is to join the domain.   
>
>  
>
> An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot
> import name 'use_native_pty_fork'
>
> fatal: [10.10.87.200]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (pexpect)
> on qictanstest.wlu.ca <http://qictanstest.wlu.ca/>'s Python /usr/bin/python3.6. Please read module documentation and
> install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python
> interpreter, please consult the documentation on ansible_python_interpreter"}
>
>  
>
> The task of installing the pexpect module was successful.  Not sure where to go next.  I cannot find any information
> on that error.
>
>  
>
>  
>
>  
>
> rpa...@wlu.ca <mailto:rpa...@wlu.ca>
>
>  
>
> --
> 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
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> <https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FYTXPR0101MB1295535E3E9D9BECFAC55C52D8A00%2540YTXPR0101MB1295.CANPRD01.PROD.OUTLOOK.COM%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7Crpaquin%40wlu.ca%7Ceb5f86c742294ab4904908d8bf67b0c1%7Cb45a5125b29846bc8b89ea5a7343fde8%7C1%7C0%7C637469799368481649%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kflHf3S0J%2BL4Oj2tYNKct0f8mkwiJJVvoC8fbhHjTnE%3D&reserved=0>.
>
> --
>
> Sent from a mobile device - please excuse the brevity, spelling and punctuation.
>
> --
> 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
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwOAPV_b99C5%3DPdujbxVndC%3DbgQC9bLREKybRzy9Z7ancw%40mail.gmail.com
> <https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FCAL8fbwOAPV_b99C5%253DPdujbxVndC%253DbgQC9bLREKybRzy9Z7ancw%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7Crpaquin%40wlu.ca%7Ceb5f86c742294ab4904908d8bf67b0c1%7Cb45a5125b29846bc8b89ea5a7343fde8%7C1%7C0%7C637469799368481649%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0RvlhPPRkLjCA%2BmF51dIEo8NDMnP47ZNkJksQ%2Bh%2B%2B98%3D&reserved=0>.
>
> --
> 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
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/YTXPR0101MB1295D0C50A24B5A5A9E2BB41D8BD0%40YTXPR0101MB1295.CANPRD01.PROD.OUTLOOK.COM
> <https://groups.google.com/d/msgid/ansible-project/YTXPR0101MB1295D0C50A24B5A5A9E2BB41D8BD0%40YTXPR0101MB1295.CANPRD01.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

OpenPGP_signature
Reply all
Reply to author
Forward
0 new messages