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