diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba6d390 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.galaxy_install_info diff --git a/defaults/main.yaml b/defaults/main.yaml index 2e764a4..82e242e 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -9,10 +9,12 @@ wireguard_ui_systemd_unit_name: "{{ wireguard_ui_container_name }}.service" wireguard_ui_watcher_systemd_service_unit_name: "{{ wireguard_ui_container_name }}-watcher.service" wireguard_ui_watcher_systemd_path_unit_name: "{{ wireguard_ui_container_name }}-watcher.path" +#wireguard_ui_volumes: {} wireguard_ui_default_volumes: - - "/etc/wireguard:/etc/wireguard:Z" - - "{{ wireguard_ui_config_dir }}:/app/db:Z" + '/etc/wireguard': /etc/wireguard:Z + '{{ wireguard_ui_config_dir }}': /app/db:Z +#wireguard_ui_env: {} wireguard_ui_default_env: WGUI_USERNAME: admin WGUI_PASSWORD: admin diff --git a/tasks/RedHat/podman.yaml b/tasks/RedHat/podman.yaml index 37e342a..95e00f8 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 - name: Generate container systemd unit diff --git a/tasks/main.yaml b/tasks/main.yaml index 7fc6cdc..50d20a8 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -12,9 +12,14 @@ - "vars" tags: wireguard_ui_vars -- set_fact: - wireguard_ui_combined_env: "{{ wireguard_ui_default_env | combine(wireguard_ui_env, recursive=true) }}" - wireguard_ui_combined_volumes: "{{ wireguard_ui_default_volumes | combine(wireguard_ui_volumes, recursive=true) }}" +- name: Merge volumes + set_fact: + wireguard_ui_volumes: "{{ wireguard_ui_volumes|default([]) + [item.key +':'+ item.value] }}" + loop: "{{ wireguard_ui_default_volumes | dict2items }}" + +- name: Merge ENV + set_fact: + wireguard_ui_env: "{{ wireguard_ui_env | default({}) | combine(wireguard_ui_default_env, recursive=true) }}" - name: "Install WireGuard UI for {{ ansible_facts['os_family'] }}" include_tasks: "{{ ansible_facts['os_family'] }}/main.yaml"