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.
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.
rc=0 for success
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
http://docs.ansible.com/ansible/playbooks_variables.html#registered-variables
and
http://docs.ansible.com/ansible/assert_module.html
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