aboutsummaryrefslogtreecommitdiffstats
path: root/roles/systemd_timer/README.md
blob: 8eb518c96970d0557a3a5b635ca7e169c7d6972e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Systemd Timer
=============

Description
-----------

The `systemd_timer` role creates a systemd timer to run a specified command.
The command can either be passed directly to `exec`, or be run within the shell.


Variables
---------

This role **accepts** the following variables:

Variable            | Default                        | Description
--------------------|--------------------------------|------------
`timer_name`        |                           | Name of systemd unit
`timer_description` | `name` of timer                | Description of systemd unit
`timer_enabled`     | yes                            | Enable the timer unit
`timer_after`       |                           | Systemd units to run before timer (space-separated or list, see [documentation](https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before=))
`timer_persistent`  | yes                            | Persist timer across reboots (see [documentation](https://www.freedesktop.org/software/systemd/man/systemd.timer.html#Persistent=))
`timer_user`        | `root`                         | Unix user that executes the command
`timer_group`       |                           | Unix group that executes the command
`timer_chdir`       |                           | Systemd `WorkingDirectory` (see [documentation](https://www.freedesktop.org/software/systemd/man/systemd.exec.html#WorkingDirectory=))
`timer_exec`        |                           | Command to run
`timer_shell`       | no                             | Run command within a shell


Usage
-----

Example task:

````yaml
- name: create timer to update invidious
  include_role:
    name: systemd_timer
  vars:
    timer_name: invidious-update
    timer_description: Update invidious
    timer_after: network.target
    timer_on_calendar: weekly
    timer_exec: /opt/invidious/invidious-update.sh
````