【问题标题】:want to hide "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3" } from ping module output?想从 ping 模块输出中隐藏 "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3" }?
【发布时间】:2020-05-31 03:57:35
【问题描述】:

我想在 ping 模块的输出中隐藏"ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3"}

【问题讨论】:

  • 你能给我们一些示例代码等吗?
  • 这与 Ansible ping 模块有关

标签: python configuration ansible ansible-facts


【解决方案1】:

可以配置DEFAULT_STDOUT_CALLBACK" Set the main callback used to display Ansible output."。例如

$ cat playbook.yml
- hosts: test_01
  tasks:
    - ping:

$ export ANSIBLE_STDOUT_CALLBACK=actionable; ansible-playbook playbook.yml
PLAY [test_01] ***

PLAY RECAP ***
test_01: ok=2  changed=0  unreachable=0  failed=0  skipped=0  rescued=0  ignored=0

查看其他可用的callback plugins

【讨论】:

  • 不...这不适合自定义回调插件。
【解决方案2】:

只需将以下内容添加到 ansible.cfg:

interpreter_python = /usr/bin/python

【讨论】:

    猜你喜欢
    • 2021-11-09
    • 2020-06-13
    • 1970-01-01
    • 2022-01-12
    • 2021-01-11
    • 2011-12-01
    • 2013-06-27
    • 1970-01-01
    • 2017-11-26
    相关资源
    最近更新 更多