commit ede3979533fac4d3e9b33f3e62adb1cc28ea009b Author: neingeist Date: Sat Jan 23 23:03:12 2016 +0100 initial git commit diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..8b6e811 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1 @@ +- include: systemd-daemon-reload.yml diff --git a/handlers/systemd-daemon-reload.yml b/handlers/systemd-daemon-reload.yml new file mode 100644 index 0000000..a1baeec --- /dev/null +++ b/handlers/systemd-daemon-reload.yml @@ -0,0 +1,3 @@ +--- +- name: systemd-daemon-reload + shell: systemctl daemon-reload diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..bdaa5cf --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,12 @@ +- template: + src=touch-file.service.j2 + dest=/etc/systemd/system/touch-file-{{ file|replace('/', '-') }}.service + notify: systemd-daemon-reload + +- template: + src=touch-file.timer.j2 + dest=/etc/systemd/system/touch-file-{{ file|replace('/', '-') }}.timer + notify: systemd-daemon-reload + +- service: + name=touch-file-{{ file|replace('/', '-') }}.timer state=started enabled=yes diff --git a/templates/touch-file.service.j2 b/templates/touch-file.service.j2 new file mode 100644 index 0000000..087a461 --- /dev/null +++ b/templates/touch-file.service.j2 @@ -0,0 +1,7 @@ +[Unit] +Description=Touch {{ file }} + +[Service] +Type=oneshot +User={{ user }} +ExecStart=/usr/bin/touch {{ file }} diff --git a/templates/touch-file.timer.j2 b/templates/touch-file.timer.j2 new file mode 100644 index 0000000..12ff591 --- /dev/null +++ b/templates/touch-file.timer.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=Touch {{ file }} regularly + +[Timer] +OnCalendar=hourly +AccuracySec=30m +Persistent=true +Unit=touch-file-{{ file | replace('/', '-') }}.service + +[Install] +WantedBy=multi-user.target +