setup module fails sometimes

212 views
Skip to first unread message

Todd Sampson

unread,
May 9, 2019, 4:47:55 PM5/9/19
to Ansible Project
When I run a playbook, sometimes a target gets in a mode where the setup module fails. Other times it runs just fine.  Can anyone give me any ideas of what might be going on?  Kindof looks like: https://github.com/ansible/ansible/issues/48859
If I run with
ansible all -m setup --limit sundowner
it always seems to work.

Here is the first part of my playbook:

---


- name: Boot into desired OS
  hosts
: sundowner
  become
: yes


  vars_files
:
   
- ../vars/sudo-passwd.yml
  vars
:
    ip
: "{{ ansible_default_ipv4.address|default(ansible_all_ipv4_addresses[0]) }}/24"


  tasks
:


 
- name: OS currently running
    debug
:
      msg
: "Running OS version {{ ansible_distribution_version }}, host name: {{ ansible_hostname }}"

 
- name: Boot to this OS
    debug
:
      msg
: '{{ target_os }} at IP address: {{ ip }}'
on
and on

/etc/ansible/hosts:

[all:vars]
ansible_become_pass
='{{ sudo_password }}'


[rescue]
10.10.0.71


[sundowner]
10.10.0.71
#[sundowner:vars]
#ansible_become_pass='{{ sudo_password }}'


[golden]
10.10.0.138



Result:
dfr@manager:~/m9kdeploy/playbooks$ ansible-playbook -e 'target_os=rescue' bootTo.yml -vvv
ansible
-playbook 2.7.10
  config file
= /home/dfr/m9kdeploy/playbooks/ansible.cfg
  configured
