Closed bekriebel closed 2 years ago
I've confirmed that the change works locally.
It this what you had in mind? https://github.com/nleiva/ansible-role-grafana_agent/commit/40b9a05e6f5f211e0c47c3426e5de6cfcd4a2a2a
Yep, that should do the trick 🙂
Because the configuration directory is set to recursively set permissions to 0755: https://github.com/nleiva/ansible-role-grafana_agent/blob/da0febc2ad0f8710da422b7b6140d7b4b7f322fc/tasks/main.yml#L26 and the configuration file permissions are 0644: https://github.com/nleiva/ansible-role-grafana_agent/blob/da0febc2ad0f8710da422b7b6140d7b4b7f322fc/tasks/main.yml#L32
The role shows the directory and file tasks as changing every time the role is executed because the directory task sets the file permissions to 0755 and the template task sets them back to 0644. To fix this, the directory mode should be set using symbolic mode to set the directory to 0755 and files to 0644:
mode: u=rwX,g=rX,o=rX
. An example of this is here: https://stackoverflow.com/questions/28778738/ansible-mode-755-for-directories-and-644-for-files-recursively