From 5d66f6e5a75c894f85de6b7593b115f1d465fb23 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Fri, 1 May 2020 19:14:48 +0200 Subject: [PATCH] add custom cronjobs --- defaults/main.yml | 13 +++++++++++++ tasks/cron.yml | 16 ++++++++++++++++ tasks/main.yml | 1 + 3 files changed, 30 insertions(+) create mode 100644 tasks/cron.yml diff --git a/defaults/main.yml b/defaults/main.yml index b8864d8..4c911be 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -35,3 +35,16 @@ ucs_registry_extra: [] # - path: timeserver # value: "ntp.example.com" # state: present + +ucs_cronjobs: [] +# @var ucs_cronjobs:example: > +# ucs_cronjobs: +# - name: backup-cleanup +# job: "find /var/univention-backup -mtime +7 -delete" +# user: root +# minute: 0 +# hour: 3 +# day: "*" +# weekday: "*" +# month: "*" +# state: present diff --git a/tasks/cron.yml b/tasks/cron.yml new file mode 100644 index 0000000..c8d5eeb --- /dev/null +++ b/tasks/cron.yml @@ -0,0 +1,16 @@ +--- +- name: Setup custom cronjobs + cron: + name: "{{ item.name }}" + minute: "{{ item.minute | default(0) }}" + hour: "{{ item.hour | default(3) }}" + day: "{{ item.day | default('*') }}" + weekday: "{{ item.weekday | default('*') }}" + month: "{{ item.month | default('*') }}" + user: "{{ item.user | default('root') }}" + cron_file: univention-custom + job: "{{ item.job }}" + state: "{{ item.state | default('present') }}" + loop: "{{ ucs_cronjobs }}" + loop_control: + label: "{{ item.name }}" diff --git a/tasks/main.yml b/tasks/main.yml index ff6debe..0ac2e91 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,5 +2,6 @@ - include_tasks: registry.yml - include_tasks: users_groups.yml - include_tasks: filesystem.yml +- include_tasks: cron.yml - import_tasks: tls.yml tags: tls_renewal