diff --git a/etc-git/files/etc-git-status.j2 b/etc-git/files/etc-git-status.j2 new file mode 100644 index 00000000..f4033a86 --- /dev/null +++ b/etc-git/files/etc-git-status.j2 @@ -0,0 +1,4 @@ +# {{ ansible_managed }} + +@hourly who > /dev/null || git --git-dir=/etc/.git --work-tree=/etc status --short +21 21 * * * git --git-dir=/etc/.git --work-tree=/etc status --short diff --git a/etc-git/tasks/main.yml b/etc-git/tasks/main.yml index d128a311..cfd0cca4 100644 --- a/etc-git/tasks/main.yml +++ b/etc-git/tasks/main.yml @@ -89,23 +89,11 @@ tags: - etc-git -- name: regularly check for uncommited changes (if no one is connected) - cron: - name: git-status-except-connected - special_time: "hourly" - user: root - job: "who > /dev/null || git --git-dir=/etc/.git --work-tree=/etc status --short" - state: "{{ etc_git_monitor_status | bool | ternary('present','absent') }}" - tags: - - etc-git - -- name: daily check for uncommited changes - cron: - name: git-status - user: root - hour: 21 - minute: 21 - job: "git --git-dir=/etc/.git --work-tree=/etc status --short" +- name: Cron job for /etc/.git status + template: + src: etc-git-status.j2 + dest: /etc/cron.d/etc-git-status + mode: "0644" state: "{{ etc_git_monitor_status | bool | ternary('present','absent') }}" tags: - etc-git