Role defaults available in another role's scope

@bluppfisk Hello.

You can change DEFAULT_PRIVATE_ROLE_VARS to True to be private.

https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-private-role-vars

If change by Environment Variable

% ANSIBLE_PRIVATE_ROLE_VARS=True ansible-playbook -i localhost, playbook.yml  --tags role2

PLAY [test] ****************************************************************************************************************************************************************************************

TASK [role_2 : debug] ***************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {
    "msg": "The task includes an option with an undefined variable. The error was: 'snaap' is undefined.(omit)
2 Likes