Python 尝试在远程主机中安装git时AnsibleAuthenticationFailure

Python 尝试在远程主机中安装git时AnsibleAuthenticationFailure,python,ansible,Python,Ansible,如果无法使用以下yum模块在远程主机中安装git,我将尝试安装git - name: Installing git if unavailable yum: name: git state: present 此操作失败,出现“AnsibleAuthenticationFailure”错误,如下所示 TASK [configure_ansible_repo : Installing git if unavailable] ****************************

如果无法使用以下yum模块在远程主机中安装git,我将尝试安装git

- name: Installing git if unavailable
  yum:
    name: git
    state: present
此操作失败,出现“AnsibleAuthenticationFailure”错误,如下所示

TASK [configure_ansible_repo : Installing git if unavailable] **********************************************************************************************************
task path: /home/centos/bhprasad/okd-ansible-installer/ansible-okd-installation/roles/configure_ansible_repo/tasks/configure_ansible_repo.yaml:21
The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 130, in run
    # ensure to accumulate these
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 485, in _execute
    if self._task.evaluate_conditional(templar, variables):
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 735, in _get_connection
    break
  File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 363, in get
    pass
  File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 339, in _load_module_source
    try:
  File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/ssh.py", line 285, in <module>
    from ansible.errors import (
ImportError: cannot import name AnsibleAuthenticationFailure

fatal: [167.254.204.191]: FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
所有节点的操作系统详细信息:

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

如果您有任何建议,我们将不胜感激。

哪个操作系统是您的远程主机所有节点都使用Centos 7运行,并在问题中进行了更新。您可以发布详细的输出吗?运行ansible命令时添加-vvvv标志。您能够执行其他ansible模块吗?您是否可以通过yum和shell或命令模块安装它,或者通过手动ssh并手动运行yum命令来安装它?ssh用户是什么?我认为您可能需要一个
been:true
,或者在那里的某个地方设置一些其他与been相关的设置,以便可以以root用户身份运行yum命令。
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"