如何使用ansible记录ansible_python_解释器失败的IP?
我不是在寻找解决方案来修复以下python解释器发现失败错误:如何使用ansible记录ansible_python_解释器失败的IP?,python,ansible,discovery,autodiscovery,Python,Ansible,Discovery,Autodiscovery,我不是在寻找解决方案来修复以下python解释器发现失败错误: TASK [Gathering Facts] fatal: [123.123.123.123]: FAILED! => {"changed": false, "module_stderr": "/bin/sh: 1: /usr/bin/python: not found\n", "module_stdout": ""
TASK [Gathering Facts]
fatal: [123.123.123.123]: FAILED! => {"changed": false,
"module_stderr": "/bin/sh: 1: /usr/bin/python: not found\n",
"module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 127
相反,我需要的是记录python发现失败的IP
下面是我的plabook,在这里我可以从我的ansible主机记录失败、telnet和失败的ssh。但是,我也希望记录失败的python发现
下面是我的剧本
- name: Play 3- check nodes
hosts: localhost
tasks:
- name: Check all port numbers are accessible from current host
include_tasks: /app/checkssh/innertelnet.yml
with_items: "{{ groups['all_hosts'] }}"
cat innertelnet.yml
---
- wait_for:
host: "{{ item }}"
port: 22
state: started
delay: 0
timeout: 2
ignore_errors: yes
register: netstatoutput
- raw: "echo telnet failed on IP {{ item }}"
delegate_to: localhost
when: netstatoutput.failed == 'True'
- name: Check ssh connectivity
ignore_errors: yes
raw: "ssh -o BatchMode=yes root@{{ item }} echo success"
register: sshcheck
- raw: "echo ssh failed on IP {{ item }}"
delegate_to: localhost
when: not netstatoutput.failed and sshcheck is unreachable
对于成功的ssh连接,如何检测ansible是否在目标主机上发现了python_解释器
因此,我正在寻找以下内容:
- raw: "Python could not be discovered on IP {{ item }}"
delegate_to: localhost
when: <>
-raw:“在IP{{item}上找不到Python”
委托给:localhost
什么时候:
如何抑制discover_python_解释器的致命错误,并使用raw
模块记录丢失的所有IP