ansible报错记录

ansible报错:

The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible-2.5.4-py2.7.egg/ansible/executor/task_executor.py", line 138, in run
    res = self._execute()
  File "/usr/lib/python2.7/site-packages/ansible-2.5.4-py2.7.egg/ansible/executor/task_executor.py", line 519, in _execute
    self._connection = self._get_connection(variables=variables, templar=templar)
  File "/usr/lib/python2.7/site-packages/ansible-2.5.4-py2.7.egg/ansible/executor/task_executor.py", line 788, in _get_connection
    connection = self._shared_loader_obj.connection_loader.get(conn_type, self._play_context, self._new_stdin, ansible_playbook_pid=to_text(os.getppid()))
  File "/usr/lib/python2.7/site-packages/ansible-2.5.4-py2.7.egg/ansible/plugins/loader.py", line 366, in get
    self._module_cache[path] = self._load_module_source(name, path)
  File "/usr/lib/python2.7/site-packages/ansible-2.5.4-py2.7.egg/ansible/plugins/loader.py", line 345, in _load_module_source
    module = imp.load_source(full_name, path, module_file)
  File "/usr/lib/python2.7/site-packages/ansible-2.5.4-py2.7.egg/ansible/plugins/connection/paramiko_ssh.py", line 163, in <module>
    import paramiko
  File "build/bdist.linux-x86_64/egg/paramiko/__init__.py", line 22, in <module>
  File "build/bdist.linux-x86_64/egg/paramiko/transport.py", line 38, in <module>
  File "build/bdist.linux-x86_64/egg/paramiko/auth_handler.py", line 48, in <module>
  File "build/bdist.linux-x86_64/egg/paramiko/ssh_gss.py", line 54, in <module>
AttributeError: ‘module‘ object has no attribute ‘GSSException‘

10.0.3.174 | FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

分析:说到这块就得说下ansible的通信过程,请看下面的一堆详细信息:

ansible 2.5.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u‘/root/.ansible/plugins/modules‘, u‘/usr/share/ansible/plugins/modules‘]
  ansible python module location = /usr/lib/python2.7/site-packages/ansible-2.5.4-py2.7.egg/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Using /etc/ansible/ansible.cfg as config file
