wireguard-ui/tasks/main.yaml

60 lines
1.6 KiB
YAML
Raw Normal View History

2022-07-13 11:51:25 +00:00
- name: Make sure handlers are flushed immediately
meta: flush_handlers
- name: Load a variable file based on the OS type
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts['distribution'] }}.yaml"
- "{{ ansible_facts['os_family'] }}.yaml"
paths:
- "vars"
tags: wireguard_ui_vars
2022-07-13 12:20:18 +00:00
- name: Merge volumes
set_fact:
2022-07-15 15:14:47 +00:00
wireguard_ui_combined_volumes: "{{ wireguard_ui_volumes | default([]) + [item.key +':'+ item.value] }}"
2022-07-13 18:44:35 +00:00
loop: "{{ wireguard_ui_default_volumes | dict2items }}"
2022-07-13 12:20:18 +00:00
- name: Merge ENV
set_fact:
2022-07-15 15:14:47 +00:00
wireguard_ui_combined_env: "{{ wireguard_ui_default_env | combine(wireguard_ui_env | default({}), recursive=true) }}"
2022-07-13 11:51:25 +00:00
- name: "Install WireGuard UI for {{ ansible_facts['os_family'] }}"
include_tasks: "{{ ansible_facts['os_family'] }}/main.yaml"
tags: wireguard_ui_install
2022-07-13 13:00:25 +00:00
- name: Enable and start WireGuard UI
2022-07-13 11:51:25 +00:00
systemd:
daemon_reload: true
name: "{{ item }}"
enabled: true
state: started
masked: no
loop:
- "{{ wireguard_ui_systemd_unit_name }}"
2022-07-13 13:00:25 +00:00
- name: Enable WireGuard UI watcher services
systemd:
daemon_reload: true
name: "{{ item }}"
enabled: true
masked: no
loop:
2022-07-13 11:51:25 +00:00
- "{{ wireguard_ui_watcher_systemd_service_unit_name }}"
- "{{ wireguard_ui_watcher_systemd_path_unit_name }}"
2022-07-13 13:00:25 +00:00
- name: Enable WireGuard UI path watcher service
systemd:
daemon_reload: true
name: "{{ item }}"
enabled: true
state: started
masked: no
loop:
- "{{ wireguard_ui_watcher_systemd_path_unit_name }}"
2022-07-13 11:51:25 +00:00
tags: wireguard_ui_start