Skip to content

Commit

Permalink
[debops.rsyslog] Fix setting perimssions on /var/log
Browse files Browse the repository at this point in the history
The command to update directory and file permissions only changed the
permissions on /var/log if the group was not correct. If the group was
correct but the permissions were wrong, the permissions were not fixed.
As the group for /var/log is already fixed when creating the the system
group, the permissions stayed wrong.

This is fixed by adding an independent check for the permissions and
fixing them if they don't match.
  • Loading branch information
gaudenz committed Nov 7, 2019
1 parent 0910c17 commit e7c24d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ansible/roles/debops.rsyslog/tasks/main.yml
Expand Up @@ -45,8 +45,9 @@
shell: |
[ ! -d {{ rsyslog__home }} ] \
|| ( [ "$(stat -c '%G' {{ rsyslog__home }})" = "{{ rsyslog__group }}" ] \
|| ( chown -v root:{{ rsyslog__group }} {{ rsyslog__home }} ; \
chmod -v 775 {{ rsyslog__home }} ) )
|| chown -v root:{{ rsyslog__group }} {{ rsyslog__home }} ; \
[ "$(stat -c '%a' {{ rsyslog__home }})" = "775" ] \
|| chmod -v 775 {{ rsyslog__home }} )
for i in {{ rsyslog__default_logfiles | join(" ") }} ; do
[ ! -f ${i} ] || \
( [ "$(stat -c '%U' ${i})" = "{{ rsyslog__file_owner }}" ] \
Expand Down

0 comments on commit e7c24d7

Please sign in to comment.