diff --git a/tasks/general/cron/ansible.yml b/tasks/general/cron/ansible.yml index df6eafa..f3307ad 100644 --- a/tasks/general/cron/ansible.yml +++ b/tasks/general/cron/ansible.yml @@ -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' }}"