Created
October 29, 2020 20:01
-
-
Save richm/dfa25020617ed3666af13aee86a2f7cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: set parameters for test | |
hosts: localhost | |
tasks: | |
- set_fact: | |
vpn_connections: | |
- type: psk | |
hosts: | |
hosta: | |
hostb: | |
- name: show connections | |
debug: | |
msg: conns {{ vpn_connections | to_nice_json }} | |
- name: add psk to each tunnel | |
set_fact: | |
vpn_connections: | | |
{% for tunnel in vpn_connections | selectattr("type", "equalto", "psk") %} | |
{% if "psk" not in tunnel %} | |
{% set _ = tunnel.__setitem__("psk", "need to create psk") %} | |
{% endif %} | |
{% endfor %} | |
{{ vpn_connections }} | |
- name: show connections again | |
debug: | |
msg: conns {{ vpn_connections | to_nice_json }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment