ansible, add rotating of the log file.
This commit is contained in:
@@ -8,13 +8,37 @@
|
|||||||
# $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
|
- name: General | Cron | Ansible | Facts 01
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
#ansible_cron_log: "~/{{ ansible_hostname }}.ansible-pull.`date +'%Y%m%d-%H%M%S'`.log"
|
#ansible_cron_log: "~/{{ ansible_hostname }}.ansible-pull.`date +'%Y%m%d-%H%M%S'`.log"
|
||||||
ansible_cron_log: "~/{{ ansible_hostname }}.ansible-pull.log"
|
ansible_cron_log: "~/{{ ansible_hostname }}.ansible-pull.log"
|
||||||
|
|
||||||
|
- name: General | Cron | Ansible | Facts 02
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
ansible_cron_log_old: "{{ ansible_cron_log }}.old"
|
||||||
|
|
||||||
|
|
||||||
|
- name: General | Cron | Ansible | Log | Delete Old
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ ansible_cron_log_old }}"
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: General | Cron | Ansible | Log | Check
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "{{ ansible_cron_log }}"
|
||||||
|
register: ansible_cron_log_check
|
||||||
|
|
||||||
|
- name: General | Cron | Ansible | Log | Rename [if >1MB]
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ ansible_cron_log }}"
|
||||||
|
dest: "{{ ansible_cron_log_old }}"
|
||||||
|
mode: "0755"
|
||||||
|
when: ansible_cron_log_check.stat.exists
|
||||||
|
and ansible_cron_log_check.stat.size > 1000000
|
||||||
|
|
||||||
|
|
||||||
- name: General | Cron | Ansible | Create Subscriber Job
|
- name: General | Cron | Ansible | Create Subscriber Job
|
||||||
cron:
|
ansible.builtin.cron:
|
||||||
user: ansible
|
user: ansible
|
||||||
name: "Ansible Sync"
|
name: "Ansible Sync"
|
||||||
minute: "*/30"
|
minute: "*/30"
|
||||||
@@ -23,7 +47,7 @@
|
|||||||
disabled: "{{ 'yes' if no_telem else 'no' }}"
|
disabled: "{{ 'yes' if no_telem else 'no' }}"
|
||||||
|
|
||||||
- name: General | Cron | Ansible | Create Forced Weekly Subscriber Job
|
- name: General | Cron | Ansible | Create Forced Weekly Subscriber Job
|
||||||
cron:
|
ansible.builtin.cron:
|
||||||
user: ansible
|
user: ansible
|
||||||
name: "Ansible Weekly Forced Sync"
|
name: "Ansible Weekly Forced Sync"
|
||||||
special_time: weekly
|
special_time: weekly
|
||||||
|
|||||||
Reference in New Issue
Block a user