Loop over separate things, fix typo and add conditionals
This commit is contained in:
parent
29497278df
commit
0ffb4ad724
|
@ -1,5 +1,5 @@
|
|||
- name: Run service actions
|
||||
loop: "{{ systemd }}"
|
||||
loop: "{{ systemd.services }}"
|
||||
systemd:
|
||||
name: '{{ item.name }}'
|
||||
enabled: "{% if item.enabled %}yes{% else %}no{% endif %}"
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
- name: Create override directories
|
||||
loop: "{{ systemd }}"
|
||||
loop: "{{ systemd.overrides }}"
|
||||
file:
|
||||
follow: yes
|
||||
path: "/etc/systemd/system/{{ item.name }}.service.d/"
|
||||
path: "/etc/systemd/system/{{ item }}.service.d/"
|
||||
state: directory
|
||||
- name: Template service overrides
|
||||
loop: "{{ systemd }}"
|
||||
when: (systemd.overrides| default([])) | length
|
||||
- name: Copy service overrides
|
||||
loop: "{{ systemd.overrides }}"
|
||||
template:
|
||||
follow: yes
|
||||
src: "{{ item.name }}.service.j2"
|
||||
dest: "/etc/systemd/system/{{ item.name }}.service.d/override.conf"
|
||||
handlers: Run service actions
|
||||
src: "{{ item }}.service.j2"
|
||||
dest: "/etc/systemd/system/{{ item }}.service.d/override.conf"
|
||||
notify: Run service actions
|
||||
when: (systemd.overrides| default([])) | length
|
||||
|
|
Reference in New Issue