Dependencies between tasks possible?

55 views
Skip to first unread message

berndad...@googlemail.com

unread,
Oct 13, 2014, 4:00:27 AM10/13/14
to ansible...@googlegroups.com
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

James Martin

unread,
Oct 13, 2014, 10:11:14 PM10/13/14
to ansible...@googlegroups.com
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

berndad...@googlemail.com

unread,
Oct 14, 2014, 5:34:57 AM10/14/14
to ansible...@googlegroups.com
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

David Karban

unread,
Oct 14, 2014, 5:37:58 AM10/14/14
to ansible...@googlegroups.com
Hi Bernd,

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

David

David Karban
Specialista na správu linuxových serverů
www.karban.eu

2014-10-14 11:34 GMT+02:00 <berndad...@googlemail.com>:
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

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/17dc964f-b9e2-4139-9e4f-08cdff2b857c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Tomasz Kontusz

unread,
Oct 14, 2014, 5:38:38 AM10/14/14
to ansible...@googlegroups.com


berndad...@googlemail.com napisał:
Yes, it is. It's one of the selling points actually, as it makes orchestration simpler.
>
>Bernd

--
Wysłane za pomocą K-9 Mail.

berndad...@googlemail.com

unread,
Oct 14, 2014, 6:16:22 AM10/14/14
to ansible...@googlegroups.com
OK. Thanks to all for clarifying!

Bernd
Reply all
Reply to author
Forward
0 new messages