summaryrefslogtreecommitdiff
path: root/j2
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2021-01-01 23:13:14 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2021-01-01 23:13:14 +0100
commit1911481101e15463c8aecbdc03a6ce5b63b0d68f (patch)
tree254e8fe5e8cffb0cee35f77e1b9bfaa071d16489 /j2
parente4821f82249bddb443a1f6a6e403087cab659c6d (diff)
downloadrules-sandbox-1911481101e15463c8aecbdc03a6ce5b63b0d68f.tar.gz
rules-sandbox-1911481101e15463c8aecbdc03a6ce5b63b0d68f.tar.bz2
rules-sandbox-1911481101e15463c8aecbdc03a6ce5b63b0d68f.tar.xz
rules-sandbox-1911481101e15463c8aecbdc03a6ce5b63b0d68f.zip
Generating DNS too.
Diffstat (limited to 'j2')
-rw-r--r--j2/platform-ansible.j26
-rw-r--r--j2/terraform-machine-outputs.j27
-rw-r--r--j2/terraform-machine.j215
-rw-r--r--j2/terraform-record-set.j28
4 files changed, 36 insertions, 0 deletions
diff --git a/j2/platform-ansible.j2 b/j2/platform-ansible.j2
new file mode 100644
index 0000000..72e3247
--- /dev/null
+++ b/j2/platform-ansible.j2
@@ -0,0 +1,6 @@
+# Ansible
+- hosts:
+ - {{ m.key }}
+ tasks:
+ - import_role:
+ name: acme-platform
diff --git a/j2/terraform-machine-outputs.j2 b/j2/terraform-machine-outputs.j2
new file mode 100644
index 0000000..438fac6
--- /dev/null
+++ b/j2/terraform-machine-outputs.j2
@@ -0,0 +1,7 @@
+output "addresses" {
+ value = {
+{%- for m in machines %}
+ {{ m.key }}: scaleway_instance_ip.{{ m.key }}.address,
+{%- endfor %}
+ }
+}
diff --git a/j2/terraform-machine.j2 b/j2/terraform-machine.j2
new file mode 100644
index 0000000..95a28eb
--- /dev/null
+++ b/j2/terraform-machine.j2
@@ -0,0 +1,15 @@
+resource "scaleway_instance_server" "{{ scw.key }}" {
+ name = "acme-1"
+ type = "DEV1-S"
+ image = "b3042271-d2b1-4f87-b407-aedd3bbd1663"
+ ip_id = scaleway_instance_ip.{{ scw.key }}.id
+ enable_dynamic_ip = false
+ enable_ipv6 = true
+}
+
+resource "scaleway_instance_ip" "{{ scw.key }}" {}
+
+#resource "scaleway_instance_ip_reverse_dns" "{{ scw.key }}" {
+# ip_id = scaleway_instance_ip.{{ scw.key }}.id
+# reverse = "{{ scw.key }}.${google_dns_managed_zone.machine.dns_name}"
+#}
diff --git a/j2/terraform-record-set.j2 b/j2/terraform-record-set.j2
new file mode 100644
index 0000000..31bcfab
--- /dev/null
+++ b/j2/terraform-record-set.j2
@@ -0,0 +1,8 @@
+resource "google_dns_record_set" "{{ tf.key }}" {
+ name = "{{ entry.fqdn }}"
+ managed_zone = "{{ tf.terraformManagedZone }}"
+ type = "{{ entry.type }}"
+ ttl = 300
+
+ rrdatas = [var.addresses.{{ tf.expression }}]
+}