From 428de8040ada3baad692b2acfb7d250073a067a9 Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Thu, 31 Oct 2024 03:17:55 +0100 Subject: [PATCH] Goodbye Contabo --- hosts.auto.tfvars | 5 ----- inventory/serguzim.net.yml | 14 -------------- main.tf | 11 ----------- modules/infrastructure/contabo.tf | 4 ---- modules/infrastructure/main.tf | 5 ----- modules/infrastructure/ovh.tf | 26 +++++++------------------- playbooks/serguzim.net.yml | 1 - variables.tf | 17 ----------------- 8 files changed, 7 insertions(+), 76 deletions(-) diff --git a/hosts.auto.tfvars b/hosts.auto.tfvars index ad5a5d6..84504ed 100644 --- a/hosts.auto.tfvars +++ b/hosts.auto.tfvars @@ -7,11 +7,6 @@ hosts = { server_type = "cx32" datacenter = "fsn1-dc14" }, - "node002" = { - hostname = "node002" - rdns = "node002.serguzim.net" - provider = "contabo" - }, "node003" = { hostname = "node003" rdns = "mail.serguzim.me" diff --git a/inventory/serguzim.net.yml b/inventory/serguzim.net.yml index 2133f54..d1b31a1 100644 --- a/inventory/serguzim.net.yml +++ b/inventory/serguzim.net.yml @@ -3,7 +3,6 @@ all: serguzim_net: hosts: node001: - node002: node003: hosts: local-dev: @@ -22,19 +21,6 @@ all: hc_url: "{{ opentofu.healthchecksio.backup.node001.ping_url }}" gatus_token: "{{ vault_hosts.node001.backup.gatus_token }}" - node002: - ansible_host: "{{ opentofu.hosts.node002.fqdn_vpn }}" - ansible_port: "{{ vault_hosts.node002.ansible_port }}" - ansible_user: "{{ vault_hosts.node002.ansible_user }}" - interactive_user: "{{ vault_hosts.node002.interactive_user }}" - host_vpn: - domain: "{{ opentofu.hosts.node002.fqdn_vpn }}" - ip: "{{ opentofu.hosts.node002.ipv4_address_vpn }}" - host_backup: - hc_uid: "{{ opentofu.healthchecksio.backup.node002.id }}" - hc_url: "{{ opentofu.healthchecksio.backup.node002.ping_url }}" - gatus_token: "{{ vault_hosts.node002.backup.gatus_token }}" - node003: ansible_host: "{{ opentofu.hosts.node003.fqdn_vpn }}" ansible_port: "{{ vault_hosts.node003.ansible_port }}" diff --git a/main.tf b/main.tf index 8597f73..05f15fe 100644 --- a/main.tf +++ b/main.tf @@ -4,10 +4,6 @@ terraform { source = "hashicorp/aws" version = "~> 5.0" } - contabo = { - source = "contabo/contabo" - version = "~> 0.1.26" - } hcloud = { source = "hetznercloud/hcloud" version = "~> 1.45.0" @@ -83,13 +79,6 @@ provider "aws" { secret_key = var.aws_secret_key } -provider "contabo" { - oauth2_client_id = var.contabo_client_id - oauth2_client_secret = var.contabo_client_secret - oauth2_user = var.contabo_user - oauth2_pass = var.contabo_pass -} - provider "hcloud" { token = var.hcloud_token } diff --git a/modules/infrastructure/contabo.tf b/modules/infrastructure/contabo.tf index caaa519..e69de29 100644 --- a/modules/infrastructure/contabo.tf +++ b/modules/infrastructure/contabo.tf @@ -1,4 +0,0 @@ -resource "contabo_instance" "nodes" { - for_each = local.contabo_hosts - display_name = each.value.hostname -} diff --git a/modules/infrastructure/main.tf b/modules/infrastructure/main.tf index 43a0bd3..2767415 100644 --- a/modules/infrastructure/main.tf +++ b/modules/infrastructure/main.tf @@ -4,10 +4,6 @@ terraform { source = "hashicorp/aws" version = "~> 5.0" } - contabo = { - source = "contabo/contabo" - version = "~> 0.1.26" - } hcloud = { source = "hetznercloud/hcloud" version = "~> 1.45.0" @@ -37,6 +33,5 @@ locals { services_database = {for key, val in var.services : key => val if val.database} services_s3 = {for key, val in var.services : key => val if val.s3} - contabo_hosts = {for key, val in var.hosts : key => val if val.provider == "contabo"} hetzner_hosts = {for key, val in var.hosts : key => val if val.provider == "hetzner"} } diff --git a/modules/infrastructure/ovh.tf b/modules/infrastructure/ovh.tf index ff2957d..efba640 100644 --- a/modules/infrastructure/ovh.tf +++ b/modules/infrastructure/ovh.tf @@ -1,24 +1,12 @@ locals { server_addresses = flatten([ - [ - for key, host in contabo_instance.nodes : [ - { - key = key - hostname = host.display_name - ipv4_address = host.ip_config[0].v4[0].ip - ipv6_address = host.ip_config[0].v6[0].ip - }, - ] - ], - [ - for key, host in hcloud_server.nodes : [ - { - key = key - hostname = host.name - ipv4_address = host.ipv4_address - ipv6_address = host.ipv6_address - }, - ] + for key, host in hcloud_server.nodes : [ + { + key = key + hostname = host.name + ipv4_address = host.ipv4_address + ipv6_address = host.ipv6_address + }, ] ]) diff --git a/playbooks/serguzim.net.yml b/playbooks/serguzim.net.yml index ade0cee..8015e7a 100644 --- a/playbooks/serguzim.net.yml +++ b/playbooks/serguzim.net.yml @@ -10,7 +10,6 @@ apply: tags: software tags: software - when: "inventory_hostname != 'node002'" - name: Run always role ansible.builtin.include_role: diff --git a/variables.tf b/variables.tf index ac7669e..17d9a6d 100644 --- a/variables.tf +++ b/variables.tf @@ -45,23 +45,6 @@ variable "aws_secret_key" { } -variable "contabo_client_id" { - sensitive = true -} - -variable "contabo_client_secret" { - sensitive = true -} - -variable "contabo_user" { - sensitive = true -} - -variable "contabo_pass" { - sensitive = true -} - - variable "hcloud_token" { sensitive = true }