-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] - why is the "mariadb_data_dir" defined in roles/vars and not in roles/default ? #42
Comments
Everything that may be OS specific is defined in |
Role vars have a high priority in the precedence list mentioned above. I did a few tests with commandline params and files in group_/host_vars, only commandline params works; and elevating the priority with Tests:
and role *mariadb" (outcome is the same as with calling fauust.mariadb directly in the playbook above):
Command line variables overwrite as expected:
Not from group_vars:
Neither from host_vars:
This addition makes it work for me:
|
@BenGig this is not what the official documentation says, please read https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#understanding-variable-precedence |
The precedence mentioned there is: \7. playbook group_vars/* Playbook vars are defined as having lower precedence than role vars. But I don't see an intuitive way how you could design it differently. Setting the default storage path based on the OS is important for a proper default behavior, and should suit 90% of the use cases. For the rest, set_fact does the work. |
Oh, yes, my fault, this is the |
Sadly there is no such thing like Honestly, I would leave it as it is. Most of the settings are rarely changed, and for the few to be changed, a note about set_fact in the docs should be sufficient. And then advertise it as a safety measure against accidential changes of low level parameters ;-) |
Excellent role but we have no other solution that using facts :(
|
Hi,
It's not really an issue but i was wondering why you defined "mariadb_data_dir" and config in the vars file of the role, is there any specifc reason ?
because with our team, we wanted to define another dir for data, but we would use group_vars or host_vars to override those variable, and in some contexts it's not really the ansible way to do it.
The text was updated successfully, but these errors were encountered: