There is no direct feature to include vars from a role without executing it. However, it can be achieved if the role is created in a way that provides a noop tasks file. If you use `import_role`, you can specify `tasks_from` to tell it to use tasks from that noop file.
On Mon, Mar 21, 2022 at 9:04 AM Paul Manno <[email protected]> wrote: > Hello, > > A bit of background... I manage multiple applications. Each application > has an ansible role defined for it. Sometimes, there is a playbook that is > common to each application, but I would prefer to keep this playbook out of > the ansible role and instead use the playbook from the parent project (to > reduce code duplication); however, I do still need all the vars that are > specific to the role in the playbook. Is there a way to load a role, but > not have it execute at all? Just so I can reference the role variables? I > tried including_vars from roles/<role_name/defaults/main.yml but that does > not seem to work. I did get it working by importing the role (my main.yml > is a noop unless some flags are set) and that does work, but I'd prefer it > if the role did not execute at all. > > Thanks, > Paul > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/1313ad47-15b1-4579-881b-2f08f5a39a05n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/1313ad47-15b1-4579-881b-2f08f5a39a05n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Matt Martz @sivel sivel.net -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v-33fHxYR4EcDBAwG0jUE7R9rHHJbmTdiVkTzYMtMMLyQ%40mail.gmail.com.
