Move wireguard_ip template code to template where it belongs

Instead of redundant set_fact task.
This commit is contained in:
Robin Schneider 2020-09-20 00:39:14 +02:00
parent 3362f1c2fc
commit 739c9de73e
No known key found for this signature in database
GPG key ID: A81E8006DC95EFE6
2 changed files with 1 additions and 5 deletions

View file

@ -24,10 +24,6 @@
- wg-install
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
stat:
path: "{{ wireguard_remote_directory }}/{{ wireguard_interface }}.conf"

View file

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