Skip to content

Commit

Permalink
fix: stat file first (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavSanchez authored Jun 6, 2024
1 parent 599fa1d commit 61f2039
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion caos.ansible_roles/roles/logrotate/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@
- include_tasks: "logrotate-{{ ansible_distribution }}.yaml"
when: ansible_distribution != "SLES"

- name: check state file exists on a certain location
stat:
path: "/var/lib/logrotate/status"
register: st

- name: make sure state file has the appropriate permissions
file:
state: "file"
path: "/var/lib/logrotate/status"
mode: "640"
when: st.exists

- name: force logrotate
shell: "[ -f {{ item }} ] && logrotate -f {{ item }}"
Expand Down

0 comments on commit 61f2039

Please sign in to comment.