From 0ae7ecd47fd76921e8e1137739497578fe703354 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 26 Jan 2021 21:06:24 +0100 Subject: Better main(). * Moving templates into their respective modules. * Supporting export type-based filtering. Probably not perfect. --- j2/dba/cluster.j2 | 19 ------------------- j2/platform-ansible.j2 | 6 ------ j2/terraform-machine-outputs.j2 | 7 ------- j2/terraform-machine.j2 | 19 ------------------- j2/terraform-main-scaleway-machine.j2 | 19 ------------------- j2/terraform-record-set.j2 | 8 -------- j2/wireguard/ansible-host.j2 | 8 -------- j2/wireguard/ansible.j2 | 6 ------ j2/wireguard/inventory.j2 | 7 ------- 9 files changed, 99 deletions(-) delete mode 100644 j2/dba/cluster.j2 delete mode 100644 j2/platform-ansible.j2 delete mode 100644 j2/terraform-machine-outputs.j2 delete mode 100644 j2/terraform-machine.j2 delete mode 100644 j2/terraform-main-scaleway-machine.j2 delete mode 100644 j2/terraform-record-set.j2 delete mode 100644 j2/wireguard/ansible-host.j2 delete mode 100644 j2/wireguard/ansible.j2 delete mode 100644 j2/wireguard/inventory.j2 (limited to 'j2') diff --git a/j2/dba/cluster.j2 b/j2/dba/cluster.j2 deleted file mode 100644 index 045fbcd..0000000 --- a/j2/dba/cluster.j2 +++ /dev/null @@ -1,19 +0,0 @@ -# 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/platform-ansible.j2 b/j2/platform-ansible.j2 deleted file mode 100644 index 72e3247..0000000 --- a/j2/platform-ansible.j2 +++ /dev/null @@ -1,6 +0,0 @@ -# Ansible -- hosts: - - {{ m.key }} - tasks: - - import_role: - name: acme-platform diff --git a/j2/terraform-machine-outputs.j2 b/j2/terraform-machine-outputs.j2 deleted file mode 100644 index 438fac6..0000000 --- a/j2/terraform-machine-outputs.j2 +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index 0ac8b90..0000000 --- a/j2/terraform-machine.j2 +++ /dev/null @@ -1,19 +0,0 @@ -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 = "{{ m.fqdn }}." -} - -output "{{scw.key}}_public_ip" { - value = scaleway_instance_server.{{ scw.key }}.public_ip -} diff --git a/j2/terraform-main-scaleway-machine.j2 b/j2/terraform-main-scaleway-machine.j2 deleted file mode 100644 index eab9fac..0000000 --- a/j2/terraform-main-scaleway-machine.j2 +++ /dev/null @@ -1,19 +0,0 @@ -# Generated - -terraform { - required_providers { - scaleway = { - source = "scaleway/scaleway" - version = "1.17.2" - } - } -} - -provider "scaleway" { -} - -{% -for z in managedZones %} -variable "{{z.name}}" { - type = string -} -{% endfor -%} diff --git a/j2/terraform-record-set.j2 b/j2/terraform-record-set.j2 deleted file mode 100644 index b89ee00..0000000 --- a/j2/terraform-record-set.j2 +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_dns_record_set" "{{ tf.key }}" { - name = "{{ entry.fqdn }}" - managed_zone = var.{{ managedZone.name }} - type = "{{ entry.type }}" - ttl = 300 - - rrdatas = [{{ tf.expression }}] -} diff --git a/j2/wireguard/ansible-host.j2 b/j2/wireguard/ansible-host.j2 deleted file mode 100644 index a3c8c40..0000000 --- a/j2/wireguard/ansible-host.j2 +++ /dev/null @@ -1,8 +0,0 @@ -# Generated -link_address: {{ host.ip }} -network_cidr: {{ host.networkCidr }} -wireguard_peers: - {{ host.machine.name }}: -{%- for peer in peers %} - - {{ peer.fqdn }} -{%- endfor %} diff --git a/j2/wireguard/ansible.j2 b/j2/wireguard/ansible.j2 deleted file mode 100644 index 82c0ca0..0000000 --- a/j2/wireguard/ansible.j2 +++ /dev/null @@ -1,6 +0,0 @@ -- hosts: {{ net.name }} - roles: - - name: wireguard - wireguard_if: {{ net.name }} - wireguard_listen_port: 45364 - wireguard_address4: "{{ '{{' }} link_addresses[ansible_hostname] }}" diff --git a/j2/wireguard/inventory.j2 b/j2/wireguard/inventory.j2 deleted file mode 100644 index 0924bb2..0000000 --- a/j2/wireguard/inventory.j2 +++ /dev/null @@ -1,7 +0,0 @@ -# Generated -all: - hosts: - {%- for host in hosts %} - {{ host.getName() }}: - ansible_host: {{ host.getFqdn() }} - {%- endfor %} -- cgit v1.2.3