Ansible剧本在特定服务器上只有失败

问题描述 投票:-2回答:1

下面ansible-剧本连接工作正常,除了dest_svr我的所有服务器。下面命令失败。

ansible-playbook -vvvv /opt/test/Auto/site.yml  -i /opt/test/Auto/hosts.txt -e "source_host=dest_svr execmd=echo source_user=user2"

(0, '',“OpenSSH_7.7p1(CentrifyDC建立5.5.1-395),OpenSSL的1.0.2o-FIPS 2018年3月27日\ r \ ndebug1:读取配置数据/home/user1/.ssh/config\r\ndebug1 :读取配置数据的/ etc / centrifydc / SSH / ssh_config中\ r \ ndebug1:在/ etc / centrifydc / SSH / ssh_config中第3行:应用选项* \ r \ ndebug1:自动MUX:试图现有主\ r \ ndebug2:FD 3设置O_NONBLOCK \ r \ ndebug2:mux_client_hello_exchange:主版本4 \ r \ ndebug3:mux_client_forwards:请求forwardings:0本地,0远程\ r \ ndebug3:mux_client_request_session:进入\ r \ ndebug3:mux_client_request_alive:进入\ r \ ndebug3:mux_client_request_alive :完成PID = 57768 \ r \ ndebug3:mux_client_request_session:会话请求发送\ r \ ndebug1:mux_client_request_session:主会话ID:2 \ r \ ndebug3:mux_client_read_packet:读头失败:中断的管道\ r \ ndebug2:接收退出主状态0 \ r \ nShared连接到dest_svr关闭\ r \ N')致命:[dest_svr]:失败! => { “改变”:假 “module_stderr”:“OpenSSH_7.7p1(CentrifyDC建立5.5.1-395),OpenSSL的1.0.2o-FIPS 2018年3月27日\ r \ ndebug1:读取配置数据/家/ USER1 /。 SSH /配置\ r \ ndebug1:读取配置数据的/ etc / centrifydc / SSH / ssh_config中\ r \ ndebug1:在/ etc / centrifydc / SSH / ssh_config中第3行:应用选项* \ r \ ndebug1:自动MUX:试图现有主\ r \ ndebug2:FD 3设置O_NONBLOCK \ r \ ndebug2:mux_client_hello_exchange:主版本4 \ r \ ndebug3:mux_client_forwards:请求forwardings:0本地,0远程\ r \ ndebug3:mux_client_request_session:进入\ r \ ndebug3:mux_client_request_alive:进入\ r \ ndebug3:mux_client_request_alive:进行PID = 57768 \ r \ ndebug3:mux_client_request_session:会话请求发送\ r \ ndebug1:mux_client_request_session:主会话ID:2 \ r \ ndebug3:mux_client_read_packet:读头失败:中断的管道\ r \ ndebug2:从主机(2)\ r \ nShared连接接收退出状态到关闭dest_svr \ r \ n “个, ”module_stdout“:” /home/user2/.ansible/tmp/an锡布尔赫丁-TMP-1549081965.65-147775141838271 / AnsiballZ_setup.py:行3:_ANSIBALLZ_WRAPPER:命令未找到\ r \ N /家庭/用户2 / .ansible / TMP / ansible-TMP-1549081965.65-147775141838271 / AnsiballZ_setup.py:行4:语法附近意外的标记错误('\r\n/home/user2/.ansible/tmp/ansible-tmp-1549081965.65-147775141838271/AnsiballZ_setup.py: line 4:def _ansiballz_main():'\ r \ n”个, “msg” 中: “模块故障\ n请参阅标准输出/标准错误的确切的错误”, “RC”:2}重试,使用:--limit @ /选择/测试/自动/ site.retry

PLAY重点回顾************************************************ ************************************************** ************************************************** ************************************************** *********** dest_svr:OK = 0变化= 0不可达= 0失败= 1

来源Ansible服务器的详细信息:

[user1@source_svr: Auto]$ uname -a
Linux source_svr 3.10.0-957.el7.x86_64 #1 SMP Thu Oct 4 20:48:51 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

[user1@source_svr: Auto]$ ansible --version
ansible 2.7.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/user1/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Sep 12 2018, 05:31:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

Ansible主机文件的详细信息:

cat /opt/test/Auto/hosts.txt
[dest_svr]
dest_svr ansible_ssh_common_args="-t -o UserKnownHostsFile=/dev/null  -o StrictHostKeyChecking=no -o ControlPersist=30m" ansible_shell_executable=/bin/bash ansible_shell_type=sh ANSIBLE_HOST_KEY_CHECKING=false ansible_python_interpreter= ansible_ssh_private_key_file=/opt/test/ssh_key/id_rsa USER_RUN=user2

而现在的目标服务器的详细信息:

user2@dest_svr:~$ uname -a
SunOS dest_svr 5.11 11.3 sun4v sparc sun4v
user2@dest_svr:~$ python --version                                                                                                                                                                                    
Python 2.7.14

注:我想更改只到我的剧本,不希望在ansible.cfg改变任何其他剧本应该不会受到影响。

ssh ansible sunos
1个回答
0
投票

作为最好的,我可以告诉它是由这个原因引起:

line 3: _ANSIBALLZ_WRAPPER: command not found

这是this line,但有点挖似乎在暗示,在SunOS家当线不容忍指向一个可执行文件,是本身也是一个家当:Python3 shebang line not working as expected

此修复程序,尽我所知,是设置-e ansible_python_interpreter=/the/path/to/the/real/python或我见过some folks try -e 'ansible_python_interpreter="/bin/env python"'(我修改了路径env因为apparently的SunOS不具有env /usr/bin/env,但我没有一个SunOS的实例来测试理论,让买者自负)

© www.soinside.com 2019 - 2024. All rights reserved.