add missing vars to default file
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2022-10-11 21:47:54 +02:00
parent 6a71faa307
commit 0ae1421e07
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
3 changed files with 25 additions and 22 deletions

View File

@ -10,5 +10,15 @@ wireguard_interface: "wg0"
# @var:wireguard_private_key: Private key to use. If not private key is given, the role will auto-generate a new key. # @var:wireguard_private_key: Private key to use. If not private key is given, the role will auto-generate a new key.
# @var:wireguard_private_key:default: $ "_unset_" # @var:wireguard_private_key:default: $ "_unset_"
# @var wireguard_dns:default: $ "_unset_"
# @var wireguard_fwmark:default: $ "_unset_"
# @var wireguard_mtu:default: $ "_unset_"
# @var wireguard_table:default: $ "_unset_"
wireguard_preup: []
wireguard_postup: []
wireguard_predown: []
wireguard_postdown: []
wireguard_peers: [] wireguard_peers: []
wireguard_peers_unmanaged: [] wireguard_peers_unmanaged: []

View File

@ -1,12 +1,13 @@
--- ---
- name: Ensure dependencies are installed - block:
- name: Ensure dependencies are installed
package: package:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
loop: loop:
- wireguard-tools - wireguard-tools
- name: Stat WireGuard config file - name: Stat WireGuard config file
stat: stat:
path: "/etc/wireguard/{{ wireguard_interface }}.conf" path: "/etc/wireguard/{{ wireguard_interface }}.conf"
register: __wireguard_config_file register: __wireguard_config_file

View File

@ -17,26 +17,18 @@ MTU = {{ wireguard_mtu }}
{% if wireguard_table is defined %} {% if wireguard_table is defined %}
Table = {{ wireguard_table }} Table = {{ wireguard_table }}
{% endif %} {% endif %}
{% if wireguard_preup is defined %}
{% for wg_preup in wireguard_preup %} {% for wg_preup in wireguard_preup %}
PreUp = {{ wg_preup }} PreUp = {{ wg_preup }}
{% endfor %} {% endfor %}
{% endif %}
{% if wireguard_postup is defined %}
{% for wg_postup in wireguard_postup %} {% for wg_postup in wireguard_postup %}
PostUp = {{ wg_postup }} PostUp = {{ wg_postup }}
{% endfor %} {% endfor %}
{% endif %}
{% if wireguard_predown is defined %}
{% for wg_predown in wireguard_predown %} {% for wg_predown in wireguard_predown %}
PreDown = {{ wg_predown }} PreDown = {{ wg_predown }}
{% endfor %} {% endfor %}
{% endif %}
{% if wireguard_postdown is defined %}
{% for wg_postdown in wireguard_postdown %} {% for wg_postdown in wireguard_postdown %}
PostDown = {{ wg_postdown }} PostDown = {{ wg_postdown }}
{% endfor %} {% endfor %}
{% endif %}
SaveConfig = false SaveConfig = false
{% for host in wireguard_peers %} {% for host in wireguard_peers %}
{% if host != inventory_hostname %} {% if host != inventory_hostname %}
@ -44,8 +36,8 @@ SaveConfig = false
[Peer] [Peer]
## {{ host }} ## {{ host }}
PublicKey = {{ hostvars[host].__wireguard_public_key }} PublicKey = {{ hostvars[host].__wireguard_public_key }}
{% if hostvars[host].wireguard_allowed_ips is defined %} {% if hostvars[host].wireguard_allowed_ips | length > 0 %}
AllowedIPs = {{ hostvars[host].wireguard_allowed_ips }} AllowedIPs = {{ hostvars[host].wireguard_allowed_ips | join(",") }}
{% else %} {% else %}
AllowedIPs = {{ hostvars[host].wireguard_address.split('/')[0] }}/32 AllowedIPs = {{ hostvars[host].wireguard_address.split('/')[0] }}/32
{% endif %} {% endif %}
@ -67,8 +59,8 @@ PublicKey = {{ peer.public_key }}
{% if peer.preshared_key is defined %} {% if peer.preshared_key is defined %}
PresharedKey = {{ peer.preshared_key }} PresharedKey = {{ peer.preshared_key }}
{% endif %} {% endif %}
{% if peer.allowed_ips is defined %} {% if peer.allowed_ips | length > 0 %}
AllowedIPs = {{ peer.allowed_ips }} AllowedIPs = {{ peer.allowed_ips | join(",") }}
{% endif %} {% endif %}
{% if peer.endpoint is defined %} {% if peer.endpoint is defined %}
Endpoint = {{ peer.endpoint }} Endpoint = {{ peer.endpoint }}