blob: 98dbd2722050b6c56149d6c9d05cb33e30715c3e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
- name: Edit systemd service
become: true
block:
- name: 'Create override directory: {{ service_name }}'
ansible.builtin.file:
path: '/etc/systemd/system/{{ service_name }}.service.d'
state: directory
owner: root
group: root
mode: '755'
- name: 'Set up override.conf: {{ service_name }}'
community.general.ini_file:
dest: '/etc/systemd/system/{{ service_name }}.service.d/override.conf'
section: '{{ service_section }}'
option: '{{ service_option }}'
values: '{{ service_values }}'
no_extra_spaces: true
owner: root
group: root
mode: '644'
register: overridden
- name: 'Restart service: {{ service_name }}'
ansible.builtin.systemd_service:
daemon_reload: true
name: '{{ service_name }}'
state: restarted
when: overridden.changed
|