Dependencies between tasks possible?

Hi All!

Just want to say hello to all first since this is my first post to this list!

My questions is if there is a way to have dependencies between tasks. Example: I have one task which puts a shell script in place, and the a second task which establishes a cron job which uses this script. So if copying of the script fails for whatever reason, it will make no sense to put the cron job in place. So is there a way to create such a dependency/requirement between tasks?

Maybe I could use handlers, but this seems to be a kind of misuse. Any suggestions appreciated.

Thanks
Bernd

If the task that copies the shell script fails, then the following tasks (in this case the cron job task) will not execute for that host.

  • James

This will imply that the order in which tasks are executed in a playbook is from top to bottom and I only have to use the right order. Is this (the order of executing tasks) a guaranteed feature of Ansible?

Bernd

Hi Bernd,

yes, it is how ansible works. Tasks are executed from top to bottom in order.

David

berndadamowicz@googlemail.com napisaƂ:

This will imply that the order in which tasks are executed in a
playbook is
from top to bottom and I only have to use the right order. Is this (the

order of executing tasks) a guaranteed feature of Ansible?

Yes, it is. It's one of the selling points actually, as it makes orchestration simpler.

OK. Thanks to all for clarifying!

Bernd