From 2ca99cac3ff956962f963153927722b4c01e8a2b Mon Sep 17 00:00:00 2001 From: Salt Date: Tue, 11 Aug 2020 03:51:15 -0500 Subject: [PATCH] Switch to OnCalendar for ansible pull setups --- inventory/hosts.yml | 2 +- provision.yml | 2 +- roles/ansible-pull/defaults/main.yml | 3 ++- roles/ansible-pull/templates/ansible-pull.timer | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/inventory/hosts.yml b/inventory/hosts.yml index af3bf8d..2787f04 100644 --- a/inventory/hosts.yml +++ b/inventory/hosts.yml @@ -20,7 +20,7 @@ all: home: vars: ansible_user: ansible - ansible_pull_frequency: 8h + ansible_pull_time: "*-*-* 03:00:00" aws: backup_bucket: 9iron-backups-home backups_frequency: 1d diff --git a/provision.yml b/provision.yml index 0389ee6..d98a4d4 100755 --- a/provision.yml +++ b/provision.yml @@ -6,4 +6,4 @@ - role: common tags: [ common ] - role: ansible-pull - tags: [ common ] + tags: [ ansible, common ] diff --git a/roles/ansible-pull/defaults/main.yml b/roles/ansible-pull/defaults/main.yml index b04ad0d..82a248d 100644 --- a/roles/ansible-pull/defaults/main.yml +++ b/roles/ansible-pull/defaults/main.yml @@ -1,4 +1,5 @@ # vim:ft=ansible: ansible_pull_boot_delay: "15min" -ansible_pull_frequency: "12h" +# Use `systemd-analyze calendar` for testing +ansible_pull_time: "*-*-* 01:00:00" ansible_pull_playbook: "site.yml" diff --git a/roles/ansible-pull/templates/ansible-pull.timer b/roles/ansible-pull/templates/ansible-pull.timer index a664818..ea34077 100644 --- a/roles/ansible-pull/templates/ansible-pull.timer +++ b/roles/ansible-pull/templates/ansible-pull.timer @@ -5,7 +5,7 @@ Description=Ansible pull timer [Timer] Persistent=true OnBootSec={{ ansible_pull_boot_delay }} -OnUnitActiveSec={{ ansible_pull_frequency }} +OnCalendar={{ ansible_pull_time }} [Install] WantedBy=timers.target