summaryrefslogtreecommitdiff
path: root/modules/ri-wireguard/src/main/resources/templates
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ri-wireguard/src/main/resources/templates')
-rw-r--r--modules/ri-wireguard/src/main/resources/templates/wireguard/ansible-host.j212
-rw-r--r--modules/ri-wireguard/src/main/resources/templates/wireguard/ansible.j27
-rw-r--r--modules/ri-wireguard/src/main/resources/templates/wireguard/inventory.j213
3 files changed, 32 insertions, 0 deletions
diff --git a/modules/ri-wireguard/src/main/resources/templates/wireguard/ansible-host.j2 b/modules/ri-wireguard/src/main/resources/templates/wireguard/ansible-host.j2
new file mode 100644
index 0000000..6cb3a05
--- /dev/null
+++ b/modules/ri-wireguard/src/main/resources/templates/wireguard/ansible-host.j2
@@ -0,0 +1,12 @@
+# Generated
+wireguard_port: {{ host.publicPort }}
+link_address: {{ host.ip }}
+network_cidr: {{ host.networkCidr }}
+wireguard_peers:
+{%- for peer in peers %}
+ {{ peer.machine.name }}:
+ public_address: {{ peer.publicName }}
+ public_port: {{ peer.publicPort }}
+ gateway: {{ peer.ip }}
+ network: {{ peer.networkCidr }}
+{%- endfor %}
diff --git a/modules/ri-wireguard/src/main/resources/templates/wireguard/ansible.j2 b/modules/ri-wireguard/src/main/resources/templates/wireguard/ansible.j2
new file mode 100644
index 0000000..ad4d034
--- /dev/null
+++ b/modules/ri-wireguard/src/main/resources/templates/wireguard/ansible.j2
@@ -0,0 +1,7 @@
+- hosts: wireguard_{{ net.name }}
+ vars:
+ wireguard_if: {{ net.name }}
+ tasks:
+ - name: wireguard
+ import_role:
+ name: wireguard
diff --git a/modules/ri-wireguard/src/main/resources/templates/wireguard/inventory.j2 b/modules/ri-wireguard/src/main/resources/templates/wireguard/inventory.j2
new file mode 100644
index 0000000..64f3b5b
--- /dev/null
+++ b/modules/ri-wireguard/src/main/resources/templates/wireguard/inventory.j2
@@ -0,0 +1,13 @@
+# Generated
+all:
+ hosts:
+ {%- for host in hosts %}
+ {{ host.getName() }}:
+ ansible_host: {{ host.getFqdn() }}
+ {%- endfor %}
+ children:
+ wireguard_{{ net.name }}:
+ hosts:
+{%- for host in hosts %}
+ {{ host.getName() }}:
+{%- endfor %}