From 0261e875679f1bf63c8d689da7fc7e014597885d Mon Sep 17 00:00:00 2001 From: Stonewall Jackson Date: Sat, 4 Feb 2023 01:23:43 -0500 Subject: initial commit --- .../templates/etc/systemd/system/task.service.j2 | 23 ++++++++++++++++++++++ .../templates/etc/systemd/system/task.timer.j2 | 9 +++++++++ 2 files changed, 32 insertions(+) create mode 100644 roles/systemd_timer/templates/etc/systemd/system/task.service.j2 create mode 100644 roles/systemd_timer/templates/etc/systemd/system/task.timer.j2 (limited to 'roles/systemd_timer/templates') diff --git a/roles/systemd_timer/templates/etc/systemd/system/task.service.j2 b/roles/systemd_timer/templates/etc/systemd/system/task.service.j2 new file mode 100644 index 0000000..307c112 --- /dev/null +++ b/roles/systemd_timer/templates/etc/systemd/system/task.service.j2 @@ -0,0 +1,23 @@ +[Unit] +Description={{ timer_description | default(timer_name) }} +{% if timer_after is defined %} +After={{ timer_after if timer_after is string else (timer_after | join(' ')) }} +{% endif %} + +[Service] +Type=oneshot +User={{ timer_user }} +{% if timer_group is defined %} +Group={{ timer_group }} +{% endif %} +{% if timer_chdir is defined %} +WorkingDirectory={{ timer_chdir }} +{% endif %} +{% if timer_shell %} +ExecStart=/bin/bash -Eeu -o pipefail -c {{ timer_exec | replace('%', '%%') | replace('$', '$$') | replace('\\', '\\\\') | quote }} +{% else %} +ExecStart={{ timer_exec | replace('%', '%%') | replace(';', '\;') }} +{% endif %} + +[Install] +WantedBy=multi-user.target diff --git a/roles/systemd_timer/templates/etc/systemd/system/task.timer.j2 b/roles/systemd_timer/templates/etc/systemd/system/task.timer.j2 new file mode 100644 index 0000000..0e0adc8 --- /dev/null +++ b/roles/systemd_timer/templates/etc/systemd/system/task.timer.j2 @@ -0,0 +1,9 @@ +[Unit] +Description={{ timer_description | default(timer_name) }} on calendar interval + +[Timer] +OnCalendar={{ timer_on_calendar }} +Persistent={{ timer_persistent | bool | to_json }} + +[Install] +WantedBy=timers.target -- cgit