summaryrefslogtreecommitdiff
path: root/j2
diff options
context:
space:
mode:
Diffstat (limited to 'j2')
-rw-r--r--j2/dba/cluster.j219
-rw-r--r--j2/terraform-machine.j22
-rw-r--r--j2/wireguard/ansible-host.j28
-rw-r--r--j2/wireguard/inventory.j28
4 files changed, 29 insertions, 8 deletions
diff --git a/j2/dba/cluster.j2 b/j2/dba/cluster.j2
new file mode 100644
index 0000000..045fbcd
--- /dev/null
+++ b/j2/dba/cluster.j2
@@ -0,0 +1,19 @@
+# Generated
+
+# cluster: {{ cluster.name }}
+{%- for m, containers in containersByMachine.entrySet() %}
+---
+- host:
+ - {{ m.name }}
+ tasks:
+ import_role:
+ name: docker-service
+ vars:
+ template: |
+ version: "3"
+ services:
+{%- for c in containers %}
+ {{ c.name }}:
+ image: {{ c.image }}:{{ c.tag }}
+{%- endfor %}
+{% endfor %}
diff --git a/j2/terraform-machine.j2 b/j2/terraform-machine.j2
index c83bc48..0ac8b90 100644
--- a/j2/terraform-machine.j2
+++ b/j2/terraform-machine.j2
@@ -11,7 +11,7 @@ resource "scaleway_instance_ip" "{{ scw.key }}" {}
resource "scaleway_instance_ip_reverse_dns" "{{ scw.key }}" {
ip_id = scaleway_instance_ip.{{ scw.key }}.id
- reverse = "{{ m.fqdn }}"
+ reverse = "{{ m.fqdn }}."
}
output "{{scw.key}}_public_ip" {
diff --git a/j2/wireguard/ansible-host.j2 b/j2/wireguard/ansible-host.j2
index 72273ef..a3c8c40 100644
--- a/j2/wireguard/ansible-host.j2
+++ b/j2/wireguard/ansible-host.j2
@@ -1,8 +1,8 @@
# Generated
-link_address: {{ link }}
-network_cidr: {{ network }}
+link_address: {{ host.ip }}
+network_cidr: {{ host.networkCidr }}
wireguard_peers:
- {{ host.name }}:
+ {{ host.machine.name }}:
{%- for peer in peers %}
- - {{ peer }}
+ - {{ peer.fqdn }}
{%- endfor %}
diff --git a/j2/wireguard/inventory.j2 b/j2/wireguard/inventory.j2
index c7f38ee..0924bb2 100644
--- a/j2/wireguard/inventory.j2
+++ b/j2/wireguard/inventory.j2
@@ -1,5 +1,7 @@
# Generated
all:
-{%- for host in hosts %}
- {{ host.name }}: {{ host.fqdn }}
-{%- endfor %}
+ hosts:
+ {%- for host in hosts %}
+ {{ host.getName() }}:
+ ansible_host: {{ host.getFqdn() }}
+ {%- endfor %}