Suppress output of task?

There are some tasks I run to collect info, and if they fail, oh well… I have ignore_errors: true in there. But sometimes there could be a lot of output from a “failed” task that I just don’t want to see. How can I tell my task to not echo back any output to stdout?

Could this example [1] work?

- name: secret task
  shell: /usr/bin/do_something --value={{ secret_value }}
  no_log: True

# Maybe conditional, when an error arises?
  register: result
  no_log: True
  when: result|failed

[1] http://docs.ansible.com/faq.html#how-do-i-keep-secret-data-in-my-playbook

No, no_log just suppresses logging. Already found and tried it :slight_smile:

Anyone?

no_log in 1.8 does in fact block output to the callbacks in general.

Have you tried on 1.8 (devel – releasing VERY soon now), and if so, can you clarify more about what you are looking for?

Awesome! No, I have not tried it, as I get my ansible from MacPorts. Hopefully as soon as 1.8 is out the port maintainer will release there.

Basically, when I’m executing a task simply to get some output, I don’t want to see:

TASK: [postfix | Check if SMTP submission is already allowed via IPv6] ********
failed: [jedis-test] => {“changed”: true, “cmd”: “grep ‘^-A\ INPUT\ -p\ tcp\ -m\ state\ --state\ NEW\ -m\ tcp\ --dport\ 587\ -j\ ACCEPT’ /etc/sysconfig/ip6tables >/dev/null 2>&1”, “delta”: “0:00:00.002819”, “end”: “2014-11-24 16:35:55.098774”, “rc”: 1, “start”: “2014-11-24 16:35:55.095955”}
…ignoring

And some tasks, like checking to see if our McAfee is there, can generate a page of angry red text. Since I really don’t care what stdout is, I’d rather just see:

TASK: [postfix | Check if SMTP submission is already allowed via IPv6] ********

and then move on to the next task :slight_smile:

Thanks yet again, and thanks for such an awesome piece of software! I’m using ansible for more and more tasks, and loving it!