У меня есть задача, которая использует collect_facts для размещения CentoOS. Когда я использую свой playbook с этой задачей в AWX, я получаю эту ошибку:
fatal: [192.168.103.105]: FAILED! => {
"ansible_facts": {},
"changed": false,
"msg": "The following modules failed to execute: setup\n setup: MODULE FAILURE\nSee stdout/stderr for the exact error\n"
}
Я использую последнюю версию AWX, установленную с докером, использующим Ansible. Каждый в хосте CentOS.
Python 2.7
Playbook отлично работает, когда я использую его в оболочке с ansible-playbook.
Моя задача:
- name: Switchover MySQL
hosts:
- mysql_from
remote_user: "{{ mysql_host_user }}"
become: yes
become_method: sudo
gather_facts: yes
roles:
- mysql_replication
Ошибка с многословным:
ansible-playbook 2.8.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/var/lib/awx/.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-playbook
python version = 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
Using /etc/ansible/ansible.cfg as config file
SSH password:
setting up inventory plugins
host_list declined parsing /tmp/awx_79_mkyh_1of/tmpx1ihxzae as it did not pass it's verify_file() method
Parsed /tmp/awx_79_mkyh_1of/tmpx1ihxzae inventory source with script plugin
statically imported: /var/lib/awx/projects/_13__mysql_switchover_master_slave/roles/mysql_replication/tasks/mysql_prepare_switchover.yml
statically imported: /var/lib/awx/projects/_13__mysql_switchover_master_slave/roles/mysql_replication/tasks/mysql_dump.yml
statically imported: /var/lib/awx/projects/_13__mysql_switchover_master_slave/roles/mysql_replication/tasks/mysql_switchover_only.yml
statically imported: /var/lib/awx/projects/_13__mysql_switchover_master_slave/roles/mysql_replication/tasks/mysql_stop_slave.yml
statically imported: /var/lib/awx/projects/_13__mysql_switchover_master_slave/roles/mysql_replication/tasks/mysql_start_new_slave.yml
statically imported: /var/lib/awx/projects/_13__mysql_switchover_master_slave/roles/mysql_replication/tasks/mysql_recreate_replication.yml
statically imported: /var/lib/awx/projects/_13__mysql_switchover_master_slave/roles/mysql_replication/tasks/mysql_stop_slave.yml
statically imported: /var/lib/awx/projects/_13__mysql_switchover_master_slave/roles/mysql_replication/tasks/mysql_start_new_slave.yml
Loading callback plugin awx_display of type stdout, v2.0 from /var/lib/awx/venv/awx/lib/python3.6/site-packages/ansible_runner/callbacks/awx_display.pyc
PLAYBOOK: site.yml *************************************************************
Positional arguments: site.yml
ask_pass: True
diff: True
remote_user: raragao
become_method: sudo
inventory: (u'/tmp/awx_79_mkyh_1of/tmpx1ihxzae',)
forks: 5
tags: (u'all',)
extra_vars: (u'@/tmp/awx_79_mkyh_1of/env/extravars',)
verbosity: 4
connection: smart
timeout: 10
1 plays in site.yml
PLAY [Switchover MySQL] ********************************************************
TASK [Gathering Facts] *********************************************************
task path: /var/lib/awx/projects/_13__mysql_switchover_master_slave/site.yml:22
<192.168.103.105> ESTABLISH SSH CONNECTION FOR USER: raragao
<192.168.103.105> SSH: EXEC sshpass -d8 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="raragao"' -o ConnectTimeout=10 -o ControlPath=/tmp/awx_79_mkyh_1of/cp/2c02d608a6 192.168.103.105 '/bin/sh -c '"'"'echo ~raragao && sleep 0'"'"''
<192.168.103.105> (0, '/home/raragao\n', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket "/tmp/awx_79_mkyh_1of/cp/2c02d608a6" does not exist\r\ndebug2: resolving "192.168.103.105" port 22\r\ndebug2: ssh_connect_direct: needpriv 0\r\ndebug1: Connecting to 192.168.103.105 [192.168.103.105] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: fd 3 clearing O_NONBLOCK\r\ndebug1: Connection established.\r\ndebug3: timeout: 9999 ms remain after connect\r\ndebug1: permanently_set_uid: 0/0\r\ndebug1: key_load_public: No such file or directory\r\ndebug1: identity file /root/.ssh/id_rsa type -1\r\ndebug1: key_load_public: No such file or directory\r\ndebug1: identity file /root/.ssh/id_rsa-cert type -1\r\ndebug1: key_load_public: No such file or directory\r\ndebug1: identity file /root/.ssh/id_dsa type -1\r\ndebug1: key_…
<192.168.103.105> ESTABLISH SSH CONNECTION FOR USER: raragao
<192.168.103.105> SSH: EXEC sshpass -d8 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="raragao"' -o ConnectTimeout=10 -o ControlPath=/tmp/awx_79_mkyh_1of/cp/2c02d608a6 192.168.103.105 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/raragao/.ansible/tmp/ansible-tmp-1562291834.0-207669038118275 `" && echo ansible-tmp-1562291834.0-207669038118275="` echo /home/raragao/.ansible/tmp/ansible-tmp-1562291834.0-207669038118275 `" ) && sleep 0'"'"''
<192.168.103.105> (0, 'ansible-tmp-1562291834.0-207669038118275=/home/raragao/.ansible/tmp/ansible-tmp-1562291834.0-207669038118275\n', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 7694\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<192.168.103.105> Attempting python interpreter discovery
<192.168.103.105> ESTABLISH SSH CONNECTION FOR USER: raragao
<192.168.103.105> SSH: EXEC sshpass -d8 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="raragao"' -o ConnectTimeout=10 -o ControlPath=/tmp/awx_79_mkyh_1of/cp/2c02d608a6 192.168.103.105 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<192.168.103.105> (0, 'PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/bin/python2.7\n/usr/libexec/platform-python\n/usr/bin/python\nENDFOUND\n', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 7694\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<192.168.103.105> ESTABLISH SSH CONNECTION FOR USER: raragao
<192.168.103.105> SSH: EXEC sshpass -d8 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="raragao"' -o ConnectTimeout=10 -o ControlPath=/tmp/awx_79_mkyh_1of/cp/2c02d608a6 192.168.103.105 '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<192.168.103.105> (0, '{"osrelease_content": "NAME=\\"CentOS Linux\\"\\nVERSION=\\"7 (Core)\\"\\nID=\\"centos\\"\\nID_LIKE=\\"rhel fedora\\"\\nVERSION_ID=\\"7\\"\\nPRETTY_NAME=\\"CentOS Linux 7 (Core)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:centos:centos:7\\"\\nHOME_URL=\\"https://www.centos.org/\\"\\nBUG_REPORT_URL=\\"https://bugs.centos.org/\\"\\n\\nCENTOS_MANTISBT_PROJECT=\\"CentOS-7\\"\\nCENTOS_MANTISBT_PROJECT_VERSION=\\"7\\"\\nREDHAT_SUPPORT_PRODUCT=\\"centos\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"7\\"\\n\\n", "platform_dist_result": ["centos", "7.6.1810", "Core"]}\n', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\n…
Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
<192.168.103.105> PUT /var/lib/awx/.ansible/tmp/ansible-local-76767UBHNw/tmprVYEXW TO /home/raragao/.ansible/tmp/ansible-tmp-1562291834.0-207669038118275/AnsiballZ_setup.py
<192.168.103.105> SSH: EXEC sshpass -d8 sftp -o BatchMode=no -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="raragao"' -o ConnectTimeout=10 -o ControlPath=/tmp/awx_79_mkyh_1of/cp/2c02d608a6 '[192.168.103.105]'
<192.168.103.105> (0, 'sftp> put /var/lib/awx/.ansible/tmp/ansible-local-76767UBHNw/tmprVYEXW /home/raragao/.ansible/tmp/ansible-tmp-1562291834.0-207669038118275/AnsiballZ_setup.py\n', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 7694\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension "posix-rename@openssh.com" revision 1\r\ndebug2: Server supports extension "statvfs@openssh.com" revision 2\r\ndebug2: Serv…
<192.168.103.105> ESTABLISH SSH CONNECTION FOR USER: raragao
<192.168.103.105> SSH: EXEC sshpass -d8 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="raragao"' -o ConnectTimeout=10 -o ControlPath=/tmp/awx_79_mkyh_1of/cp/2c02d608a6 192.168.103.105 '/bin/sh -c '"'"'chmod u+x /home/raragao/.ansible/tmp/ansible-tmp-1562291834.0-207669038118275/ /home/raragao/.ansible/tmp/ansible-tmp-1562291834.0-207669038118275/AnsiballZ_setup.py && sleep 0'"'"''
<192.168.103.105> (0, '', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 7694\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<192.168.103.105> ESTABLISH SSH CONNECTION FOR USER: raragao
<192.168.103.105> SSH: EXEC sshpass -d8 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="raragao"' -o ConnectTimeout=10 -o ControlPath=/tmp/awx_79_mkyh_1of/cp/2c02d608a6 -tt 192.168.103.105 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-jwsxqggbtczmeacacjjimddxslimhhaz ; /usr/bin/python /home/raragao/.ansible/tmp/ansible-tmp-1562291834.0-207669038118275/AnsiballZ_setup.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
<192.168.103.105> (1, 'sudo: a password is required\r\n', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 7694\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to 192.168.103.105 closed.\r\n')
<192.168.103.105> Failed to connect to the host via ssh: OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 7694
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 1
Shared connection to 192.168.103.105 closed.
fatal: [192.168.103.105]: FAILED! => {
"ansible_facts": {},
"changed": false,
"msg": "The following modules failed to execute: setup\n setup: MODULE FAILURE\nSee stdout/stderr for the exact error\n"
}
PLAY RECAP *********************************************************************
192.168.103.105 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0