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