From ede3979533fac4d3e9b33f3e62adb1cc28ea009b Mon Sep 17 00:00:00 2001 From: neingeist Date: Sat, 23 Jan 2016 23:03:12 +0100 Subject: [PATCH] initial git commit --- handlers/main.yml | 1 + handlers/systemd-daemon-reload.yml | 3 +++ tasks/main.yml | 12 ++++++++++++ templates/touch-file.service.j2 | 7 +++++++ templates/touch-file.timer.j2 | 12 ++++++++++++ 5 files changed, 35 insertions(+) create mode 100644 handlers/main.yml create mode 100644 handlers/systemd-daemon-reload.yml create mode 100644 tasks/main.yml create mode 100644 templates/touch-file.service.j2 create mode 100644 templates/touch-file.timer.j2 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 +