mirror of
https://gitea.0xace.cc/ansible-galaxy/wireguard-ui.git
synced 2024-11-24 23:36:41 +00:00
fix deploy and bump to 0.4.0
This commit is contained in:
parent
352428ce8c
commit
fd0c675ce6
@ -5,7 +5,7 @@ wireguard_ui_network_mode: "host"
|
||||
wireguard_ui_config_dir: "/opt/{{ wireguard_ui_container_name }}"
|
||||
wireguard_ui_container_registry: "{{ container_registry | default(docker_registry) | default('docker.io') }}"
|
||||
wireguard_ui_image_name: "ngoduykhanh/wireguard-ui"
|
||||
wireguard_ui_image_tag: "0.3.7"
|
||||
wireguard_ui_image_tag: "0.4.0"
|
||||
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"
|
||||
@ -17,13 +17,14 @@ wireguard_ui_default_volumes:
|
||||
|
||||
#wireguard_ui_env: {}
|
||||
wireguard_ui_default_env:
|
||||
WGUI_USERNAME: admin
|
||||
WGUI_PASSWORD: admin
|
||||
WGUI_MTU: 1420
|
||||
BIND_ADDRESS: 127.0.0.1:5001
|
||||
SESSION_SECRET: 74f8155b3c91437db6e6c29c28e23ecc
|
||||
WGUI_CONFIG_FILE_PATH: /etc/wireguard/wg0.conf
|
||||
BASE_PATH: /
|
||||
WGUI_USERNAME: "admin"
|
||||
WGUI_PASSWORD: "admin"
|
||||
WGUI_MTU: "1420"
|
||||
WGUI_SERVER_INTERFACE_ADDRESSES: "10.252.1.1/24"
|
||||
BIND_ADDRESS: "127.0.0.1:5001"
|
||||
SESSION_SECRET: "74f8155b3c91437db6e6c29c28e23ecc"
|
||||
WGUI_CONFIG_FILE_PATH: "/etc/wireguard/wg0.conf"
|
||||
BASE_PATH: "/"
|
||||
|
||||
# Example for auth
|
||||
#wireguard_ui_container_registry_auth:
|
||||
|
@ -8,7 +8,7 @@
|
||||
detach: true
|
||||
restart_policy: unless-stopped
|
||||
env: "{{ wireguard_ui_combined_env }}"
|
||||
volumes: "{{ wireguard_ui_combined_volumes }}"
|
||||
volumes: "{{ wireguard_ui_volumes }}"
|
||||
when:
|
||||
- wireguard_ui_container_engine == 'docker'
|
||||
- not wireguard_ui_container.changed
|
||||
@ -23,7 +23,7 @@
|
||||
state: started
|
||||
restart: yes
|
||||
env: "{{ wireguard_ui_combined_env }}"
|
||||
volumes: "{{ wireguard_ui_combined_volumes }}"
|
||||
volumes: "{{ wireguard_ui_volumes }}"
|
||||
when:
|
||||
- wireguard_ui_container_engine == 'podman'
|
||||
- not wireguard_ui_container.changed
|
||||
|
@ -11,10 +11,20 @@
|
||||
loop: '{{ wireguard_ui_container_registry_auth | dict2items }}'
|
||||
when: wireguard_ui_container_registry_auth is defined
|
||||
|
||||
- name: Create configuration dir for WireGuard UI
|
||||
- name: Create configuration dir and subdirs for WireGuard UI
|
||||
file:
|
||||
name: "{{ wireguard_ui_config_dir }}"
|
||||
name: "{{ item }}"
|
||||
state: directory
|
||||
loop:
|
||||
- "{{ wireguard_ui_config_dir }}"
|
||||
- "{{ wireguard_ui_config_dir }}/server"
|
||||
|
||||
- name: Force login and password change
|
||||
template:
|
||||
dest: "{{ wireguard_ui_config_dir }}/server/users.json"
|
||||
src: users.json.j2
|
||||
register: wireguard_ui_auth
|
||||
notify: Restart WireGuard UI with podman
|
||||
|
||||
- name: Create WireGuard UI with podman
|
||||
containers.podman.podman_container:
|
||||
@ -23,18 +33,13 @@
|
||||
network_mode: "{{ wireguard_ui_network_mode }}"
|
||||
image: "{{ wireguard_ui_container_registry }}/{{ wireguard_ui_image_name }}:{{ wireguard_ui_image_tag }}"
|
||||
state: created
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
env: "{{ wireguard_ui_combined_env }}"
|
||||
volumes: "{{ wireguard_ui_combined_volumes }}"
|
||||
volumes: "{{ wireguard_ui_volumes }}"
|
||||
register: wireguard_ui_container
|
||||
notify: Restart WireGuard UI with podman
|
||||
|
||||
- name: Force login and password change
|
||||
template:
|
||||
dest: "{{ wireguard_ui_config_dir }}/server/users.json"
|
||||
src: users.json.j2
|
||||
register: wireguard_ui_auth
|
||||
notify: Restart WireGuard UI with podman
|
||||
|
||||
- name: Generate container systemd unit
|
||||
shell: "podman generate systemd {{ wireguard_ui_container_name }}"
|
||||
register: wireguard_ui_systemd_unit
|
||||
|
@ -49,6 +49,6 @@
|
||||
|
||||
- name: Enable wg-quick systemd unit
|
||||
systemd:
|
||||
name: wg-quick@{{ wireguard_ui_env['WGUI_CONFIG_FILE_PATH'] | basename | split('.') | first }}
|
||||
name: wg-quick@{{ wireguard_ui_combined_env['WGUI_CONFIG_FILE_PATH'] | basename | split('.') | first }}
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
- name: Merge volumes
|
||||
set_fact:
|
||||
wireguard_ui_combined_volumes: "{{ wireguard_ui_volumes | default([]) + [item.key +':'+ item.value] }}"
|
||||
wireguard_ui_volumes: "{{ wireguard_ui_volumes | default([]) + [item.key +':'+ item.value] }}"
|
||||
loop: "{{ wireguard_ui_default_volumes | dict2items }}"
|
||||
|
||||
- name: Merge ENV
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"username": "{{ wireguard_ui_env['WGUI_USERNAME'] }}",
|
||||
"password": "{{ wireguard_ui_env['WGUI_PASSWORD'] }}"
|
||||
"username": "{{ wireguard_ui_combined_env['WGUI_USERNAME'] }}",
|
||||
"password": "{{ wireguard_ui_combined_env['WGUI_PASSWORD'] }}"
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
[Unit]
|
||||
Description=Watch {{ wireguard_ui_env['WGUI_CONFIG_FILE_PATH'] }} for changes
|
||||
Description=Watch {{ wireguard_ui_combined_env['WGUI_CONFIG_FILE_PATH'] }} for changes
|
||||
|
||||
[Path]
|
||||
PathModified={{ wireguard_ui_env['WGUI_CONFIG_FILE_PATH'] }}
|
||||
PathModified={{ wireguard_ui_combined_env['WGUI_CONFIG_FILE_PATH'] }}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -4,7 +4,7 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/systemctl restart wg-quick@{{ wireguard_ui_env['WGUI_CONFIG_FILE_PATH'] | basename | split('.') | first }}.service
|
||||
ExecStart=/usr/bin/systemctl restart wg-quick@{{ wireguard_ui_combined_env['WGUI_CONFIG_FILE_PATH'] | basename | split('.') | first }}.service
|
||||
|
||||
[Install]
|
||||
RequiredBy={{ wireguard_ui_watcher_systemd_path_unit_name }}
|
||||
|
Loading…
Reference in New Issue
Block a user