According to
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/expect_module.html#requirements
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 <[email protected]> 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'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
> [email protected]
>
>
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/YTXPR0101MB1295535E3E9D9BECFAC55C52D8A00%40YTXPR0101MB1295.CANPRD01.PROD.OUTLOOK.COM
> <https://groups.google.com/d/msgid/ansible-project/YTXPR0101MB1295535E3E9D9BECFAC55C52D8A00%40YTXPR0101MB1295.CANPRD01.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>
> .
>
-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOAPV_b99C5%3DPdujbxVndC%3DbgQC9bLREKybRzy9Z7ancw%40mail.gmail.com.

Reply via email to