Ansible Destination Not Writable

This is a quick blog post FYI in case you are searching for error messages like:

msg: Destination /etc/mysql/my.cnf not writable

This may be caused by the need to set the sudo flag in any roles/your_role/vars/main.yml files as it seems that they default to sudo : no if you define a main.yml for your vars. While creating the main.yml file for all of the vars your role defines seems to be best practice it isn't intuitive that you need to redefine that this role should use sudo.


sudo : yes

Thanks to Patrick Kuti for his tip in this ansible discussion for the solution.

Note too that vars in a role overrides inventory variables. If you want to document the defined variables use roles/role/defaults/main.yml instead.


No comments:

Post a Comment