ansible-pull cron jobs, log the output to the Reports folder rather than relying on cron to submit mail.
This commit is contained in:
@@ -7,12 +7,17 @@
|
||||
# $RANDOM / 50 can be up to about 650 seconds, or ~11 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.
|
||||
|
||||
- name: General | Cron | Ansible | Facts
|
||||
set_fact:
|
||||
ansible_cron_log: "/home/{{ user }}/Reports/ansible-pull.latest.log"
|
||||
|
||||
- name: General | Cron | Ansible | Create Subscriber Job
|
||||
cron:
|
||||
user: ansible
|
||||
name: "Ansible Sync"
|
||||
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
|
||||
disabled: "{{ 'yes' if no_telem else 'no' }}"
|
||||
|
||||
@@ -20,7 +25,7 @@
|
||||
cron:
|
||||
user: ansible
|
||||
name: "Ansible Weekly Forced Sync"
|
||||
special_time: daily
|
||||
job: "bash -c 'sleep $(( $RANDOM / 1 )); sudo {{ ansible_pull_exec.stdout }} -v -U {{ git_repo_http }} --checkout {{ branch }}'"
|
||||
special_time: weekly
|
||||
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
|
||||
disabled: "{{ 'yes' if no_telem else 'no' }}"
|
||||
|
||||
Reference in New Issue
Block a user