apt: check if cron is installed before adding a cron job

This commit is contained in:
Jérémy Lecour 2019-09-30 14:12:38 +02:00 committed by Jérémy Lecour
parent eec8aef129
commit a478c773eb
2 changed files with 9 additions and 0 deletions

View file

@ -11,6 +11,7 @@ The **patch** part changes incrementally at each release.
## [Unreleased] ## [Unreleased]
### Added ### Added
* apt: check if cron is installed before adding a cron job
* certbot : new role to install and configure certbot * certbot : new role to install and configure certbot
* evocheck: explicit PATH * evocheck: explicit PATH
* evolinux-base: On debian 10 and later, add noexec on /dev/shm * evolinux-base: On debian 10 and later, add noexec on /dev/shm

View file

@ -55,6 +55,13 @@
tags: tags:
- apt - apt
- name: Check if Cron is installed
shell: "dpkg --list 'cron' 2>/dev/null | grep -q -E '^(i|h)i'"
register: is_cron
changed_when: false
failed_when: false
check_mode: no
- name: Check for held packages (script) - name: Check for held packages (script)
cron: cron:
cron_file: apt-hold-packages cron_file: apt-hold-packages
@ -67,5 +74,6 @@
day: "{{ apt_check_hold_cron_day }}" day: "{{ apt_check_hold_cron_day }}"
month: "{{ apt_check_hold_cron_month }}" month: "{{ apt_check_hold_cron_month }}"
state: "present" state: "present"
when: is_cron.rc == 0
tags: tags:
- apt - apt