Commit 3a436cf0 authored by Alex Hanselka's avatar Alex Hanselka
Browse files

Merge branch 'amh-genericize' into 'master'

genericize things

See merge request !3
parents 156551ec 7ffd1c35
Pipeline #3637 passed with stage
in 3 minutes and 39 seconds
variable "node_name" {}
variable "image" {}
variable "type" {}
variable "server_location" {
type = "string"
default = "nbg1"
}
variable "ansible_groups" {
type = "list"
default = []
}
variable "hcloud_ansible_groups" {
type = "list"
default = ["hcloud"]
}
variable "ansible_token" {
description = "The pipeline token to trigger the ansible build"
type = "string"
}
variable "wireguard_address" {
description = "Wireguard address"
type = "string"
default = ""
}
data "google_dns_managed_zone" "darkdna" {
name = "darkdna"
data "google_dns_managed_zone" "dns-zone" {
name = var.dns_zone
}
data "template_file" "init" {
......@@ -76,13 +46,13 @@ resource "hcloud_server" "generic-hcloud" {
resource "hcloud_rdns" "ipv4" {
server_id = "${hcloud_server.generic-hcloud.id}"
ip_address = "${hcloud_server.generic-hcloud.ipv4_address}"
dns_ptr = "${var.node_name}.darkdna.net"
dns_ptr = "${var.node_name}.${data.google_dns_managed_zone.dns_zone.dns_name}"
}
resource "hcloud_rdns" "ipv6" {
server_id = "${hcloud_server.generic-hcloud.id}"
ip_address = "${hcloud_server.generic-hcloud.ipv6_address}"
dns_ptr = "${var.node_name}.darkdna.net"
dns_ptr = "${var.node_name}.${data.google_dns_managed_zone.dns_zone.dns_name}"
}
resource "ansible_host" "hcloud-host" {
......@@ -93,22 +63,22 @@ resource "ansible_host" "hcloud-host" {
ansible_user = "root"
ansible_host = "${hcloud_server.generic-hcloud.ipv4_address}"
wireguard_address = "${var.wireguard_address}"
wireguard_endpoint = "${var.node_name}.hc.${data.google_dns_managed_zone.darkdna.dns_name}"
wireguard_endpoint = "${var.node_name}.hc.${data.google_dns_managed_zone.dns_zone.dns_name}"
}
}
resource "google_dns_record_set" "external" {
name = "${var.node_name}.hc.${data.google_dns_managed_zone.darkdna.dns_name}"
name = "${var.node_name}.hc.${data.google_dns_managed_zone.dns_zone.dns_name}"
type = "A"
ttl = 3600
managed_zone = "${data.google_dns_managed_zone.darkdna.name}"
managed_zone = "${data.google_dns_managed_zone.dns_zone.name}"
rrdatas = ["${hcloud_server.generic-hcloud.ipv4_address}"]
}
resource "google_dns_record_set" "external-v6" {
name = "${var.node_name}.hc.${data.google_dns_managed_zone.darkdna.dns_name}"
name = "${var.node_name}.hc.${data.google_dns_managed_zone.dns_zone.dns_name}"
type = "AAAA"
ttl = 3600
managed_zone = "${data.google_dns_managed_zone.darkdna.name}"
managed_zone = "${data.google_dns_managed_zone.dns_zone.name}"
rrdatas = ["${hcloud_server.generic-hcloud.ipv6_address}1"]
}
variable "node_name" {}
variable "image" {}
variable "type" {}
variable "server_location" {
type = "string"
default = "nbg1"
}
variable "ansible_groups" {
type = "list"
default = []
}
variable "hcloud_ansible_groups" {
type = "list"
default = ["hcloud"]
}
variable "ansible_token" {
description = "The pipeline token to trigger the ansible build"
type = "string"
}
variable "wireguard_address" {
description = "Wireguard address"
type = "string"
default = ""
}
variable "dns_zone" {
default = "darkdna"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment