# Checking the return-code before continuing

**URL:** <https://forum.ansible.com/t/checking-the-return-code-before-continuing/21050>\
**Category:** Ansible Project\
**Created:** [April 3, 2016, 1:55pm UTC](https://forum.ansible.com/t/checking-the-return-code-before-continuing/21050 "2016-04-03T13:55:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Herbie\_van\_Dalsen](https://avatars.discourse-cdn.com/v4/letter/h/b5a626/32.png) [@Herbie\_van\_Dalsen](https://forum.ansible.com/u/Herbie_van_Dalsen)\
**Post date:** [April 3, 2016, 1:55pm UTC](https://forum.ansible.com/t/checking-the-return-code-before-continuing/21050/1 "2016-04-03T13:55:45Z")

</div>

Hi there

I literally jut started with Ansible, and I can already see it is going to be a long road to get where I can use if to install jboss 🙂

I am therefore not ready for playbooks yet, and just like to execute the commands like this for now:

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 4, 2016, 4:12pm UTC](https://forum.ansible.com/t/checking-the-return-code-before-continuing/21050/2 "2016-04-04T16:12:49Z")

</div>

running adhoc as you do here there is only the return code from ansible itself, which should reflect if the task failed or not.

In a playbook you can register a variable for each task and check against the |success filter on the next.

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [April 5, 2016, 5:33pm UTC](https://forum.ansible.com/t/checking-the-return-code-before-continuing/21050/3 "2016-04-05T17:33:19Z")

</div>

Before you go down this road any longer, please consider using a  
playbook with your passwords stored in ansible-vault. In this case  
the password is visible in the .bash\_history or similar, also in the  
process list. Not safe...

Johannes
