blob: 8a08e6d8e1cdb1bd87b9ab949fb316e792d38328 (
plain) (
tree)
|
|
- 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
owner: root
group: root
mode: '755'
- 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
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
|