jenkins和ansible server之间的同一个剧本没有';行不通

jenkins和ansible server之间的同一个剧本没有';行不通,jenkins,ansible,Jenkins,Ansible,我试图用Jenkins作业管理我的Ansible服务器,我观察到两个相似操作的两个不同结果 这是我的剧本: cd /etc/ansible whoami; hostname; pwd ansible-playbook /etc/ansible/playbooks/test.yml --private-key /home/ansible/.ssh/id_rsa -u ansible -vvv root lpansmld1 /etc/ansible ansible-playbook 2.8.4

我试图用Jenkins作业管理我的Ansible服务器,我观察到两个相似操作的两个不同结果

这是我的剧本:

cd /etc/ansible
whoami; hostname; pwd
ansible-playbook /etc/ansible/playbooks/test.yml --private-key /home/ansible/.ssh/id_rsa -u ansible -vvv
root
lpansmld1
/etc/ansible

ansible-playbook 2.8.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible-playbook
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: test.yml **********************************************************************************************************************************************************************************************************************
1 plays in /etc/ansible/playbooks/test.yml

PLAY [lpdepmld2] ************************************************************************************************************************************************************************************************************************
META: ran handlers

TASK [shell] ****************************************************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/test.yml:6
Tuesday 29 December 2020  16:35:05 +0100 (0:00:00.111)       0:00:00.112 ******
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '/home/ansible\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057 `" && echo ansible-tmp-1609256105.11-16196748238057="` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057 `" ) && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, 'ansible-tmp-1609256105.11-16196748238057=/home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057\n', '')
<lpdepmld2> Attempting python interpreter discovery
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/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'"'"''
<lpdepmld2.uem.lan> (0, 'PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/bin/python2.7\n/usr/bin/python\nENDFOUND\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '{"osrelease_content": "NAME=\\"Red Hat Enterprise Linux Server\\"\\nVERSION=\\"7.5 (Maipo)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVARIANT=\\"Server\\"\\nVARIANT_ID=\\"server\\"\\nVERSION_ID=\\"7.5\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux Server 7.5 (Maipo)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:7.5:GA:server\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 7\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.5\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"7.5\\"\\n", "platform_dist_result": ["redhat", "7.5", "Maipo"]}\n', '')
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<lpdepmld2.uem.lan> PUT /root/.ansible/tmp/ansible-local-102513iMMnYg/tmpzX9hsf TO /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py
<lpdepmld2.uem.lan> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee '[lpdepmld2.uem.lan]'
<lpdepmld2.uem.lan> (0, 'sftp> put /root/.ansible/tmp/ansible-local-102513iMMnYg/tmpzX9hsf /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/ /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee -tt lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '\r\n{"changed": true, "end": "2020-12-29 16:35:06.054473", "stdout": "ansible\\nlpdepmld2\\n/home/ansible", "cmd": "whoami; hostname; pwd", "rc": 0, "start": "2020-12-29 16:35:06.047227", "stderr": "", "delta": "0:00:00.007246", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "whoami; hostname; pwd", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}}\r\n', 'Shared connection to lpdepmld2.uem.lan closed.\r\n')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/ > /dev/null 2>&1 && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
changed: [lpdepmld2] => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": true,
    "cmd": "whoami; hostname; pwd",
    "delta": "0:00:00.007246",
    "end": "2020-12-29 16:35:06.054473",
    "invocation": {
        "module_args": {
            "_raw_params": "whoami; hostname; pwd",
            "_uses_shell": true,
            "argv": null,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": true
        }
    },
    "rc": 0,
    "start": "2020-12-29 16:35:06.047227",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "ansible\nlpdepmld2\n/home/ansible",
    "stdout_lines": [
        "ansible",
        "lpdepmld2",
        "/home/ansible"
    ]
}

TASK [debug] ****************************************************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/test.yml:9
Tuesday 29 December 2020  16:35:06 +0100 (0:00:01.067)       0:00:01.179 ******
ok: [lpdepmld2] => {
    "msg": [
        "ansible",
        "lpdepmld2",
        "/home/ansible"
    ]
}
META: ran handlers
META: ran handlers

PLAY RECAP ******************************************************************************************************************************************************************************************************************************
lpdepmld2                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Tuesday 29 December 2020  16:35:06 +0100 (0:00:00.034)       0:00:01.214 ******
===============================================================================
shell ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1.07s
/etc/ansible/playbooks/test.yml:6 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
debug ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 0.04s
/etc/ansible/playbooks/test.yml:9 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
#!/bin/bash

cd /etc/ansible

whoami; hostname; pwd

ansible-playbook /etc/ansible/playbooks/test.yml --private-key /home/ansible/.ssh/id_rsa -u ansible -vvv
Started by user adminlocal
Running as SYSTEM
Building remotely on lpansmld1 in workspace /data/jenkins_agent/workspace/test/test
[test] $ /bin/bash /tmp/jenkins1557636937643197894.sh
root
lpansmld1
/etc/ansible
ansible-playbook 2.8.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details
Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: test.yml *************************************************************
1 plays in /etc/ansible/playbooks/test.yml

