refactor: create service name base once (DRY)

master
neingeist 8 years ago
parent 56a520f40c
commit 7888861501

@ -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 - name: create touch-file.service
template: template:
src=touch-file.service.j2 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 notify: systemd-daemon-reload
- name: create touch-file.timer - name: create touch-file.timer
template: template:
src=touch-file.timer.j2 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 notify: systemd-daemon-reload
- name: enable touch-file.timer - name: enable touch-file.timer
service: service:
name=touch-file-{{ file|replace('/', '-') }}.timer state=started enabled=yes name={{ touch_file_service_name_base }}.timer state=started enabled=yes

Loading…
Cancel
Save