2016-05-27 52 views
1

我有很多的主机通过ansible 并在一个管理主机设置模块失败:Ansible设置模块出现故障

[email protected]:~ >> ansible -vvvv -i "10.10.10.2," all -m setup                     [20:00:24] 
Using /etc/ansible/ansible.cfg as config file 
Loaded callback minimal of type stdout, v2.0 
<10.10.10.2> ESTABLISH SSH CONNECTION FOR USER: None 
<10.10.10.2> SSH: EXEC ssh -C -vvv -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=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.10.10.2 '/bin/sh -c '"'"'(umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085 `")'"'"'' 
<10.10.10.2> PUT /tmp/tmpefUyS_ TO /home/user/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085/setup 
<10.10.10.2> SSH: EXEC sftp -b - -C -vvv -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=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r '[10.10.10.2]' 
<10.10.10.2> ESTABLISH SSH CONNECTION FOR USER: None 
<10.10.10.2> SSH: EXEC ssh -C -vvv -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=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.10.10.2 '/bin/sh -c '"'"'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085/setup; rm -rf "/home/user/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085/" > /dev/null 2>&1'"'"'' 
10.10.10.2 | FAILED! => { 
    "changed": false, 
    "failed": true, 
    "invocation": { 
     "module_name": "setup" 
    }, 
    "module_stderr": "OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014\r\ndebug1: Reading configuration data /home/user/.ssh/config\r\ndebug1: /home/user/.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 2079\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 10.10.10.2 closed.\r\n", 
    "module_stdout": "Traceback (most recent call last):\r\n File \"/home/user/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085/setup\", line 5184, in <module>\r\n main()\r\n File \"/home/user/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085/setup\", line 140, in main\r\n data = run_setup(module)\r\n File \"/home/user/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085/setup\", line 84, in run_setup\r\n facts = ansible_facts(module)\r\n File \"/home/user/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085/setup\", line 5119, in ansible_facts\r\n facts.update(Facts().populate())\r\n File \"/home/user/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085/setup\", line 2259, in __init__\r\n self.get_platform_facts()\r\n File \"/home/user/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085/setup\", line 2305, in get_platform_facts\r\n self.get_distribution_facts()\r\n File \"/home/user/.ansible/tmp/ansible-tmp-1464541230.33-190582391613085/setup\", line 2459, in get_distribution_facts\r\n if 'Red Hat' in data:\r\nTypeError: argument of type 'NoneType' is not iterable\r\n", 
    "msg": "MODULE FAILURE", 
    "parsed": false 
} 

系统:

Linux host-01 3.13.0-32-generiC#57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linu 

和主机的一切工作在同一个邻居well

"module_stdout" traceback格式时看起来像这样:

Traceback (most recent call last): 
    File "/home/user/.ansible/tmp/.../setup", line 5184, in <module> 
    main() 
    File "/home/user/.ansible/tmp/.../setup", line 140, in main 
    data = run_setup(module) 
    File "/home/user/.ansible/tmp/.../setup", line 84, in run_setup 
    facts = ansible_facts(module) 
    File "/home/user/.ansible/tmp/.../setup", line 5119, in ansible_facts 
    facts.update(Facts().populate()) 
    File "/home/user/.ansible/tmp/.../setup", line 2259, in __init__ 
    self.get_platform_facts() 
    File "/home/user/.ansible/tmp/.../setup", line 2305, in get_platform_facts 
    self.get_distribution_facts() 
    File "/home/user/.ansible/tmp/.../setup", line 2459, in get_distribution_facts 
    if 'Red Hat' in data: 
TypeError: argument of type 'NoneType' is not iterable 

UPD:它──作与工作PARAM,但一个奇怪的事情:

[email protected]:~ >> ansible -vvvv -i "10.10.10.2," all -m setup -become | grep -i distr 
     "ansible_distribution": "RedHat", 
     "ansible_distribution_major_version": "14", 
     "ansible_distribution_release": "trusty", 
     "ansible_distribution_version": "14.04", 
     "facter_lsbdistrelease": "14.04", 
     "facter_lsbmajdistrelease": "14", 

ansible_distribution:RedHat的,但它的Ubuntu 14.04.4

+0

这看起来像一个错误。尝试使用-vvvv运行并发布输出。不过,我可能会在GitHub上开发一个Ansible的问题。 – smiller171

+0

谢谢,我更新了头 – pezzak

回答

0

它的工作──作用PARAM:ansible - 我“10.10.10.2,”all -m'setup' - 成为

但在其他主机上它没有这个参数,它工作