PLAY [lpdepmld2] ***************************************************************
META: ran handlers

TASK [shell] *******************************************************************
task path: /etc/ansible/playbooks/test.yml:6
Tuesday 29 December 2020  16:38:53 +0100 (0:00:00.106)       0:00:00.106 ****** 
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '/home/ansible\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394 `" && echo ansible-tmp-1609256333.17-248021594072394="` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394 `" ) && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, 'ansible-tmp-1609256333.17-248021594072394=/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394\n', '')
<lpdepmld2> Attempting python interpreter discovery
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/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'"'"''
<lpdepmld2.uem.lan> (0, 'PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/bin/python2.7\n/usr/bin/python\nENDFOUND\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '{"osrelease_content": "NAME=\\"Red Hat Enterprise Linux Server\\"\\nVERSION=\\"7.5 (Maipo)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVARIANT=\\"Server\\"\\nVARIANT_ID=\\"server\\"\\nVERSION_ID=\\"7.5\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux Server 7.5 (Maipo)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:7.5:GA:server\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 7\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.5\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"7.5\\"\\n", "platform_dist_result": ["redhat", "7.5", "Maipo"]}\n', '')
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<lpdepmld2.uem.lan> PUT /root/.ansible/tmp/ansible-local-105179U75Grh/tmp7Lwygf TO /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py
<lpdepmld2.uem.lan> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee '[lpdepmld2.uem.lan]'
<lpdepmld2.uem.lan> (0, 'sftp> put /root/.ansible/tmp/ansible-local-105179U75Grh/tmp7Lwygf /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/ /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee -tt lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (2, "/usr/bin/python: can't open file '/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py': [Errno 13] Permission denied\r\n", 'Shared connection to lpdepmld2.uem.lan closed.\r\n')
<lpdepmld2.uem.lan> Failed to connect to the host via ssh: Shared connection to lpdepmld2.uem.lan closed.
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/ > /dev/null 2>&1 && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
fatal: [lpdepmld2]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "module_stderr": "Shared connection to lpdepmld2.uem.lan closed.\r\n", 
    "module_stdout": "/usr/bin/python: can't open file '/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py': [Errno 13] Permission denied\r\n", 
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
    "rc": 2
}

PLAY RECAP *********************************************************************
lpdepmld2                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Tuesday 29 December 2020  16:38:54 +0100 (0:00:00.956)       0:00:01.063 ****** 
=============================================================================== 
shell ------------------------------------------------------------------- 0.96s
/etc/ansible/playbooks/test.yml:6 ---------------------------------------------
Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
Build step 'Execute shell' marked build as failure
Finished: FAILURE

在Ansible服务器上本地执行:

cd /etc/ansible
whoami; hostname; pwd
ansible-playbook /etc/ansible/playbooks/test.yml --private-key /home/ansible/.ssh/id_rsa -u ansible -vvv
root
lpansmld1
/etc/ansible

ansible-playbook 2.8.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible-playbook
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: test.yml **********************************************************************************************************************************************************************************************************************
1 plays in /etc/ansible/playbooks/test.yml

PLAY [lpdepmld2] ************************************************************************************************************************************************************************************************************************
META: ran handlers

TASK [shell] ****************************************************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/test.yml:6
Tuesday 29 December 2020  16:35:05 +0100 (0:00:00.111)       0:00:00.112 ******
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '/home/ansible\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057 `" && echo ansible-tmp-1609256105.11-16196748238057="` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057 `" ) && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, 'ansible-tmp-1609256105.11-16196748238057=/home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057\n', '')
<lpdepmld2> Attempting python interpreter discovery
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/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'"'"''
<lpdepmld2.uem.lan> (0, 'PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/bin/python2.7\n/usr/bin/python\nENDFOUND\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '{"osrelease_content": "NAME=\\"Red Hat Enterprise Linux Server\\"\\nVERSION=\\"7.5 (Maipo)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVARIANT=\\"Server\\"\\nVARIANT_ID=\\"server\\"\\nVERSION_ID=\\"7.5\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux Server 7.5 (Maipo)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:7.5:GA:server\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 7\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.5\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"7.5\\"\\n", "platform_dist_result": ["redhat", "7.5", "Maipo"]}\n', '')
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<lpdepmld2.uem.lan> PUT /root/.ansible/tmp/ansible-local-102513iMMnYg/tmpzX9hsf TO /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py
<lpdepmld2.uem.lan> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee '[lpdepmld2.uem.lan]'
<lpdepmld2.uem.lan> (0, 'sftp> put /root/.ansible/tmp/ansible-local-102513iMMnYg/tmpzX9hsf /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/ /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee -tt lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '\r\n{"changed": true, "end": "2020-12-29 16:35:06.054473", "stdout": "ansible\\nlpdepmld2\\n/home/ansible", "cmd": "whoami; hostname; pwd", "rc": 0, "start": "2020-12-29 16:35:06.047227", "stderr": "", "delta": "0:00:00.007246", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "whoami; hostname; pwd", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}}\r\n', 'Shared connection to lpdepmld2.uem.lan closed.\r\n')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/ > /dev/null 2>&1 && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
changed: [lpdepmld2] => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": true,
    "cmd": "whoami; hostname; pwd",
    "delta": "0:00:00.007246",
    "end": "2020-12-29 16:35:06.054473",
    "invocation": {
        "module_args": {
            "_raw_params": "whoami; hostname; pwd",
            "_uses_shell": true,
            "argv": null,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": true
        }
    },
    "rc": 0,
    "start": "2020-12-29 16:35:06.047227",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "ansible\nlpdepmld2\n/home/ansible",
    "stdout_lines": [
        "ansible",
        "lpdepmld2",
        "/home/ansible"
    ]
}

TASK [debug] ****************************************************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/test.yml:9
Tuesday 29 December 2020  16:35:06 +0100 (0:00:01.067)       0:00:01.179 ******
ok: [lpdepmld2] => {
    "msg": [
        "ansible",
        "lpdepmld2",
        "/home/ansible"
    ]
}
META: ran handlers
META: ran handlers

PLAY RECAP ******************************************************************************************************************************************************************************************************************************
lpdepmld2                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Tuesday 29 December 2020  16:35:06 +0100 (0:00:00.034)       0:00:01.214 ******
===============================================================================
shell ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1.07s
/etc/ansible/playbooks/test.yml:6 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
debug ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 0.04s
/etc/ansible/playbooks/test.yml:9 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
#!/bin/bash

cd /etc/ansible

whoami; hostname; pwd

ansible-playbook /etc/ansible/playbooks/test.yml --private-key /home/ansible/.ssh/id_rsa -u ansible -vvv
Started by user adminlocal
Running as SYSTEM
Building remotely on lpansmld1 in workspace /data/jenkins_agent/workspace/test/test
[test] $ /bin/bash /tmp/jenkins1557636937643197894.sh
root
lpansmld1
/etc/ansible
ansible-playbook 2.8.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details
Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: test.yml *************************************************************
1 plays in /etc/ansible/playbooks/test.yml

PLAY [lpdepmld2] ***************************************************************
META: ran handlers

TASK [shell] *******************************************************************
task path: /etc/ansible/playbooks/test.yml:6
Tuesday 29 December 2020  16:38:53 +0100 (0:00:00.106)       0:00:00.106 ****** 
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '/home/ansible\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394 `" && echo ansible-tmp-1609256333.17-248021594072394="` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394 `" ) && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, 'ansible-tmp-1609256333.17-248021594072394=/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394\n', '')
<lpdepmld2> Attempting python interpreter discovery
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/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'"'"''
<lpdepmld2.uem.lan> (0, 'PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/bin/python2.7\n/usr/bin/python\nENDFOUND\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '{"osrelease_content": "NAME=\\"Red Hat Enterprise Linux Server\\"\\nVERSION=\\"7.5 (Maipo)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVARIANT=\\"Server\\"\\nVARIANT_ID=\\"server\\"\\nVERSION_ID=\\"7.5\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux Server 7.5 (Maipo)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:7.5:GA:server\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 7\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.5\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"7.5\\"\\n", "platform_dist_result": ["redhat", "7.5", "Maipo"]}\n', '')
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<lpdepmld2.uem.lan> PUT /root/.ansible/tmp/ansible-local-105179U75Grh/tmp7Lwygf TO /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py
<lpdepmld2.uem.lan> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee '[lpdepmld2.uem.lan]'
<lpdepmld2.uem.lan> (0, 'sftp> put /root/.ansible/tmp/ansible-local-105179U75Grh/tmp7Lwygf /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/ /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee -tt lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (2, "/usr/bin/python: can't open file '/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py': [Errno 13] Permission denied\r\n", 'Shared connection to lpdepmld2.uem.lan closed.\r\n')
<lpdepmld2.uem.lan> Failed to connect to the host via ssh: Shared connection to lpdepmld2.uem.lan closed.
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/ > /dev/null 2>&1 && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
fatal: [lpdepmld2]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "module_stderr": "Shared connection to lpdepmld2.uem.lan closed.\r\n", 
    "module_stdout": "/usr/bin/python: can't open file '/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py': [Errno 13] Permission denied\r\n", 
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
    "rc": 2
}

PLAY RECAP *********************************************************************
lpdepmld2                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Tuesday 29 December 2020  16:38:54 +0100 (0:00:00.956)       0:00:01.063 ****** 
=============================================================================== 
shell ------------------------------------------------------------------- 0.96s
/etc/ansible/playbooks/test.yml:6 ---------------------------------------------
Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
Build step 'Execute shell' marked build as failure
Finished: FAILURE
并按预期工作,结果:

cd /etc/ansible
whoami; hostname; pwd
ansible-playbook /etc/ansible/playbooks/test.yml --private-key /home/ansible/.ssh/id_rsa -u ansible -vvv
root
lpansmld1
/etc/ansible

ansible-playbook 2.8.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible-playbook
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: test.yml **********************************************************************************************************************************************************************************************************************
1 plays in /etc/ansible/playbooks/test.yml

PLAY [lpdepmld2] ************************************************************************************************************************************************************************************************************************
META: ran handlers

TASK [shell] ****************************************************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/test.yml:6
Tuesday 29 December 2020  16:35:05 +0100 (0:00:00.111)       0:00:00.112 ******
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '/home/ansible\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057 `" && echo ansible-tmp-1609256105.11-16196748238057="` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057 `" ) && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, 'ansible-tmp-1609256105.11-16196748238057=/home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057\n', '')
<lpdepmld2> Attempting python interpreter discovery
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/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'"'"''
<lpdepmld2.uem.lan> (0, 'PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/bin/python2.7\n/usr/bin/python\nENDFOUND\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '{"osrelease_content": "NAME=\\"Red Hat Enterprise Linux Server\\"\\nVERSION=\\"7.5 (Maipo)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVARIANT=\\"Server\\"\\nVARIANT_ID=\\"server\\"\\nVERSION_ID=\\"7.5\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux Server 7.5 (Maipo)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:7.5:GA:server\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 7\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.5\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"7.5\\"\\n", "platform_dist_result": ["redhat", "7.5", "Maipo"]}\n', '')
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<lpdepmld2.uem.lan> PUT /root/.ansible/tmp/ansible-local-102513iMMnYg/tmpzX9hsf TO /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py
<lpdepmld2.uem.lan> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee '[lpdepmld2.uem.lan]'
<lpdepmld2.uem.lan> (0, 'sftp> put /root/.ansible/tmp/ansible-local-102513iMMnYg/tmpzX9hsf /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/ /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee -tt lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '\r\n{"changed": true, "end": "2020-12-29 16:35:06.054473", "stdout": "ansible\\nlpdepmld2\\n/home/ansible", "cmd": "whoami; hostname; pwd", "rc": 0, "start": "2020-12-29 16:35:06.047227", "stderr": "", "delta": "0:00:00.007246", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "whoami; hostname; pwd", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}}\r\n', 'Shared connection to lpdepmld2.uem.lan closed.\r\n')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/ > /dev/null 2>&1 && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
changed: [lpdepmld2] => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": true,
    "cmd": "whoami; hostname; pwd",
    "delta": "0:00:00.007246",
    "end": "2020-12-29 16:35:06.054473",
    "invocation": {
        "module_args": {
            "_raw_params": "whoami; hostname; pwd",
            "_uses_shell": true,
            "argv": null,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": true
        }
    },
    "rc": 0,
    "start": "2020-12-29 16:35:06.047227",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "ansible\nlpdepmld2\n/home/ansible",
    "stdout_lines": [
        "ansible",
        "lpdepmld2",
        "/home/ansible"
    ]
}

TASK [debug] ****************************************************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/test.yml:9
Tuesday 29 December 2020  16:35:06 +0100 (0:00:01.067)       0:00:01.179 ******
ok: [lpdepmld2] => {
    "msg": [
        "ansible",
        "lpdepmld2",
        "/home/ansible"
    ]
}
META: ran handlers
META: ran handlers

PLAY RECAP ******************************************************************************************************************************************************************************************************************************
lpdepmld2                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Tuesday 29 December 2020  16:35:06 +0100 (0:00:00.034)       0:00:01.214 ******
===============================================================================
shell ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1.07s
/etc/ansible/playbooks/test.yml:6 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
debug ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 0.04s
/etc/ansible/playbooks/test.yml:9 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
#!/bin/bash

cd /etc/ansible

whoami; hostname; pwd

ansible-playbook /etc/ansible/playbooks/test.yml --private-key /home/ansible/.ssh/id_rsa -u ansible -vvv
Started by user adminlocal
Running as SYSTEM
Building remotely on lpansmld1 in workspace /data/jenkins_agent/workspace/test/test
[test] $ /bin/bash /tmp/jenkins1557636937643197894.sh
root
lpansmld1
/etc/ansible
ansible-playbook 2.8.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details
Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: test.yml *************************************************************
1 plays in /etc/ansible/playbooks/test.yml

PLAY [lpdepmld2] ***************************************************************
META: ran handlers

TASK [shell] *******************************************************************
task path: /etc/ansible/playbooks/test.yml:6
Tuesday 29 December 2020  16:38:53 +0100 (0:00:00.106)       0:00:00.106 ****** 
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '/home/ansible\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394 `" && echo ansible-tmp-1609256333.17-248021594072394="` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394 `" ) && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, 'ansible-tmp-1609256333.17-248021594072394=/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394\n', '')
<lpdepmld2> Attempting python interpreter discovery
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/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'"'"''
<lpdepmld2.uem.lan> (0, 'PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/bin/python2.7\n/usr/bin/python\nENDFOUND\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '{"osrelease_content": "NAME=\\"Red Hat Enterprise Linux Server\\"\\nVERSION=\\"7.5 (Maipo)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVARIANT=\\"Server\\"\\nVARIANT_ID=\\"server\\"\\nVERSION_ID=\\"7.5\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux Server 7.5 (Maipo)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:7.5:GA:server\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 7\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.5\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"7.5\\"\\n", "platform_dist_result": ["redhat", "7.5", "Maipo"]}\n', '')
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<lpdepmld2.uem.lan> PUT /root/.ansible/tmp/ansible-local-105179U75Grh/tmp7Lwygf TO /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py
<lpdepmld2.uem.lan> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee '[lpdepmld2.uem.lan]'
<lpdepmld2.uem.lan> (0, 'sftp> put /root/.ansible/tmp/ansible-local-105179U75Grh/tmp7Lwygf /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/ /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee -tt lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (2, "/usr/bin/python: can't open file '/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py': [Errno 13] Permission denied\r\n", 'Shared connection to lpdepmld2.uem.lan closed.\r\n')
<lpdepmld2.uem.lan> Failed to connect to the host via ssh: Shared connection to lpdepmld2.uem.lan closed.
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/ > /dev/null 2>&1 && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
fatal: [lpdepmld2]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "module_stderr": "Shared connection to lpdepmld2.uem.lan closed.\r\n", 
    "module_stdout": "/usr/bin/python: can't open file '/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py': [Errno 13] Permission denied\r\n", 
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
    "rc": 2
}

PLAY RECAP *********************************************************************
lpdepmld2                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Tuesday 29 December 2020  16:38:54 +0100 (0:00:00.956)       0:00:01.063 ****** 
=============================================================================== 
shell ------------------------------------------------------------------- 0.96s
/etc/ansible/playbooks/test.yml:6 ---------------------------------------------
Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
Build step 'Execute shell' marked build as failure
Finished: FAILURE
现在,通过这份工作,我正在和詹金斯做同样的事情:

cd /etc/ansible
whoami; hostname; pwd
ansible-playbook /etc/ansible/playbooks/test.yml --private-key /home/ansible/.ssh/id_rsa -u ansible -vvv
root
lpansmld1
/etc/ansible

ansible-playbook 2.8.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible-playbook
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: test.yml **********************************************************************************************************************************************************************************************************************
1 plays in /etc/ansible/playbooks/test.yml

PLAY [lpdepmld2] ************************************************************************************************************************************************************************************************************************
META: ran handlers

TASK [shell] ****************************************************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/test.yml:6
Tuesday 29 December 2020  16:35:05 +0100 (0:00:00.111)       0:00:00.112 ******
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '/home/ansible\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057 `" && echo ansible-tmp-1609256105.11-16196748238057="` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057 `" ) && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, 'ansible-tmp-1609256105.11-16196748238057=/home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057\n', '')
<lpdepmld2> Attempting python interpreter discovery
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/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'"'"''
<lpdepmld2.uem.lan> (0, 'PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/bin/python2.7\n/usr/bin/python\nENDFOUND\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '{"osrelease_content": "NAME=\\"Red Hat Enterprise Linux Server\\"\\nVERSION=\\"7.5 (Maipo)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVARIANT=\\"Server\\"\\nVARIANT_ID=\\"server\\"\\nVERSION_ID=\\"7.5\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux Server 7.5 (Maipo)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:7.5:GA:server\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 7\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.5\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"7.5\\"\\n", "platform_dist_result": ["redhat", "7.5", "Maipo"]}\n', '')
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<lpdepmld2.uem.lan> PUT /root/.ansible/tmp/ansible-local-102513iMMnYg/tmpzX9hsf TO /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py
<lpdepmld2.uem.lan> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee '[lpdepmld2.uem.lan]'
<lpdepmld2.uem.lan> (0, 'sftp> put /root/.ansible/tmp/ansible-local-102513iMMnYg/tmpzX9hsf /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/ /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee -tt lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '\r\n{"changed": true, "end": "2020-12-29 16:35:06.054473", "stdout": "ansible\\nlpdepmld2\\n/home/ansible", "cmd": "whoami; hostname; pwd", "rc": 0, "start": "2020-12-29 16:35:06.047227", "stderr": "", "delta": "0:00:00.007246", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "whoami; hostname; pwd", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}}\r\n', 'Shared connection to lpdepmld2.uem.lan closed.\r\n')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/ > /dev/null 2>&1 && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
changed: [lpdepmld2] => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": true,
    "cmd": "whoami; hostname; pwd",
    "delta": "0:00:00.007246",
    "end": "2020-12-29 16:35:06.054473",
    "invocation": {
        "module_args": {
            "_raw_params": "whoami; hostname; pwd",
            "_uses_shell": true,
            "argv": null,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": true
        }
    },
    "rc": 0,
    "start": "2020-12-29 16:35:06.047227",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "ansible\nlpdepmld2\n/home/ansible",
    "stdout_lines": [
        "ansible",
        "lpdepmld2",
        "/home/ansible"
    ]
}

TASK [debug] ****************************************************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/test.yml:9
Tuesday 29 December 2020  16:35:06 +0100 (0:00:01.067)       0:00:01.179 ******
ok: [lpdepmld2] => {
    "msg": [
        "ansible",
        "lpdepmld2",
        "/home/ansible"
    ]
}
META: ran handlers
META: ran handlers

PLAY RECAP ******************************************************************************************************************************************************************************************************************************
lpdepmld2                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Tuesday 29 December 2020  16:35:06 +0100 (0:00:00.034)       0:00:01.214 ******
===============================================================================
shell ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1.07s
/etc/ansible/playbooks/test.yml:6 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
debug ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 0.04s
/etc/ansible/playbooks/test.yml:9 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
#!/bin/bash

cd /etc/ansible

whoami; hostname; pwd

ansible-playbook /etc/ansible/playbooks/test.yml --private-key /home/ansible/.ssh/id_rsa -u ansible -vvv
Started by user adminlocal
Running as SYSTEM
Building remotely on lpansmld1 in workspace /data/jenkins_agent/workspace/test/test
[test] $ /bin/bash /tmp/jenkins1557636937643197894.sh
root
lpansmld1
/etc/ansible
ansible-playbook 2.8.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details
Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: test.yml *************************************************************
1 plays in /etc/ansible/playbooks/test.yml

PLAY [lpdepmld2] ***************************************************************
META: ran handlers

TASK [shell] *******************************************************************
task path: /etc/ansible/playbooks/test.yml:6
Tuesday 29 December 2020  16:38:53 +0100 (0:00:00.106)       0:00:00.106 ****** 
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '/home/ansible\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394 `" && echo ansible-tmp-1609256333.17-248021594072394="` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394 `" ) && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, 'ansible-tmp-1609256333.17-248021594072394=/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394\n', '')
<lpdepmld2> Attempting python interpreter discovery
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/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'"'"''
<lpdepmld2.uem.lan> (0, 'PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/bin/python2.7\n/usr/bin/python\nENDFOUND\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '{"osrelease_content": "NAME=\\"Red Hat Enterprise Linux Server\\"\\nVERSION=\\"7.5 (Maipo)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVARIANT=\\"Server\\"\\nVARIANT_ID=\\"server\\"\\nVERSION_ID=\\"7.5\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux Server 7.5 (Maipo)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:7.5:GA:server\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 7\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.5\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"7.5\\"\\n", "platform_dist_result": ["redhat", "7.5", "Maipo"]}\n', '')
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<lpdepmld2.uem.lan> PUT /root/.ansible/tmp/ansible-local-105179U75Grh/tmp7Lwygf TO /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py
<lpdepmld2.uem.lan> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee '[lpdepmld2.uem.lan]'
<lpdepmld2.uem.lan> (0, 'sftp> put /root/.ansible/tmp/ansible-local-105179U75Grh/tmp7Lwygf /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/ /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee -tt lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (2, "/usr/bin/python: can't open file '/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py': [Errno 13] Permission denied\r\n", 'Shared connection to lpdepmld2.uem.lan closed.\r\n')
<lpdepmld2.uem.lan> Failed to connect to the host via ssh: Shared connection to lpdepmld2.uem.lan closed.
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/ > /dev/null 2>&1 && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
fatal: [lpdepmld2]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "module_stderr": "Shared connection to lpdepmld2.uem.lan closed.\r\n", 
    "module_stdout": "/usr/bin/python: can't open file '/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py': [Errno 13] Permission denied\r\n", 
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
    "rc": 2
}

PLAY RECAP *********************************************************************
lpdepmld2                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Tuesday 29 December 2020  16:38:54 +0100 (0:00:00.956)       0:00:01.063 ****** 
=============================================================================== 
shell ------------------------------------------------------------------- 0.96s
/etc/ansible/playbooks/test.yml:6 ---------------------------------------------
Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
Build step 'Execute shell' marked build as failure
Finished: FAILURE
詹金斯结果:

cd /etc/ansible
whoami; hostname; pwd
ansible-playbook /etc/ansible/playbooks/test.yml --private-key /home/ansible/.ssh/id_rsa -u ansible -vvv
root
lpansmld1
/etc/ansible

ansible-playbook 2.8.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible-playbook
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: test.yml **********************************************************************************************************************************************************************************************************************
1 plays in /etc/ansible/playbooks/test.yml

PLAY [lpdepmld2] ************************************************************************************************************************************************************************************************************************
META: ran handlers

TASK [shell] ****************************************************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/test.yml:6
Tuesday 29 December 2020  16:35:05 +0100 (0:00:00.111)       0:00:00.112 ******
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '/home/ansible\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057 `" && echo ansible-tmp-1609256105.11-16196748238057="` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057 `" ) && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, 'ansible-tmp-1609256105.11-16196748238057=/home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057\n', '')
<lpdepmld2> Attempting python interpreter discovery
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/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'"'"''
<lpdepmld2.uem.lan> (0, 'PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/bin/python2.7\n/usr/bin/python\nENDFOUND\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '{"osrelease_content": "NAME=\\"Red Hat Enterprise Linux Server\\"\\nVERSION=\\"7.5 (Maipo)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVARIANT=\\"Server\\"\\nVARIANT_ID=\\"server\\"\\nVERSION_ID=\\"7.5\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux Server 7.5 (Maipo)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:7.5:GA:server\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 7\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.5\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"7.5\\"\\n", "platform_dist_result": ["redhat", "7.5", "Maipo"]}\n', '')
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<lpdepmld2.uem.lan> PUT /root/.ansible/tmp/ansible-local-102513iMMnYg/tmpzX9hsf TO /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py
<lpdepmld2.uem.lan> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee '[lpdepmld2.uem.lan]'
<lpdepmld2.uem.lan> (0, 'sftp> put /root/.ansible/tmp/ansible-local-102513iMMnYg/tmpzX9hsf /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/ /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee -tt lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '\r\n{"changed": true, "end": "2020-12-29 16:35:06.054473", "stdout": "ansible\\nlpdepmld2\\n/home/ansible", "cmd": "whoami; hostname; pwd", "rc": 0, "start": "2020-12-29 16:35:06.047227", "stderr": "", "delta": "0:00:00.007246", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "whoami; hostname; pwd", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}}\r\n', 'Shared connection to lpdepmld2.uem.lan closed.\r\n')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1609256105.11-16196748238057/ > /dev/null 2>&1 && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
changed: [lpdepmld2] => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": true,
    "cmd": "whoami; hostname; pwd",
    "delta": "0:00:00.007246",
    "end": "2020-12-29 16:35:06.054473",
    "invocation": {
        "module_args": {
            "_raw_params": "whoami; hostname; pwd",
            "_uses_shell": true,
            "argv": null,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": true
        }
    },
    "rc": 0,
    "start": "2020-12-29 16:35:06.047227",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "ansible\nlpdepmld2\n/home/ansible",
    "stdout_lines": [
        "ansible",
        "lpdepmld2",
        "/home/ansible"
    ]
}

TASK [debug] ****************************************************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/test.yml:9
Tuesday 29 December 2020  16:35:06 +0100 (0:00:01.067)       0:00:01.179 ******
ok: [lpdepmld2] => {
    "msg": [
        "ansible",
        "lpdepmld2",
        "/home/ansible"
    ]
}
META: ran handlers
META: ran handlers

PLAY RECAP ******************************************************************************************************************************************************************************************************************************
lpdepmld2                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Tuesday 29 December 2020  16:35:06 +0100 (0:00:00.034)       0:00:01.214 ******
===============================================================================
shell ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1.07s
/etc/ansible/playbooks/test.yml:6 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
debug ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 0.04s
/etc/ansible/playbooks/test.yml:9 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
#!/bin/bash

cd /etc/ansible

whoami; hostname; pwd

ansible-playbook /etc/ansible/playbooks/test.yml --private-key /home/ansible/.ssh/id_rsa -u ansible -vvv
Started by user adminlocal
Running as SYSTEM
Building remotely on lpansmld1 in workspace /data/jenkins_agent/workspace/test/test
[test] $ /bin/bash /tmp/jenkins1557636937643197894.sh
root
lpansmld1
/etc/ansible
ansible-playbook 2.8.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details
Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: test.yml *************************************************************
1 plays in /etc/ansible/playbooks/test.yml

PLAY [lpdepmld2] ***************************************************************
META: ran handlers

TASK [shell] *******************************************************************
task path: /etc/ansible/playbooks/test.yml:6
Tuesday 29 December 2020  16:38:53 +0100 (0:00:00.106)       0:00:00.106 ****** 
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '/home/ansible\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394 `" && echo ansible-tmp-1609256333.17-248021594072394="` echo /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394 `" ) && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, 'ansible-tmp-1609256333.17-248021594072394=/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394\n', '')
<lpdepmld2> Attempting python interpreter discovery
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/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'"'"''
<lpdepmld2.uem.lan> (0, 'PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/bin/python2.7\n/usr/bin/python\nENDFOUND\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '{"osrelease_content": "NAME=\\"Red Hat Enterprise Linux Server\\"\\nVERSION=\\"7.5 (Maipo)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVARIANT=\\"Server\\"\\nVARIANT_ID=\\"server\\"\\nVERSION_ID=\\"7.5\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux Server 7.5 (Maipo)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:7.5:GA:server\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 7\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.5\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"7.5\\"\\n", "platform_dist_result": ["redhat", "7.5", "Maipo"]}\n', '')
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<lpdepmld2.uem.lan> PUT /root/.ansible/tmp/ansible-local-105179U75Grh/tmp7Lwygf TO /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py
<lpdepmld2.uem.lan> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee '[lpdepmld2.uem.lan]'
<lpdepmld2.uem.lan> (0, 'sftp> put /root/.ansible/tmp/ansible-local-105179U75Grh/tmp7Lwygf /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py\n', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/ /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee -tt lpdepmld2.uem.lan '/bin/sh -c '"'"'/usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py && sleep 0'"'"''
<lpdepmld2.uem.lan> (2, "/usr/bin/python: can't open file '/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py': [Errno 13] Permission denied\r\n", 'Shared connection to lpdepmld2.uem.lan closed.\r\n')
<lpdepmld2.uem.lan> Failed to connect to the host via ssh: Shared connection to lpdepmld2.uem.lan closed.
<lpdepmld2.uem.lan> ESTABLISH SSH CONNECTION FOR USER: ansible
<lpdepmld2.uem.lan> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=60 -o ControlPath=/root/.ansible/cp/a35139d2ee lpdepmld2.uem.lan '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/ > /dev/null 2>&1 && sleep 0'"'"''
<lpdepmld2.uem.lan> (0, '', '')
fatal: [lpdepmld2]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "module_stderr": "Shared connection to lpdepmld2.uem.lan closed.\r\n", 
    "module_stdout": "/usr/bin/python: can't open file '/home/ansible/.ansible/tmp/ansible-tmp-1609256333.17-248021594072394/AnsiballZ_command.py': [Errno 13] Permission denied\r\n", 
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
    "rc": 2
}

PLAY RECAP *********************************************************************
lpdepmld2                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Tuesday 29 December 2020  16:38:54 +0100 (0:00:00.956)       0:00:01.063 ****** 
=============================================================================== 
shell ------------------------------------------------------------------- 0.96s
/etc/ansible/playbooks/test.yml:6 ---------------------------------------------
Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds
Build step 'Execute shell' marked build as failure
Finished: FAILURE
在这两种情况下,我都可以在远程用户上看到我正确地连接了私钥和“Ansible”用户。这就是为什么我不理解Jenkins错误的结果

我已经尝试在ansible.cfg中设置类似的内容:

remote_tmp     = /tmp/.ansible-${USER}/tmp
但它也不起作用

有人知道问题出在哪里吗


谢谢。

无法打开文件'/home/ansible/.ansible/tmp/ansible-tmp-1609248479.41-56317758605217/AnsiballZ_command.py':[Errno 13]权限被拒绝
=>是否检查用户是否有创建/读取这些文件的权限?否则,您是否尝试在
ansible.cfg
中重新定位ansible tmp目录?@zeitounan或者没有在ansible配置中设置“remote_tmp”参数,此文件夹是在连接用户的“/home”目录中创建的。在这里,我在“Ansible”中连接到远程机器,因此我必须拥有对整个“/home”目录的权限。特别是通过手工操作,不需要经过Jenkins,它就可以工作:-(secondserver中的ansible用户在/home/ansible中拥有完全的权限,因为它是他的主目录:[ansible@secondserver~]$touch/home/ansible/.ansible/tmp/test[ansible@secondserver ~]$ll/home/ansible/.ansible/tmp/total 0-rw-rw-r--1 ansible ansible 0 29 déc.15:16测试[ansible@secondserver ~]$很抱歉,但您的错误消息正好相反……在这种情况下,乍一看,我更倾向于相信机器而不是人。此外,您没有显示您的剧本,因此我们不知道您到底在做什么(例如,升级权限,这可能是实际问题)。有效的使用“可执行位置=/bin/ansible playbook
。失败的使用“可执行位置=/usr/bin/ansible playbook”。不知道这是否相关。
无法打开文件'/home/ansible/.ansible/tmp/ansible-tmp-1609248479.41-56317758605217/AnsiballZ_command.py':[Errno 13]权限被拒绝
=>是否检查用户是否有创建/读取这些文件的权限?是否尝试在
ansible.cfg
中重新定位ansible tmp目录?@zeitounar或在ansible配置中未设置“remote_tmp”参数,此文件夹在“/主页”中创建连接用户的目录。在这里,我在“Ansible”中连接到远程计算机,因此我必须拥有对我整个“/home”目录的权限。特别是因为不用经过Jenkins,它可以手动工作:-(secondserver中的Ansible用户在/home/Ansible中拥有完全权限,因为它是他的主目录:[ansible@secondserver~]$touch/home/ansible/.ansible/tmp/test[ansible@secondserver~]$ll/home/ansible/.ansible/tmp/total 0-rw-rw-r--1 ansible ansible 0 29 déc.15:16测试[ansible@secondserver ~]$很抱歉,但您的错误消息正好相反……在这种情况下,乍一看,我更倾向于相信机器而不是人。此外,您没有显示您的剧本,因此我们不知道您到底在做什么(例如,升级权限,这可能是实际问题)。有效的使用“可执行位置=/bin/ansible playbook
。失败的使用“可执行位置=/usr/bin/ansible playbook”。不知道这是否相关。