Hi everyone.
Is there a good way to specify that a play needs whatever is done by another play? EG I have a playbook that installs apache. I have another playbook that installs a wiki and yet another that installs wordpress. (I’m making this all up for this example) Both the wiki and wordpress depend on apache. Rather than including the apache play in the wiki and wordpress plays, is there a way to make the wordpress and wiki plays call the apache play if needed?
Including the apache play might work in some cases. I’d need to be able to exit the apache play early, but the only way I know to do that is by failing out in a debug statement, which would signify that installing apache failed, rather than signifying that apache is already installed. The other problem is that I might want to install the wiki or wordpress on a system that doesn’t have the identical apache setup to the one produced by my apache playbook.
Maybe this problem is better described as conditionally activating a play or a set of tasks? Right now if I want to do something more complex than one task (eg copy this over there, unpack it, put it in a shoebox, mail it to Aunt Mildred etc…) I have to use a when: statement on all of those instead of some kind of single conditional. I can conditionally include a play, but then I have to bounce back and forth between files… Hmm… that is probably my best option…
Chances are, I’m just thinking about this wrong, so please set me straight. How do you all handle playbook dependencies?
Thanks & Thank you for Ansible!
-Dylan