Create systemd timers for tasks

Signed-off-by: Lenka Segura <lsegura@redhat.com>
This commit is contained in:
Lenka Segura 2024-05-28 14:39:37 +02:00 committed by zlopez
parent 824aa681fc
commit 73612b973a
16 changed files with 159 additions and 0 deletions

View file

@ -0,0 +1,7 @@
[Unit]
Description=hyperkitty daily maintenance
[Service]
Type=oneshot
User=mailman
ExecStart=mailman-web runjobs daily

View file

@ -0,0 +1,8 @@
[Unit]
Description=Run hyperkitty daily maintenance every day
Requires=hyperkitty.target
PartOf=hyperkitty.target
[Timer]
OnCalendar=*-*-* 00:00:00
RandomizedDelaySec=1h

View file

@ -0,0 +1,7 @@
[Unit]
Description=hyperkitty hourly maintenance
[Service]
Type=oneshot
User=mailman
ExecStart=mailman-web runjobs hourly

View file

@ -0,0 +1,8 @@
[Unit]
Description=Run hyperkitty hourly maintenance every hour
Requires=hyperkitty.target
PartOf=hyperkitty.target
[Timer]
OnCalendar=*-*-* *:00:00
RandomizedDelaySec=10m

View file

@ -0,0 +1,7 @@
[Unit]
Description=hyperkitty minutely maintenance
[Service]
Type=oneshot
User=mailman
ExecStart=mailman-web runjobs minutely

View file

@ -0,0 +1,7 @@
[Unit]
Description=Run hyperkitty minutely maintenance every minute
Requires=hyperkitty.target
PartOf=hyperkitty.target
[Timer]
OnCalendar=*-*-* *:*:00

View file

@ -0,0 +1,7 @@
[Unit]
Description=hyperkitty monthly maintenance
[Service]
Type=oneshot
User=mailman
ExecStart=mailman-web runjobs monthly

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run hyperkitty monthly maintenance every month
Requires=hyperkitty.target
PartOf=hyperkitty.target
[Timer]
OnCalendar=*-*-01 00:00:00
RandomizedDelaySec=6h
Persistent=true

View file

@ -0,0 +1,7 @@
[Unit]
Description=hyperkitty maintenance every 15 minutes
[Service]
Type=oneshot
User=mailman
ExecStart=mailman-web runjobs quarter_hourly

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run hyperkitty maintenance every 15 minutes
Requires=hyperkitty.target
PartOf=hyperkitty.target
[Timer]
OnCalendar=*-*-* *:*/15:00
Persistent=true
RandomizedDelaySec=5m

View file

@ -0,0 +1,7 @@
[Unit]
Description=hyperkitty weekly maintenance
[Service]
Type=oneshot
User=mailman
ExecStart=mailman-web runjobs weekly

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run hyperkitty weekly maintenance every week
Requires=hyperkitty.target
PartOf=hyperkitty.target
[Timer]
OnCalendar=Mon *-*-* 00:00:00
RandomizedDelaySec=3h
Persistent=true

View file

@ -0,0 +1,7 @@
[Unit]
Description=hyperkitty yearly maintenance
[Service]
Type=oneshot
User=mailman
ExecStart=mailman-web runjobs yearly

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run hyperkitty yearly maintenance every year
Requires=hyperkitty.target
PartOf=hyperkitty.target
[Timer]
OnCalendar=*-01-01 00:00:00
RandomizedDelaySec=12h
Persistent=true

View file

@ -0,0 +1,13 @@
[Unit]
Description=hyperkitty timed maintenance
After=mailman3.service
Wants=hyperkitty-minutely.timer
Wants=hyperkitty-quarter_hourly.timer
Wants=hyperkitty-hourly.timer
Wants=hyperkitty-daily.timer
Wants=hyperkitty-monthly.timer
Wants=hyperkitty-weekly.timer
Wants=hyperkitty-yearly.timer
[Install]
WantedBy=timers.target

View file

@ -450,6 +450,44 @@
- mailman
- systemd
- name: Install the systemd cron services
ansible.builtin.file:
src: "systemd/{{ item }}.service"
dest: "/etc/systemd/system/{{ item }}.service"
with_items:
- hyperkitty-daily
- hyperkitty-hourly
- hyperkitty-minutely
- hyperkitty-monthly
- hyperkitty-quarter_hourly
- hyperkitty-weekly
- hyperkitty-yearly
notify:
- systemctl daemon-reload
tags:
- config
- mailman
- systemd
- name: Install the systemd timers
ansible.builtin.file:
src: "systemd/{{ item }}.timer"
dest: "/etc/systemd/system/{{ item }}.timer"
with_items:
- hyperkitty-daily
- hyperkitty-hourly
- hyperkitty-minutely
- hyperkitty-monthly
- hyperkitty-quarter_hourly
- hyperkitty-weekly
- hyperkitty-yearly
notify:
- systemctl daemon-reload
tags:
- config
- mailman
- systemd
# Memcached
- name: Set the memcached sysconfig file
ansible.builtin.copy: