Ansible问题汇总

简介:

1、yum模块安装RPM包时报错


报错信息:

\ndebug2: fd 3 setting TCP_NODELAY\r\ndebug2: callback done\r\ndebug2: channel 0: open confirm rwindow 0 rmax 32768\r\ndebug3: Wrote 752 bytes for a total of 2797\r\ndebug2: channel_input_status_confirm: type 99 id 0\r\ndebug2: PTY allocation request accepted on channel 0\r\ndebug2: channel 0: rcvd adjust 2097152\r\ndebug2: channel_input_status_confirm: type 99 id 0\r\ndebug2: exec request accepted on channel 0\r\ndebug1: client_input_channel_req: channel 0 rtype exit-status reply 0\r\ndebug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0\r\ndebug2: channel 0: rcvd eow\r\ndebug2: channel 0: close_read\r\ndebug2: channel 0: input open -> closed\r\ndebug2: channel 0: rcvd eof\r\ndebug2: channel 0: output open -> drain\r\ndebug2: channel 0: obuf empty\r\ndebug2: channel 0: close_write\r\ndebug2: channel 0: output drain -> closed\r\ndebug2: channel 0: rcvd close\r\ndebug3: channel 0: will not send data after close\r\ndebug2: channel 0: almost dead\r\ndebug2: channel 0: gc: notify user\r\ndebug2: channel 0: gc: user detached\r\ndebug2: channel 0: send close\r\ndebug2: channel 0: is dead\r\ndebug2: channel 0: garbage collecting\r\ndebug1: channel 0: free: client-session, nchannels 1\r\ndebug3: channel 0: status: The following connections are open:\r\n  #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)\r\n\r\ndebug3: channel 0: close_fds r -1 w -1 e 6\r\ndebug3: Wrote 32 bytes for a total of 2829\r\ndebug3: Wrote 64 bytes for a total of 2893\r\ndebug1: fd 1 clearing O_NONBLOCK\r\ndebug1: fd 2 clearing O_NONBLOCK\r\nConnection to 10.19.171.100 closed.\r\nTransferred: sent 2712, received 2296 bytes, in 0.1 seconds\r\nBytes per second: sent 35504.5, received 30058.3\r\ndebug1: Exit status 0\r\n", 

    "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_K19Zjg/ansible_module_yum.py\", line 25, in <module>\r\n    import yum\r\nImportError: No module named yum\r\n", 

    "msg": "MODULE FAILURE"


报错原因,远程主机上默认的python版本为python2.7,在playbook中加入以下配置

1
2
vars:
     ansible_python_interpreter:  /usr/bin/python2 .6


修改后的playbook如下:

1
2
3
4
5
6
7
8
- hosts:  '{{ HOST }}'
   vars:
     ansible_python_interpreter:  /usr/bin/python2 .6
   gather_facts: False
   become: True
   become_user: root
   roles:
     - { role: linux /wf_install_jdk  }










本文转自 曾哥最爱 51CTO博客,原文链接:http://blog.51cto.com/zengestudy/1975702,如需转载请自行联系原作者

目录
相关文章
|
5月前
|
Kubernetes Docker 容器
ansible汇总(2)
playbook(剧本): 是ansible用于配置,部署,和管理被控节点的剧本。用于ansible操作的编排。 参考:https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html 使用的格式为yaml格式(saltstack,elk,docker,docker-compose,kubernetes等也都会用到yaml格式)
31 0
|
5月前
|
关系型数据库 MySQL PHP
ansible汇总(3)
roles介绍 roles(角色): 就是通过分别将variables, tasks及handlers等放置于单独的目录中,并可以便捷地调用它们的一种机制。
34 1
|
8月前
|
运维 网络安全 Python
ansible-1
ansible-1
27 0
|
9月前
|
XML 关系型数据库 应用服务中间件
|
10月前
|
存储 安全 Linux
ansible 初识
Ansible是一个开源配置管理工具,可以使用它来自动化任务,部署应用程序实现IT基础架构。Ansible可以用来自动化日常任务,比如,服务器的初始化配置、安全基线配置、更新和打补丁系统,安装软件包等。
81 1
|
运维 网络安全 开发工具
ansible使用
ansible使用
186 0
|
测试技术 Go Apache
|
存储 Ubuntu Shell
|
监控 Shell 网络安全
Ansible 常用
一.前言 在企业中运维工作人员通常需要同时管理几十台甚至几百台主机(虚拟机),如果需要批量修改设置或者做更新操作的话,即便是事先编写好脚本,一台一台的去运行脚本也是非常耗时的,效率也十分低下。
1216 0
|
监控 Python 运维