Command Execution Return Code "rc"

24 views
Skip to first unread message

Herbie van Dalsen

unread,
Apr 4, 2016, 9:05:17 AM4/4/16
to Ansible Project
Hi there,

I cannot find a way to check successful execution of the previous command before doing the next... And I have come across the mention of rc, but how to test for that?

Thank you in advance

H.

mondher khas

unread,
Apr 4, 2016, 10:12:21 AM4/4/16
to Ansible Project
rc=0 for success

J Hawkesworth

unread,
Apr 4, 2016, 10:31:54 AM4/4/16
to Ansible Project
Use register to capture the results returned by the module and then you can use an assert step to check that the results contain what you expect.

See 

and 


There are lots of examples of using assert in the integration test roles here: https://github.com/ansible/ansible/tree/devel/test/integration/roles

HTH

Jon
Reply all
Reply to author
Forward
0 new messages