Playbooks that depend on other playbooks?

97 views
Skip to first unread message

Cody Krieger

unread,
Oct 9, 2014, 4:42:26 PM10/9/14
to ansible...@googlegroups.com
Hi all,

I've got a couple of playbooks that depend on other playbooks in order to eliminate as much repetition as possible. For example, one playbook is responsible for basic server configuration, which is a dependency of other playbooks whose goals are to deploy specific apps/services on top of this base configuration.

My current strategy looks something like this:

- playbook b depends on playbook a
- playbook b has playbook a as a git submodule in vendor/a
- playbook b's site.yml includes vendor/a/site.yml before playbook b's roles are declared, in order to make sure that playbook a runs first

This sort of works, but it feels kind of janky. One of the biggest downsides to this is that sub-playbooks don't have their group_vars evaluated — only the top-level playbook's group_vars are evaluated. This effectively means that anything defined in group_vars in any of the sub-playbooks has to be copied up to the top-level playbook's group_vars.

Is there a better way to handle this?

Thanks,
Cody

Michael DeHaan

unread,
Oct 9, 2014, 5:23:18 PM10/9/14
to ansible...@googlegroups.com
When you say depends, I assume you are meaning you are using playbook includes, so the provisioning playbook includes the "config" playbook?



--
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/517119dc-48f6-4995-b7c8-5bbc4c8940c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cody Krieger

unread,
Oct 13, 2014, 7:51:46 PM10/13/14
to ansible...@googlegroups.com
That's correct.

Michael DeHaan

unread,
Oct 20, 2014, 5:20:48 PM10/20/14
to ansible...@googlegroups.com
Thanks for clarification -- it's not a dependency then.

"One of the biggest downsides to this is that sub-playbooks don't have their group_vars evaluated — only the top-level playbook's group_vars are evaluated."

I'm not processing this part of the email unfortunately, as group_vars/ is an inventory concept.




Reply all
Reply to author
Forward
0 new messages