module search path = [u'/home/dfr/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python
module location = /usr/lib/python2.7/dist-packages/ansible
  executable location
= /usr/bin/ansible-playbook
  python version
= 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
Using /home/dfr/m9kdeploy/playbooks/ansible.cfg as config file
/etc/ansible/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
/etc/ansible/hosts did not meet script requirements, check plugin documentation if this is unexpected
Parsed /etc/ansible/hosts inventory source with ini plugin


PLAYBOOK
: bootTo.yml **************************************************************************
1 plays in bootTo.yml
Read vars_file '../vars/sudo-passwd.yml'
Read vars_file '../vars/sudo-passwd.yml'
Read vars_file '../vars/sudo-passwd.yml'


PLAY
[Boot into desired OS] *******************************************************************
Read vars_file '../vars/sudo-passwd.yml'


TASK
[Gathering Facts] ************************************************************************
task path
: /home/dfr/m9kdeploy/playbooks/bootTo.yml:3
<10.10.0.71> ESTABLISH SSH CONNECTION FOR USER: None
<10.10.0.71> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/dfr/.ansible/cp/eb2425b5ca 10.10.0.71 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<10.10.0.71> (0, '/home/dfr\n', '')
<10.10.0.71> ESTABLISH SSH CONNECTION FOR USER: None
<10.10.0.71> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/dfr/.ansible/cp/eb2425b5ca 10.10.0.71 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/dfr/.ansible/tmp/ansible-tmp-1557428290.31-204960750157810 `" && echo ansible-tmp-1557428290.31-204960750157810="` echo /home/dfr/.ansible/tmp/ansible-tmp-1557428290.31-204960750157810 `" ) && sleep 0'"'"''
<10.10.0.71> (0, 'ansible-tmp-1557428290.31-204960750157810=/home/dfr/.ansible/tmp/ansible-tmp-1557428290.31-204960750157810\n', '')
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py
<10.10.0.71> PUT /home/dfr/.ansible/tmp/ansible-local-3205q7qNeH/tmpwTtN7y TO /home/dfr/.ansible/tmp/ansible-tmp-1557428290.31-204960750157810/AnsiballZ_setup.py
<10.10.0.71> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/dfr/.ansible/cp/eb2425b5ca '[10.10.0.71]'
<10.10.0.71> (0, 'sftp> put /home/dfr/.ansible/tmp/ansible-local-3205q7qNeH/tmpwTtN7y /home/dfr/.ansible/tmp/ansible-tmp-1557428290.31-204960750157810/AnsiballZ_setup.py\n', '')
<10.10.0.71> ESTABLISH SSH CONNECTION FOR USER: None
<10.10.0.71> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/dfr/.ansible/cp/eb2425b5ca 10.10.0.71 '/bin/sh -c '"'"'chmod u+x /home/dfr/.ansible/tmp/ansible-tmp-1557428290.31-204960750157810/ /home/dfr/.ansible/tmp/ansible-tmp-1557428290.31-204960750157810/AnsiballZ_setup.py && sleep 0'"'"''
<10.10.0.71> (0, '', '')
<10.10.0.71> ESTABLISH SSH CONNECTION FOR USER: None
<10.10.0.71> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/dfr/.ansible/cp/eb2425b5ca -tt 10.10.0.71 '/bin/sh -c '"'"'sudo -H -S  -p "[sudo via ansible, key=vxwrfflmyvohykccsjallhibegfowdbm] password: " -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-vxwrfflmyvohykccsjallhibegfowdbm; /usr/bin/python /home/dfr/.ansible/tmp/ansible-tmp-1557428290.31-204960750157810/AnsiballZ_setup.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
Escalation succeeded
<10.10.0.71> (0, '\r\n\r\n{"invocation": {"module_args": {"filter": "*", "gather_subset": ["all"], "fact_path": "/etc/ansible/facts.d", "gather_timeout": 10}}, "ansible_facts": {"module_setup": true, "ansible_distribution_version": "12.04", "ansible_distribution_file_variety":

[Lots of content removed]


"ansible_user_uid": 0, "ansible_ssh_host_key_dsa_public": "AAAAB3NzaC1kc3MAAACBAJNcb0B/SAhL3JnKlZQ0zWEb72fONSknA60Wa2pWUQbZ7W/0eINzFfGS3aOmmiS6BaG+1qgzlqSGKR1eX3HUcORDoXCAyU8nYi3+cCbxIn6JO+GdmoYQF7udvbuwkwYewvSw1CkZpHfT1D20wVNmlkRgB4dUT7tJ3c9LoxqohMABAAAAFQDeQl1kQbyjhl6yTP6ukn6vaMj6fQAAAIEAhe4v0iMKr9fH/r16Wsq5lozswysCsxeAnQfsnZpyo1zA5XzfnYISIbd9GKQIc8LrCD3SWLdRm06pwzoF26QN0VxHsy4LpBPRqGdlBDCDxF1PlU67IwRuu070PBemrwMXgpiUYNC6wUWBWnstyQQ/IhJ9MC/HX+oWmAK2k8XVWn8AAACARFENZclaIgDayO9viajnOWvB++DEFk6I6A5SgjC1nINop5JV4CUT03gaABp2wjY1IX6szFViAcJidGgtymN70qVSHrv2wwtH8k1kFC39LkVB5rzgLGFmV97XqISVmvbV/8Tmt+FdpH6hL3/MZ7BNu0YLL1QdE2clkpDqe6fskiY=", "ansible_bios_date": "10/22/2014", "ansible_system_capabilities": []}}\r\n: RuntimeError(\'cannot join current thread\',) in <Finalize object, dead> ignored\r\n'
, 'Shared connection to 10.10.0.71 closed.\r\n')
 
[WARNING]: Module invocation had junk after the JSON data: : RuntimeError('cannot join
current thread'
,) in <Finalize object, dead> ignored

<10.10.0.71> ESTABLISH SSH CONNECTION FOR USER: None
<10.10.0.71> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/dfr/.ansible/cp/eb2425b5ca 10.10.0.71 '/bin/sh -c '"'"'rm -f -r /home/dfr/.ansible/tmp/ansible-tmp-1557428290.31-204960750157810/ > /dev/null 2>&1 && sleep 0'"'"''
<10.10.0.71> (0, '', '')
fatal
: [10.10.0.71]: FAILED! => {
   
"changed": false,
   
"module_stderr": "Shared connection to 10.10.0.71 closed.\r\n",
   
"module_stdout": "\r\n\r\n{\"invocation\": {\"module_args\": {\"filter\": \"*\", \"gather_subset\": [\"all\"], \"fact_path\": \"/etc/ansible/facts.d\", \"gather_timeout\": 10}}, \"ansible_facts\": {\"module_setup\": true, \"ansible_distribution_version\": \"12.04\", \"ansible_distribution_file_variety\": \"Debian\", \"ansible_env\": {\"USERNAME\": \"root\", \"LANG\": \"en_US.UTF-8\", \"SUDO_GID\": \"1000\",

[Lots of content removed]


\"ansible_user_uid\": 0, \"ansible_ssh_host_key_dsa_public\": \"AAAAB3NzaC1kc3MAAACBAJNcb0B/SAhL3JnKlZQ0zWEb72fONSknA60Wa2pWUQbZ7W/0eINzFfGS3aOmmiS6BaG+1qgzlqSGKR1eX3HUcORDoXCAyU8nYi3+cCbxIn6JO+GdmoYQF7udvbuwkwYewvSw1CkZpHfT1D20wVNmlkRgB4dUT7tJ3c9LoxqohMABAAAAFQDeQl1kQbyjhl6yTP6ukn6vaMj6fQAAAIEAhe4v0iMKr9fH/r16Wsq5lozswysCsxeAnQfsnZpyo1zA5XzfnYISIbd9GKQIc8LrCD3SWLdRm06pwzoF26QN0VxHsy4LpBPRqGdlBDCDxF1PlU67IwRuu070PBemrwMXgpiUYNC6wUWBWnstyQQ/IhJ9MC/HX+oWmAK2k8XVWn8AAACARFENZclaIgDayO9viajnOWvB++DEFk6I6A5SgjC1nINop5JV4CUT03gaABp2wjY1IX6szFViAcJidGgtymN70qVSHrv2wwtH8k1kFC39LkVB5rzgLGFmV97XqISVmvbV/8Tmt+FdpH6hL3/MZ7BNu0YLL1QdE2clkpDqe6fskiY=\", \"ansible_bios_date\": \"10/22/2014\", \"ansible_system_capabilities\": []}}\r\n: RuntimeError('cannot join current thread',) in <Finalize object, dead> ignored\r\n"
,
   
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
   
"rc": 0
}
        to
retry, use: --limit @/home/dfr/m9kdeploy/playbooks/bootTo.retry


PLAY RECAP
************************************************************************************
10.10.0.71                 : ok=0    changed=0    unreachable=0    failed=1





Todd Sampson

unread,
May 10, 2019, 10:09:35 AM5/10/19
to Ansible Project
Sorry. I actually run the playbook with:
ansible-playbook -'target_os=rescue' bootTo.yml -vvv

Reply all
Reply to author
Forward
0 new messages