ansible-pull cron jobs, log the output to the Reports folder rather than relying on cron to submit mail.

This commit is contained in:
me
2026-08-14 10:09:33 -07:00
parent 3ae1b49348
commit ee3339bb99
+8 -3
View File
@@ -7,12 +7,17 @@
# $RANDOM / 50 can be up to about 650 seconds, or ~11 minutes. # $RANDOM / 50 can be up to about 650 seconds, or ~11 minutes.
# $RANDOM / 100 can be up to about 320 seconds, or ~5 minutes. # $RANDOM / 100 can be up to about 320 seconds, or ~5 minutes.
# This prevents multiple systems from hitting it at the exact same time. # This prevents multiple systems from hitting it at the exact same time.
- name: General | Cron | Ansible | Facts
set_fact:
ansible_cron_log: "/home/{{ user }}/Reports/ansible-pull.latest.log"
- name: General | Cron | Ansible | Create Subscriber Job - name: General | Cron | Ansible | Create Subscriber Job
cron: cron:
user: ansible user: ansible
name: "Ansible Sync" name: "Ansible Sync"
minute: "*/30" minute: "*/30"
job: "bash -c 'sleep $(( $RANDOM / 20 )); sudo {{ ansible_pull_exec.stdout }} -v -o -U {{ git_repo_http }} --checkout {{ branch }}'" job: "bash -c 'sleep $(( $RANDOM / 20 )); sudo {{ ansible_pull_exec.stdout }} -v -o -U {{ git_repo_http }} --checkout {{ branch }} >{{ ansible_cron_log }} 2>&1'"
state: present state: present
disabled: "{{ 'yes' if no_telem else 'no' }}" disabled: "{{ 'yes' if no_telem else 'no' }}"
@@ -20,7 +25,7 @@
cron: cron:
user: ansible user: ansible
name: "Ansible Weekly Forced Sync" name: "Ansible Weekly Forced Sync"
special_time: daily special_time: weekly
job: "bash -c 'sleep $(( $RANDOM / 1 )); sudo {{ ansible_pull_exec.stdout }} -v -U {{ git_repo_http }} --checkout {{ branch }}'" job: "bash -c 'sleep $(( $RANDOM / 1 )); sudo {{ ansible_pull_exec.stdout }} -v -U {{ git_repo_http }} --checkout {{ branch }} >{{ ansible_cron_log }} 2>&1'"
state: present state: present
disabled: "{{ 'yes' if no_telem else 'no' }}" disabled: "{{ 'yes' if no_telem else 'no' }}"