如何使用Ansible记录ansible_python_解释器失败的IP?

问题描述

我不是在寻找解决以下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": "","msg": "MODULE FAILURE\nSee stdout/stderr for the exact error","rc": 127

相反,我需要在python发现失败的地方记录IP。

下面是我的招贴,其中我可以从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_interpreter?

因此,我正在寻找以下内容

   - raw: "Python Could not be discovered on IP {{ item }}"
     delegate_to: localhost
     when: <>

如何抑制discover_python_interpreter的致命错误,并使用缺少的raw模块记录所有IP。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...