Role wireguard: split var 'my_wireguard_networks' into multiple lines for better reading

This commit is contained in:
Tobias Hachmer 2019-03-22 21:52:47 +01:00
parent b995bbffdf
commit aa38067f20
No known key found for this signature in database
GPG key ID: E112788464CA5C60

View file

@ -1,7 +1,17 @@
--- ---
- name: Gather my own WireGuard networks. - name: Gather my own WireGuard networks.
set_fact: set_fact:
my_wireguard_networks: "{% set _my_nets = [] %}{% for net in wireguard_networks %}{% if inventory_hostname_short in net.peers %}{% do _my_nets.append(net) %}{% set remote = net.peers | reject('equalto', inventory_hostname_short) | list () | first %}{% set remote_hostname = remote + '.freifunk-mwu.de' %}{% set remote_magic = hostvars[remote_hostname]['magic'] %}{% do net.update({'remote': remote, 'remote_hostname': remote_hostname, 'remote_magic': remote_magic}) %}{% endif %}{% endfor %}{{ _my_nets }}" my_wireguard_networks: "{% set _my_nets = [] %}\
{% for net in wireguard_networks %}\
{% if inventory_hostname_short in net.peers %}\
{% do _my_nets.append(net) %}\
{% set remote = net.peers | reject('equalto', inventory_hostname_short) | list () | first %}\
{% set remote_hostname = remote + '.freifunk-mwu.de' %}\
{% set remote_magic = hostvars[remote_hostname]['magic'] %}\
{% do net.update({'remote': remote, 'remote_hostname': remote_hostname, 'remote_magic': remote_magic}) %}\
{% endif %}\
{% endfor %}\
{{ _my_nets }}"
- name: Set unstable pin priority. - name: Set unstable pin priority.
blockinfile: blockinfile: