How to disable json output from specific ansible commands?
Use no_log: true
on those tasks where you want to suppress all further output.
- shell: whatever
no_log: true
I believe the only mention of this feature is within the FAQ.
Example playbook:
- 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
Example output:
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]