diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-29 17:12:31 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-29 17:12:31 +0200 |
commit | 11abd588a614a574ebdb5e7fe099b920164b09f1 (patch) | |
tree | 8ffd89535ccae777eaa8f3862438a8f03a150677 | |
parent | v0.0.21 (diff) | |
download | infra-ansible-11abd588a614a574ebdb5e7fe099b920164b09f1.tar.gz infra-ansible-11abd588a614a574ebdb5e7fe099b920164b09f1.zip |
add dependent services to mount/network interface roles
-rw-r--r-- | roles/digitalocean_volume/defaults/main.yml | 4 | ||||
-rw-r--r-- | roles/digitalocean_volume/tasks/main.yml | 9 | ||||
-rw-r--r-- | roles/wireguard/defaults/main.yml | 2 | ||||
-rw-r--r-- | roles/wireguard/tasks/main.yml | 7 |
4 files changed, 20 insertions, 2 deletions
diff --git a/roles/digitalocean_volume/defaults/main.yml b/roles/digitalocean_volume/defaults/main.yml index 9c3a4e1..65d85f4 100644 --- a/roles/digitalocean_volume/defaults/main.yml +++ b/roles/digitalocean_volume/defaults/main.yml @@ -1,3 +1,5 @@ #digitalocean_volume_name: -#digitalocean_volume_dir: +digitalocean_volume_dir: '/mnt/{{ digitalocean_volume_name }}' digitalocean_volume_fs: ext4 + +digitalocean_volume_dependent_services: [] diff --git a/roles/digitalocean_volume/tasks/main.yml b/roles/digitalocean_volume/tasks/main.yml index f881e11..c3ef5b6 100644 --- a/roles/digitalocean_volume/tasks/main.yml +++ b/roles/digitalocean_volume/tasks/main.yml @@ -1,8 +1,15 @@ - name: 'Mount volume: {{ digitalocean_volume_name }}' become: true ansible.posix.mount: - path: "{{ digitalocean_volume_dir | default('/mnt/{{ digitalocean_volume_name }}') }}" + path: "{{ digitalocean_volume_dir }}" src: '/dev/disk/by-id/scsi-0DO_Volume_{{ digitalocean_volume_name }}' state: mounted fstype: '{{ digitalocean_volume_fs }}' opts: defaults,nofail,discard + +- name: Set up service dependencies + ansible.builtin.include_role: + name: systemd_depend_mount + vars: + systemd_depend_mount_dir: '{{ digitalocean_volume_dir }}' + systemd_depend_mount_services: '{{ digitalocean_volume_dependent_services }}' diff --git a/roles/wireguard/defaults/main.yml b/roles/wireguard/defaults/main.yml index 44120db..10af15c 100644 --- a/roles/wireguard/defaults/main.yml +++ b/roles/wireguard/defaults/main.yml @@ -5,3 +5,5 @@ wg_listen_port: 51280 #wg_addr6: #wg_peers: wg_router: false + +wg_dependent_services: [] diff --git a/roles/wireguard/tasks/main.yml b/roles/wireguard/tasks/main.yml index 5478c4f..279ffd0 100644 --- a/roles/wireguard/tasks/main.yml +++ b/roles/wireguard/tasks/main.yml @@ -27,3 +27,10 @@ enabled: true state: restarted when: config.changed + +- name: Set up service dependencies + ansible.builtin.include_role: + name: systemd_depend_iface + vars: + systemd_depend_iface_name: '{{ wg_name }}' + systemd_depend_iface_services: '{{ wg_dependent_services }}' |