refactor: create service name base once (DRY)
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
|
||||
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
|
||||
|
Loading…
Reference in New Issue