I use roles to deploy my machines, Roles have vars, but sometimes i have multiple role and i want to put a global variable file in the root folders, so ansible use vars/global.yml
and overwrite role/vars/main.yml
#vars/global.yml
somevariable: somevalue
But if there is global variable in root folder, Just overwrite role based variable and implement vars/global instead.
├── Playbook.yml
├── ansible.cfg
├── roles
│ ├── Ansible-Role-UserProfile
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── meta
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ ├── rm.j2
│ │ │ └── vimrc.j2
│ │ └── vars
│ │ └── main.yml
└── vars
└── global.yml
Is anything comes which suite reusability of roles and variable natively ?