use ansible_play_hosts instead of hardcoded vpn grp
should use the group in the play calling the role. works fine when hosts bellong to several groups
This commit is contained in:
parent
847dd3a903
commit
2583dd4264
|
@ -16,7 +16,7 @@ PostDown = {{hostvars[inventory_hostname].wireguard_postdown}}
|
||||||
SaveConfig = true
|
SaveConfig = true
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% for host in groups["vpn"] %}
|
{% for host in ansible_play_hosts %}
|
||||||
{% if host != inventory_hostname %}
|
{% if host != inventory_hostname %}
|
||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = {{hostvars[host].public_key}}
|
PublicKey = {{hostvars[host].public_key}}
|
||||||
|
|
Reference in a new issue