blob: 06a0a8a7a1a5990907a109505e6d8b9804213a7e (
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
|
- name: Edit systemd service definition
become: true
block:
- name: 'Create override directory: {{ service_name }}'
ansible.builtin.file:
path: '/etc/systemd/system/{{ service_name }}.service.d'
state: directory
- name: 'Set up override: {{ 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
register: overridden
- name: 'Restart service: {{ service_name }}'
ansible.builtin.systemd_service:
daemon_reload: true
name: '{{ service_name }}'
state: restarted
when: overridden.changed
|