# Suppress output of task?

**URL:** <https://forum.ansible.com/t/suppress-output-of-task/16721>\
**Category:** Ansible Project\
**Created:** [November 7, 2014, 6:14pm UTC](https://forum.ansible.com/t/suppress-output-of-task/16721 "2014-11-07T18:14:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Oliver](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@John\_Oliver](https://forum.ansible.com/u/John_Oliver)\
**Post date:** [November 7, 2014, 6:14pm UTC](https://forum.ansible.com/t/suppress-output-of-task/16721/1 "2014-11-07T18:14:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Hakisho\_Nukama](https://avatars.discourse-cdn.com/v4/letter/h/e56c9b/32.png) [@Hakisho\_Nukama](https://forum.ansible.com/u/Hakisho_Nukama)\
**Post date:** [November 7, 2014, 6:53pm UTC](https://forum.ansible.com/t/suppress-output-of-task/16721/2 "2014-11-07T18:53:54Z")

</div>

Could this example [1] work?

- name: secret task  
&nbsp;&nbsp;shell: /usr/bin/do\_something --value={{ secret\_value }}  
&nbsp;&nbsp;no\_log: True

# Maybe conditional, when an error arises?  
&nbsp;&nbsp;register: result  
&nbsp;&nbsp;no\_log: True  
&nbsp;&nbsp;when: result|failed

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

---

<div class="post-metadata">

**Author:** ![John\_Oliver](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@John\_Oliver](https://forum.ansible.com/u/John_Oliver)\
**Post date:** [November 7, 2014, 7:07pm UTC](https://forum.ansible.com/t/suppress-output-of-task/16721/3 "2014-11-07T19:07:22Z")

</div>

No, no\_log just suppresses logging. Already found and tried it 🙂

---

<div class="post-metadata">

**Author:** ![John\_Oliver](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@John\_Oliver](https://forum.ansible.com/u/John_Oliver)\
**Post date:** [November 24, 2014, 10:56pm UTC](https://forum.ansible.com/t/suppress-output-of-task/16721/4 "2014-11-24T22:56:26Z")

</div>

Anyone?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [November 24, 2014, 11:16pm UTC](https://forum.ansible.com/t/suppress-output-of-task/16721/5 "2014-11-24T23:16:29Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![John\_Oliver](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@John\_Oliver](https://forum.ansible.com/u/John_Oliver)\
**Post date:** [November 25, 2014, 12:40am UTC](https://forum.ansible.com/t/suppress-output-of-task/16721/6 "2014-11-25T00:40:35Z")

</div>

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 🙂

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