From 78888615013b6750f3828d50e1b89c323a2deebf Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 11 Dec 2016 08:11:10 +0100 Subject: [PATCH] refactor: create service name base once (DRY) --- tasks/main.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 5214b5c..21b90d8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,15 +1,19 @@ +- name: set service name base + set_fact: + touch_file_service_name_base: "touch-file-{{ file|replace('/', '-') }}" + - name: create touch-file.service template: src=touch-file.service.j2 - dest=/etc/systemd/system/touch-file-{{ file|replace('/', '-') }}.service + dest=/etc/systemd/system/{{ touch_file_service_name_base }}.service notify: systemd-daemon-reload - name: create touch-file.timer template: src=touch-file.timer.j2 - dest=/etc/systemd/system/touch-file-{{ file|replace('/', '-') }}.timer + dest=/etc/systemd/system/{{ touch_file_service_name_base }}.timer notify: systemd-daemon-reload - name: enable touch-file.timer service: - name=touch-file-{{ file|replace('/', '-') }}.timer state=started enabled=yes + name={{ touch_file_service_name_base }}.timer state=started enabled=yes