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.


[cid:[email protected]]

- 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]<mailto:[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.

Reply via email to