diff options
Diffstat (limited to 'modules/ri-base/src/main/resources/templates')
9 files changed, 99 insertions, 0 deletions
diff --git a/modules/ri-base/src/main/resources/templates/dba/cluster.j2 b/modules/ri-base/src/main/resources/templates/dba/cluster.j2 new file mode 100644 index 0000000..045fbcd --- /dev/null +++ b/modules/ri-base/src/main/resources/templates/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/modules/ri-base/src/main/resources/templates/platform-ansible.j2 b/modules/ri-base/src/main/resources/templates/platform-ansible.j2 new file mode 100644 index 0000000..72e3247 --- /dev/null +++ b/modules/ri-base/src/main/resources/templates/platform-ansible.j2 @@ -0,0 +1,6 @@ +# Ansible +- hosts: + - {{ m.key }} + tasks: + - import_role: + name: acme-platform diff --git a/modules/ri-base/src/main/resources/templates/terraform/machine-outputs.j2 b/modules/ri-base/src/main/resources/templates/terraform/machine-outputs.j2 new file mode 100644 index 0000000..438fac6 --- /dev/null +++ b/modules/ri-base/src/main/resources/templates/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/modules/ri-base/src/main/resources/templates/terraform/machine.j2 b/modules/ri-base/src/main/resources/templates/terraform/machine.j2 new file mode 100644 index 0000000..0ac8b90 --- /dev/null +++ b/modules/ri-base/src/main/resources/templates/terraform/machine.j2 @@ -0,0 +1,19 @@ +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/modules/ri-base/src/main/resources/templates/terraform/main-scaleway-machine.j2 b/modules/ri-base/src/main/resources/templates/terraform/main-scaleway-machine.j2 new file mode 100644 index 0000000..eab9fac --- /dev/null +++ b/modules/ri-base/src/main/resources/templates/terraform/main-scaleway-machine.j2 @@ -0,0 +1,19 @@ +# 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/modules/ri-base/src/main/resources/templates/terraform/main.j2 b/modules/ri-base/src/main/resources/templates/terraform/main.j2 new file mode 100644 index 0000000..009f4ed --- /dev/null +++ b/modules/ri-base/src/main/resources/templates/terraform/main.j2 @@ -0,0 +1,10 @@ +terraform { + required_providers { +{% for alias, provider in main.providers.entrySet() %} + {{ alias }} = { + version = "{{ provider.version }}" + source = "{{ provider.source }}" + } +{%- endfor %} + } +} diff --git a/modules/ri-base/src/main/resources/templates/terraform/record-set.j2 b/modules/ri-base/src/main/resources/templates/terraform/record-set.j2 new file mode 100644 index 0000000..b89ee00 --- /dev/null +++ b/modules/ri-base/src/main/resources/templates/terraform/record-set.j2 @@ -0,0 +1,8 @@ +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/modules/ri-base/src/main/resources/templates/terraform/resource.j2 b/modules/ri-base/src/main/resources/templates/terraform/resource.j2 new file mode 100644 index 0000000..91af481 --- /dev/null +++ b/modules/ri-base/src/main/resources/templates/terraform/resource.j2 @@ -0,0 +1 @@ +{{ resource.asString() -}} diff --git a/modules/ri-base/src/main/resources/templates/terraform/variables.j2 b/modules/ri-base/src/main/resources/templates/terraform/variables.j2 new file mode 100644 index 0000000..6c37d99 --- /dev/null +++ b/modules/ri-base/src/main/resources/templates/terraform/variables.j2 @@ -0,0 +1,10 @@ +{%- for var in variables %} +variable "{{ var.name }}" { +{%- if var.type %} + type = {{ var.type }} +{% endif %} +{%- if var.default %} + default = {{ var.default }} +{% endif %} +} +{% endfor %} |