Merge pull request #64 from corvus-migratorius/fix-wg-hub

Fix `wg_hub`
This commit is contained in:
Alexander Gorelyshev
2025-12-25 19:12:03 +04:00
committed by GitHub
2 changed files with 10 additions and 10 deletions

View File

@@ -11,13 +11,13 @@
wg_hub_hide_secrets: false wg_hub_hide_secrets: false
# dns_server: 127.0.0.1:5300 # doesn't work in Github Actions environment # dns_server: 127.0.0.1:5300 # doesn't work in Github Actions environment
peers: peers:
- wg_hub_host_id: alpha - host_id: alpha
wg_hub_ipv4_vpn_addr: 10.0.0.1 ipv4_vpn_addr: 10.0.0.1
wg_hub_wg_pubkey: LfEJgNiJ05nx4nWB0Pj3wS3WRyFq567fsdDh4XZqRF0= wg_pubkey: LfEJgNiJ05nx4nWB0Pj3wS3WRyFq567fsdDh4XZqRF0=
wg_psk: i3JCrQOfptZhgpL+BTm/65MPW/ljJexCgiuWMIqZJYo= wg_psk: i3JCrQOfptZhgpL+BTm/65MPW/ljJexCgiuWMIqZJYo=
- wg_hub_host_id: beta - host_id: beta
wg_hub_ipv4_vpn_addr: 10.0.0.2 ipv4_vpn_addr: 10.0.0.2
wg_hub_wg_pubkey: oq3Fcwwfxsi5f5UHcZKtxMwQ2aSeHOUe3r35soUUYzU= wg_pubkey: oq3Fcwwfxsi5f5UHcZKtxMwQ2aSeHOUe3r35soUUYzU=
wg_psk: Z/z7Qo8hW97UcImYE/ZbCxpNmizfVhvl0dzygtvtYYg= wg_psk: Z/z7Qo8hW97UcImYE/ZbCxpNmizfVhvl0dzygtvtYYg=
roles: roles:

View File

@@ -29,7 +29,7 @@
PreUp = sysctl -w net.ipv4.ip_forward=1 PreUp = sysctl -w net.ipv4.ip_forward=1
{% if dns_server is defined %} {% if dns_server is defined %}
PostUp = resolvectl dns %i {{ dns_server }}; resolvectl domain %i {{ wg_hub_iface_name }}.local PostUp = resolvectl dns %i {{ wg_hub_dns_server }}; resolvectl domain %i {{ wg_hub_iface_name }}.local
{% endif %} {% endif %}
PostDown = sysctl -w net.ipv4.ip_forward=0 PostDown = sysctl -w net.ipv4.ip_forward=0
@@ -38,7 +38,7 @@
notify: "Run the Wireguard service" notify: "Run the Wireguard service"
loop: "{{ peers }}" loop: "{{ peers }}"
vars: vars:
domain_name: "{{ item.wg_hub_host_id }}.{{ wg_hub_iface_name }}.local" domain_name: "{{ item.host_id }}.{{ wg_hub_iface_name }}.local"
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
path: "/etc/wireguard/{{ wg_hub_iface_name }}.conf" path: "/etc/wireguard/{{ wg_hub_iface_name }}.conf"
owner: root owner: root
@@ -48,7 +48,7 @@
block: | block: |
# #
[Peer] # {{ domain_name }} [Peer] # {{ domain_name }}
PublicKey = {{ item.wg_hub_wg_pubkey }} PublicKey = {{ item.wg_pubkey }}
PresharedKey = {{ item.wg_psk }} PresharedKey = {{ item.wg_psk }}
AllowedIPs = {{ item.wg_hub_ipv4_vpn_addr }}/32 AllowedIPs = {{ item.ipv4_vpn_addr }}/32
# #