My playbook includes one single play. Every tasks in play imports - ‘import_role:’ - one single role each. Every of imported roles is stored to own dedicated repository. This playbook is usually run from wrapper playbook which includes - ‘include_playbook:’ - the former one. Wrapper playbook imports more playbooks to conduct complete whole mission.
Tasks in my playbook should be carried out only under one condition - which is under implementation.
So I started to look for location in whole structure where is the optimal place for ‘when:’. Conditionals are not supported at import_playbook’s level so I started to have a look
into my playbook and placed ‘when:’ in every task which imports a role. In end-effect the condition is checked in my playbook.
Next step is to find optimal location for variable default value enforcement. Ansible documentation mentions: “As described in Roles, variables can also be included in the playbook via include files, which may or may not be part of an Ansible Role.” Actually documentation chapter “Roles” describes outsourcing variable settlement to intended files in role tree structure. My repository with playbooks tree inside is free however from tree of directories/files typical for role.
How to apply recommendations made for roles directory tree onto repository with playbooks which is free of role directories tree?