一些ansible命令产生的json输出对人类来说几乎无法读取.当人们需要检查剧本是否正确执行并导致混淆时,它会分散注意力.
示例命令是shell
和replace
-它们产生大量无用的噪声.我怎么能阻止这个?简单好吧 改变了 失败就足够了.我不需要整个JSON.
udo*_*dan 28
用于no_log: True
要抑制所有进一步输出的那些任务.
- shell: whatever
no_log: True
Run Code Online (Sandbox Code Playgroud)
我相信这个功能的唯一提及是在FAQ中.
示例剧本:
- hosts:
- localhost
gather_facts: no
vars:
test_list:
- a
- b
- c
tasks:
- name: Test with output
shell: echo "{{ item }}"
with_items: test_list
- name: Test w/o output
shell: echo "{{ item }}"
no_log: True
with_items: test_list
Run Code Online (Sandbox Code Playgroud)
示例输出:
TASK: [Test with output] ******************************************************
changed: [localhost] => (item=a)
changed: [localhost] => (item=b)
changed: [localhost] => (item=c)
TASK: [Test w/o output] *******************************************************
changed: [localhost]
changed: [localhost]
changed: [localhost]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
20822 次 |
最近记录: |