From 26c46bfb96807385958703361da5609dce3c87c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Sat, 18 Aug 2018 09:41:59 +0200 Subject: [PATCH] evocheck: the crontab is updated by the role --- CHANGELOG.md | 1 + evocheck/README.md | 1 + evocheck/defaults/main.yml | 1 + evocheck/tasks/cron.yml | 25 +++++++++++++++++++++++++ evocheck/tasks/main.yml | 3 +++ 5 files changed, 31 insertions(+) create mode 100644 evocheck/tasks/cron.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 36df5a50..494f78d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The **patch** part changes incrementally at each release. * elasticsearch: add http.publish_host variable * evoacme: disable old certbot cron also in cron.daily * evocheck: detect installed packages even if "held" by APT (manual fix) +* evocheck: the crontab is updated by the role (default: `True`) * evolinux-base: add mail related aliases * generate-ldif: detect installed packages even if "held" by APT * java: support for Oracle JRE diff --git a/evocheck/README.md b/evocheck/README.md index b669fe54..807b9a44 100644 --- a/evocheck/README.md +++ b/evocheck/README.md @@ -18,3 +18,4 @@ A separate `exec.yml` file can be imported manually in playbooks or roles to exe We can force install via : * `evocheck_force_install: local` : will copy the script provided by the role * `evocheck_force_install: package` : will install the package via repositories +* `evocheck_update_crontab` : will update the crontab (default: `True`) diff --git a/evocheck/defaults/main.yml b/evocheck/defaults/main.yml index 565849e3..e2d80c2a 100644 --- a/evocheck/defaults/main.yml +++ b/evocheck/defaults/main.yml @@ -1,3 +1,4 @@ --- evocheck_force_install: False +evocheck_update_crontab: True evocheck_bin_dir: /usr/share/scripts diff --git a/evocheck/tasks/cron.yml b/evocheck/tasks/cron.yml new file mode 100644 index 00000000..eb45fb2a --- /dev/null +++ b/evocheck/tasks/cron.yml @@ -0,0 +1,25 @@ +--- + +- name: evocheck runs normally on first day of month + cron: + cron_file: evocheck + month: "*" + weekday: "*" + day: "1" + hour: "1" + minute: "33" + user: "root" + job: "/usr/share/scripts/evocheck.sh" + state: present + +- name: evocheck runs with --cron on all other days of month + cron: + cron_file: evocheck + month: "*" + weekday: "*" + day: "2-31" + hour: "1" + minute: "33" + user: "root" + job: "/usr/share/scripts/evocheck.sh --cron" + state: present diff --git a/evocheck/tasks/main.yml b/evocheck/tasks/main.yml index 769dbbfe..0e374b92 100644 --- a/evocheck/tasks/main.yml +++ b/evocheck/tasks/main.yml @@ -5,3 +5,6 @@ - include: install_package.yml when: evocheck_force_install == "package" + +- include: cron.yml + when: evocheck_update_crontab