Goodbye Contabo

This commit is contained in:
Tobias Reisinger 2024-10-31 03:17:55 +01:00
parent 56885d70b6
commit 428de8040a
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
8 changed files with 7 additions and 76 deletions

View file

@ -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"

View file

@ -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 }}"

11
main.tf
View file

@ -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
}

View file

@ -1,4 +0,0 @@
resource "contabo_instance" "nodes" {
for_each = local.contabo_hosts
display_name = each.value.hostname
}

View file

@ -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"}
}

View file

@ -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
},
]
])

View file

@ -10,7 +10,6 @@
apply:
tags: software
tags: software
when: "inventory_hostname != 'node002'"
- name: Run always role
ansible.builtin.include_role:

View file

@ -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
}