Parsed /etc/ansible/hosts inventory source with ini plugin
META: ran handlers
Using module file /usr/lib/python2.7/site-packages/ansible-2.5.4-py2.7.egg/ansible/modules/commands/command.py
<10.0.3.174> ESTABLISH SSH CONNECTION FOR USER: None
<10.0.3.174> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/8f5e18b19f 10.0.3.174 ‘/bin/sh -c ‘"‘"‘echo ~ && sleep 0‘"‘"‘‘
<10.0.3.174> (0, ‘/root\n‘, ‘‘)
<10.0.3.174> ESTABLISH SSH CONNECTION FOR USER: None
<10.0.3.174> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/8f5e18b19f 10.0.3.174 ‘/bin/sh -c ‘"‘"‘( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1529054341.66-117835313708439 `" && echo ansible-tmp-1529054341.66-117835313708439="` echo /root/.ansible/tmp/ansible-tmp-1529054341.66-117835313708439 `" ) && sleep 0‘"‘"‘‘
<10.0.3.174> (0, ‘ansible-tmp-1529054341.66-117835313708439=/root/.ansible/tmp/ansible-tmp-1529054341.66-117835313708439\n‘, ‘‘)
<10.0.3.174> PUT /root/.ansible/tmp/ansible-local-60730UkDx3J/tmpLwKjow TO /root/.ansible/tmp/ansible-tmp-1529054341.66-117835313708439/command.py
<10.0.3.174> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/8f5e18b19f ‘[10.0.3.174]‘
<10.0.3.174> (0, ‘sftp> put /root/.ansible/tmp/ansible-local-60730UkDx3J/tmpLwKjow /root/.ansible/tmp/ansible-tmp-1529054341.66-117835313708439/command.py\n‘, ‘‘)
<10.0.3.174> ESTABLISH SSH CONNECTION FOR USER: None
<10.0.3.174> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/8f5e18b19f 10.0.3.174 ‘/bin/sh -c ‘"‘"‘chmod u+x /root/.ansible/tmp/ansible-tmp-1529054341.66-117835313708439/ /root/.ansible/tmp/ansible-tmp-1529054341.66-117835313708439/command.py && sleep 0‘"‘"‘‘
<10.0.3.174> (0, ‘‘, ‘‘)
<10.0.3.174> ESTABLISH SSH CONNECTION FOR USER: None
<10.0.3.174> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/8f5e18b19f -tt 10.0.3.174 ‘/bin/sh -c ‘"‘"‘/usr/bin/python /root/.ansible/tmp/ansible-tmp-1529054341.66-117835313708439/command.py && sleep 0‘"‘"‘‘
<10.0.3.174> (0, ‘\r\n{"changed": true, "end": "2018-06-15 17:19:02.268596", "stdout": "123\\nansible-2.5.4\\nansible-2.5.4.tar.gz\\nansible.sh\\ncommand.py", "cmd": ["ls"], "rc": 0, "start": "2018-06-15 17:19:02.265698", "stderr": "", "delta": "0:00:00.002898", "invocation": {"module_args": {"warn": true, "executable": null, "chdir": "/data", "_raw_params": "ls", "removes": null, "creates": null, "_uses_shell": false, "stdin": null}}}\r\n‘, ‘Shared connection to 10.0.3.174 closed.\r\n‘)
<10.0.3.174> ESTABLISH SSH CONNECTION FOR USER: None
<10.0.3.174> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/8f5e18b19f 10.0.3.174 ‘/bin/sh -c ‘"‘"‘rm -f -r /root/.ansible/tmp/ansible-tmp-1529054341.66-117835313708439/ > /dev/null 2>&1 && sleep 0‘"‘"‘‘
<10.0.3.174> (0, ‘‘, ‘‘)
10.0.3.174 | SUCCESS | rc=0 >>
123
ansible-2.5.4
ansible-2.5.4.tar.gz
ansible.sh
command.py

META: ran handlers
META: ran handlers
大概意思是:使用ssh测试以下是否能够正常连接,要是可以的话就继续,不可以的话就直接报错了。之后,会用ssh命令在你指定的主机的/root/.ansible/tmp/这个下面穿件一堆临时目录并且从你的ansible的管理机的上面按照你的需求呢生成一个.py的文件(这块怎么生      成的不太清楚反正和各种模块有关系,得看源码但我看不懂。。。)之后就会把这个.py的文件下发到你指定的主机上,怎么下发呢?(要是不相信你可以写一个shell脚本把这个.py文件抓出来看下里面的代码)

就是用sftp或者scp(这个可以在配置文件中指定)传过去到/root/.ansible/tmp/这个下面的临时目录中,之后用ssh远程执行命令/usr/bin/python  .py文件,执行完成后再把所有的临时目录和.py文件删除,这个ansible的管理过程就执行完成了。

解决上面的报错:yum -y install openssh-clients

原文地址:https://www.cnblogs.com/tugeboke/p/9188475.html

时间: 2024-09-29 10:55:58

ansible报错记录的相关文章

duplicate symbol _OBJC_METACLASS_$ 报错记录

duplicate symbol _OBJC_METACLASS_$_TabbarButton in: /Users/hw201406/Library/Developer/Xcode/DerivedData/xxx-gafskbgawbctznekgfxqhaugwjce/Build/Intermediates/xxx.build/Debug-iphonesimulator/xxx06.build/Objects-normal/i386/TabbarButton-FDEB19611A30D765

InnoDB: The InnoDB memory heap is disabled报错记录

报错记录: [[email protected] ~]# cat /data/3307/data/localhost.localdomain.err  150509 21:21:27 mysqld_safe Starting mysqld daemon with databases from /data/3307/data 150509 21:21:27 InnoDB: The InnoDB memory heap is disabled 150509 21:21:27 InnoDB: Mute

ansible报错Aborting, target uses selinux but python bindings (libselinux-python) aren&#39;t installed

报错内容: TASK [activemq : jvm configuration] **********************************************************fatal: [172.16.1.10]: FAILED! => {"changed": false, "checksum": "9b18306fa15628e687c3a81332f9bmsg": "Aborting, target

ansible报错Aborting, target uses selinux but python bindings (libselinux-python) aren&#39;t installed【转】

报错内容: TASK [activemq : jvm configuration] **********************************************************fatal: [172.16.1.10]: FAILED! => {"changed": false, "checksum": "9b18306fa15628e687c3a81332f9bmsg": "Aborting, target

Spring Boot 报错记录

Spring Boot 报错记录 由于新建的项目没有配置数据库连接启动报错,可以通过取消自动数据源自动配置来解决 解决方案1: @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) //@SpringBootApplication @MapperScan("com.example.*") //扫描:该包下相应的class,主要是MyBatis的持久化类. 解决方案2: #去配置文件中配置数据库连接参数 #

ansible报错

报错:[root@jenkins ~]# ansible go_activity -m cron -a "name='log_clear' minute=0 hour=2 job=find /home/golanger/log/ -type f -name 'log$(date +\%d -d -1day)' -delete" ERROR! this task 'cron' has extra params, which is only allowed in the following

django-crontab定时任务报错记录

1.使用命令python manage.py crontab add时报错:'/temp/xxxxxx', 10 , bad hour解决方法:看报错的字面意思就是时间填错了,然后我试了各种时间格式,依然报bad hour,查了网上一般报时间错误的都是bad minute,我意识到不是这个问题,然后仔细比对了下配置文件,发现最后面的逗号没写,一般认为这个元组里面只有一个元素会忽略,但是这里请一定要加上,虽然我也不知道为什么!下面把我的配置贴上:CRONJOBS = (('/5 *', 'Appn

Centos7系统修改密码报错记录

报错信息:passwd: Have exhausted maximum number of retries for service详细信息: [[email protected]_2_49_centos /zhangsan]# echo magedu1| passwd --stdin nginx Changing password for user nginx. passwd: Have exhausted maximum number of retries for service 解决办法:

centos7 ansible 报错收集

报错提示 /usr/lib/python2.7/site-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.21.1) or chardet (2.2.1) doesn't match a supported version! RequestsDependencyWarning) 原因: python库中urllib3 (1.21.1) or chardet (2.2.1) 的版本不兼容 解决方法: p