Move wireguard_ip template code to template where it belongs

Instead of redundant set_fact task.
master
Robin Schneider 4 years ago
parent 3362f1c2fc
commit 739c9de73e
No known key found for this signature in database
GPG Key ID: A81E8006DC95EFE6

@ -24,10 +24,6 @@
- wg-install - wg-install
when: not ansible_os_family == 'Darwin' when: not ansible_os_family == 'Darwin'
- name: Set WireGuard IP (without mask)
set_fact:
wireguard_ip: "{{ wireguard_address.split('/')[0] }}"
- name: Register if config/private key already exists on target host - name: Register if config/private key already exists on target host
stat: stat:
path: "{{ wireguard_remote_directory }}/{{ wireguard_interface }}.conf" path: "{{ wireguard_remote_directory }}/{{ wireguard_interface }}.conf"

@ -50,7 +50,7 @@ PublicKey = {{hostvars[host].wireguard__fact_public_key}}
{% if hostvars[host].wireguard_allowed_ips is defined %} {% if hostvars[host].wireguard_allowed_ips is defined %}
AllowedIPs = {{hostvars[host].wireguard_allowed_ips}} AllowedIPs = {{hostvars[host].wireguard_allowed_ips}}
{% else %} {% else %}
AllowedIPs = {{hostvars[host].wireguard_ip}}/32 AllowedIPs = {{ hostvars[host].wireguard_address.split('/')[0] }}/32
{% endif %} {% endif %}
{% if hostvars[host].wireguard_persistent_keepalive is defined %} {% if hostvars[host].wireguard_persistent_keepalive is defined %}
PersistentKeepalive = {{hostvars[host].wireguard_persistent_keepalive}} PersistentKeepalive = {{hostvars[host].wireguard_persistent_keepalive}}

Loading…
Cancel
Save