diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-23 17:46:28 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-23 18:03:25 +0200 |
commit | 287264d1eefb311b472a5f0431ae012cf2033a26 (patch) | |
tree | e65a79c80c6fb741ac45e359ba32e6192acaf396 /roles/systemd_depend_mount/tasks | |
parent | digitalocean_volume: properly prefix variables (diff) | |
download | infra-ansible-287264d1eefb311b472a5f0431ae012cf2033a26.tar.gz infra-ansible-287264d1eefb311b472a5f0431ae012cf2033a26.zip |
replace systemd_requires_mounts_for with systemd_depend_mount
It should be better and more comprehensible.
Diffstat (limited to '')
-rw-r--r-- | roles/systemd_depend_mount/tasks/main.yml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/roles/systemd_depend_mount/tasks/main.yml b/roles/systemd_depend_mount/tasks/main.yml new file mode 100644 index 0000000..d759b00 --- /dev/null +++ b/roles/systemd_depend_mount/tasks/main.yml @@ -0,0 +1,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 |