我有一个简单的playbook来查询软件包版本
---
- name: version find
hosts: all
become: yes
tasks:
- name: query
shell: *shell command*
register: info
no_log: true
- debug:
msg: " {{inventory_hostname}} blah {{info.stdout}}blah"
我得到了一个输出,其中包含大量垃圾内容,如果不进行编辑,解析/使用该输出将变得困难:
ok: [hostname] => {
"msg": " *hostname* blah *info* blah"
}
我正在尝试找到一种解决方案,只返回消息而不带有“ok:”和类JSON的垃圾信息。
我已经尝试在YAML文件和ansible.cfg文件中设置no_log:True
,但没有成功。
ansible-doc -t callback --list
可以显示你当前已安装的插件。 - mdanielansible -i ./whatever -m shell -a "my-thing --version" all
,因为它的性质更加保守。 - mdaniel