diff --git a/handlers/main.yaml b/handlers/main.yaml index 0bf54b3..058211f 100644 --- a/handlers/main.yaml +++ b/handlers/main.yaml @@ -7,8 +7,8 @@ container_default_behavior: no_defaults detach: true restart_policy: unless-stopped - env: "{{ wireguard_ui_combined_env }}" - volumes: "{{ wireguard_ui_combined_volumes }}" + env: "{{ wireguard_ui_env }}" + volumes: "{{ wireguard_ui_volumes }}" when: - wireguard_ui_container_engine == 'docker' - not wireguard_ui_container.changed @@ -21,8 +21,8 @@ image: "{{ wireguard_ui_container_registry }}/{{ wireguard_ui_image_name }}:{{ wireguard_ui_image_tag }}" state: started restart: yes - env: "{{ wireguard_ui_combined_env }}" - volumes: "{{ wireguard_ui_combined_volumes }}" + env: "{{ wireguard_ui_env }}" + volumes: "{{ wireguard_ui_volumes }}" when: - wireguard_ui_container_engine == 'podman' - not wireguard_ui_container.changed diff --git a/tasks/RedHat/podman.yaml b/tasks/RedHat/podman.yaml index 0fb7c9f..e2f0cba 100644 --- a/tasks/RedHat/podman.yaml +++ b/tasks/RedHat/podman.yaml @@ -23,8 +23,8 @@ network_mode: "{{ wireguard_ui_network_mode }}" image: "{{ wireguard_ui_container_registry }}/{{ wireguard_ui_image_name }}:{{ wireguard_ui_image_tag }}" state: created - env: "{{ wireguard_ui_combined_env }}" - volumes: "{{ wireguard_ui_combined_volumes }}" + env: "{{ wireguard_ui_env }}" + volumes: "{{ wireguard_ui_volumes }}" register: wireguard_ui_container notify: Restart WireGuard UI with podman diff --git a/tasks/main.yaml b/tasks/main.yaml index 9a15232..214df5f 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -14,12 +14,12 @@ - name: Merge volumes set_fact: - wireguard_ui_combined_volumes: "{{ wireguard_ui_default_volumes | default({}) + [item.key +':'+ item.value] }}" - loop: "{{ wireguard_ui_volumes | default({}) | dict2items }}" + wireguard_ui_volumes: "{{ wireguard_ui_volumes | default([]) + [item.key +':'+ item.value] }}" + loop: "{{ wireguard_ui_default_volumes | dict2items }}" - name: Merge ENV set_fact: - wireguard_ui_combined_env: "{{ wireguard_ui_default_env | combine(wireguard_ui_env, recursive=true) }}" + wireguard_ui_env: "{{ wireguard_ui_default_env | combine(wireguard_ui_env | default({}), recursive=true) }}" - name: "Install WireGuard UI for {{ ansible_facts['os_family'] }}" include_tasks: "{{ ansible_facts['os_family'] }}/main.yaml"