gpt4 book ai didi

可靠的 : is there a method to avoid skipped messages from specific roles

转载 作者:行者123 更新时间:2023-12-01 06:53:03 25 4
gpt4 key购买 nike

我不是在寻找 ansible.cfg skippy 变量方法,而是在寻找一种我可以在特定角色中使用的方法,以避免在运行我的剧本时跳过 stout 上的消息。

(不能使用基于 grep 拒绝的解决方案,因为我的 ansible 命令不是从 shell 或类似的应用程序启动的,而是从某些应用程序启动的)我只能处理 yml 文件。

怎么做?

测试文件

---
- hosts: localhost
vars:
mypath: /tmp/file
tasks:
- stat: path={{mypath}}
register: foo

- debug: var=foo

- name: do something with file if exists
command: cat {{ mypath }}
when: foo.stat.exists

这里无法避免跳过消息应用程序仅运行“ansible-playbook filename”并且不能修改为包含与以下示例相反的任何管道:

-bash-4.4$ ansible-playbook filetest.yml  | grep -i skip
skipping: [localhost]

如果不可能,最后是否可以在特定的剧本上实现?

我再说一遍,我根本不能使用 cfg 文件解决方案,只能使用环境变量或“inside yml”语法

谢谢。

最佳答案

在ansible.cfg中放stdout_callback = skippy

关于可靠的 : is there a method to avoid skipped messages from specific roles,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48388353/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com