feat(id.tjo.space): changes

This commit is contained in:
Tine 2025-03-06 20:04:18 +01:00
parent 721d443e39
commit 4651a73e6d
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw
8 changed files with 36 additions and 20 deletions

View file

@ -15,7 +15,7 @@ if [ ! -d .git ]; then
--depth 1 \
--no-checkout \
--filter=tree:0 \
https://github.com/tjo-space/tjo-cloud-infrastructure.git .
https://github.com/tjo-space/tjo-space-infrastructure.git .
git sparse-checkout set --no-cone /id.tjo.space
git checkout
else
@ -37,10 +37,6 @@ function provision() {
ufw allow 443/tcp # HTTPS
ufw allow 636/tcp # LDAPS
ufw enable
##
echo "=== Setting up the user"
loginctl enable-linger "ubuntu"
}
echo "=== Provision the System (as root)"

View file

@ -1,8 +1,3 @@
# Always use devbox environment to run commands.
set shell := ["devbox", "run"]
# Load dotenv
set dotenv-load
default:
@just --list

View file

@ -1,11 +1,15 @@
resource "hcloud_ssh_key" "main" {
for_each = var.ssh_keys
name = each.key
public_key = eeach.value
public_key = each.value
}
resource "hcloud_server" "main" {
name = "id.tjo.space"
for_each = toset(var.nodes)
name = "${each.key}.id.tjo.space"
image = "ubuntu-24.04"
server_type = "cax11"
@ -18,11 +22,11 @@ resource "hcloud_server" "main" {
backups = true
ssh_keys = [for key in var.ssh_keys : hcloud_ssh_key.main[key].id]
ssh_keys = [for key, value in var.ssh_keys : hcloud_ssh_key.main[key].id]
user_data = <<-EOF
#cloud-config
hostname: id
hostname: ${each.key}
fqdn: id.tjo.space
prefer_fqdn_over_hostname: true
packages:
@ -41,17 +45,21 @@ resource "hcloud_server" "main" {
}
resource "dnsimple_zone_record" "a" {
for_each = toset(var.nodes)
zone_name = "tjo.space"
name = "id.tjo.space"
value = hcloud_server.main.ipv4_address
value = hcloud_server.main[each.key].ipv4_address
type = "A"
ttl = 300
}
resource "dnsimple_zone_record" "aaaa" {
for_each = toset(var.nodes)
zone_name = "tjo.space"
name = "id.tjo.space"
value = hcloud_server.main.ipv6_address
value = hcloud_server.main[each.key].ipv6_address
type = "AAAA"
ttl = 300
}

View file

@ -19,5 +19,5 @@ provider "hcloud" {
provider "dnsimple" {
token = var.dnsimple_token
account = var.dnsimple_aaccount_id
account = var.dnsimple_account_id
}

View file

@ -1,3 +1,7 @@
nodes = [
"01",
]
ssh_keys = {
"tine+pc" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICXAlzwziqfUUb2qmFwNF/nrBYc5MNT1MMOx81ohBmB+ tine+pc@tjo.space"
"tine+mobile" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAdPg/nG/Qzk110SBukHHEDqH6/3IJHsIKKHWTrqjaOh tine+mobile@tjo.space"

View file

@ -1,17 +1,21 @@
variable "hcloud_token" {
sensitive = true
type = string
type = string
}
variable "dnsimple_token" {
sensitive = true
type = string
type = string
}
variable "dnsimple_aaccount_id" {
variable "dnsimple_account_id" {
type = string
}
variable "ssh_keys" {
type = map(string)
}
variable "nodes" {
type = list(string)
}

9
justfile Normal file
View file

@ -0,0 +1,9 @@
# Always use devbox environment to run commands.
set shell := ["devbox", "run"]
# Load dotenv
set dotenv-load
mod id 'id.tjo.space'
default:
@just --list