aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/systemd_depend_mount/tasks/main.yml
blob: d759b0037918961a3c3ee525f95207b6d0bfc047 (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
- name: Create override directory
  become: true
  ansible.builtin.file:
    path: '/etc/systemd/system/{{ service }}.service.d'
    state: directory
    owner: root
    group: root
    mode: '755'
  loop: '{{ systemd_depend_mount_services }}'
  loop_control:
    loop_var: service

- name: Create service override
  become: true
  ansible.builtin.template:
    src: override.conf.j2
    dest: '/etc/systemd/system/{{ service }}.service.d/depend_mount_{{ systemd_depend_mount_dir | regex_replace("/", "_") }}.conf'
    owner: root
    group: root
    mode: '644'
  register: systemd_depend_mount_result
  notify: systemd_depend_mount_restart
  loop: '{{ systemd_depend_mount_services }}'
  loop_control:
    loop_var: service

- name: Restart systemd services if necessary
  ansible.builtin.meta: flush_handlers