feat(id.tjo.space): changes
This commit is contained in:
parent
721d443e39
commit
4651a73e6d
8 changed files with 36 additions and 20 deletions
|
@ -15,7 +15,7 @@ if [ ! -d .git ]; then
|
||||||
--depth 1 \
|
--depth 1 \
|
||||||
--no-checkout \
|
--no-checkout \
|
||||||
--filter=tree:0 \
|
--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 sparse-checkout set --no-cone /id.tjo.space
|
||||||
git checkout
|
git checkout
|
||||||
else
|
else
|
||||||
|
@ -37,10 +37,6 @@ function provision() {
|
||||||
ufw allow 443/tcp # HTTPS
|
ufw allow 443/tcp # HTTPS
|
||||||
ufw allow 636/tcp # LDAPS
|
ufw allow 636/tcp # LDAPS
|
||||||
ufw enable
|
ufw enable
|
||||||
|
|
||||||
##
|
|
||||||
echo "=== Setting up the user"
|
|
||||||
loginctl enable-linger "ubuntu"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "=== Provision the System (as root)"
|
echo "=== Provision the System (as root)"
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
# Always use devbox environment to run commands.
|
|
||||||
set shell := ["devbox", "run"]
|
|
||||||
# Load dotenv
|
|
||||||
set dotenv-load
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@just --list
|
@just --list
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
resource "hcloud_ssh_key" "main" {
|
resource "hcloud_ssh_key" "main" {
|
||||||
for_each = var.ssh_keys
|
for_each = var.ssh_keys
|
||||||
|
|
||||||
name = each.key
|
name = each.key
|
||||||
public_key = eeach.value
|
public_key = each.value
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "hcloud_server" "main" {
|
resource "hcloud_server" "main" {
|
||||||
name = "id.tjo.space"
|
for_each = toset(var.nodes)
|
||||||
|
|
||||||
|
name = "${each.key}.id.tjo.space"
|
||||||
|
|
||||||
image = "ubuntu-24.04"
|
image = "ubuntu-24.04"
|
||||||
server_type = "cax11"
|
server_type = "cax11"
|
||||||
|
|
||||||
|
@ -18,11 +22,11 @@ resource "hcloud_server" "main" {
|
||||||
|
|
||||||
backups = true
|
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
|
user_data = <<-EOF
|
||||||
#cloud-config
|
#cloud-config
|
||||||
hostname: id
|
hostname: ${each.key}
|
||||||
fqdn: id.tjo.space
|
fqdn: id.tjo.space
|
||||||
prefer_fqdn_over_hostname: true
|
prefer_fqdn_over_hostname: true
|
||||||
packages:
|
packages:
|
||||||
|
@ -41,17 +45,21 @@ resource "hcloud_server" "main" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "dnsimple_zone_record" "a" {
|
resource "dnsimple_zone_record" "a" {
|
||||||
|
for_each = toset(var.nodes)
|
||||||
|
|
||||||
zone_name = "tjo.space"
|
zone_name = "tjo.space"
|
||||||
name = "id.tjo.space"
|
name = "id.tjo.space"
|
||||||
value = hcloud_server.main.ipv4_address
|
value = hcloud_server.main[each.key].ipv4_address
|
||||||
type = "A"
|
type = "A"
|
||||||
ttl = 300
|
ttl = 300
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "dnsimple_zone_record" "aaaa" {
|
resource "dnsimple_zone_record" "aaaa" {
|
||||||
|
for_each = toset(var.nodes)
|
||||||
|
|
||||||
zone_name = "tjo.space"
|
zone_name = "tjo.space"
|
||||||
name = "id.tjo.space"
|
name = "id.tjo.space"
|
||||||
value = hcloud_server.main.ipv6_address
|
value = hcloud_server.main[each.key].ipv6_address
|
||||||
type = "AAAA"
|
type = "AAAA"
|
||||||
ttl = 300
|
ttl = 300
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,5 +19,5 @@ provider "hcloud" {
|
||||||
|
|
||||||
provider "dnsimple" {
|
provider "dnsimple" {
|
||||||
token = var.dnsimple_token
|
token = var.dnsimple_token
|
||||||
account = var.dnsimple_aaccount_id
|
account = var.dnsimple_account_id
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
nodes = [
|
||||||
|
"01",
|
||||||
|
]
|
||||||
|
|
||||||
ssh_keys = {
|
ssh_keys = {
|
||||||
"tine+pc" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICXAlzwziqfUUb2qmFwNF/nrBYc5MNT1MMOx81ohBmB+ tine+pc@tjo.space"
|
"tine+pc" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICXAlzwziqfUUb2qmFwNF/nrBYc5MNT1MMOx81ohBmB+ tine+pc@tjo.space"
|
||||||
"tine+mobile" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAdPg/nG/Qzk110SBukHHEDqH6/3IJHsIKKHWTrqjaOh tine+mobile@tjo.space"
|
"tine+mobile" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAdPg/nG/Qzk110SBukHHEDqH6/3IJHsIKKHWTrqjaOh tine+mobile@tjo.space"
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
variable "hcloud_token" {
|
variable "hcloud_token" {
|
||||||
sensitive = true
|
sensitive = true
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "dnsimple_token" {
|
variable "dnsimple_token" {
|
||||||
sensitive = true
|
sensitive = true
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "dnsimple_aaccount_id" {
|
variable "dnsimple_account_id" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "ssh_keys" {
|
variable "ssh_keys" {
|
||||||
type = map(string)
|
type = map(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "nodes" {
|
||||||
|
type = list(string)
|
||||||
|
}
|
||||||
|
|
9
justfile
Normal file
9
justfile
Normal 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
|
Loading…
Reference in a new issue