Add common module managing common services and scripts (act_runner, create/restore backups)

Fix script environment variables
Add Fefan configuration
Fix gateway services file provisionning through ssh
This commit is contained in:
2026-01-20 15:42:17 +01:00
parent 152f09ac50
commit 1de2fe9ab4
53 changed files with 285 additions and 442 deletions

41
main.tf
View File

@@ -27,38 +27,40 @@ locals {
}
resource "local_file" "traefik_config" {
filename = "${path.module}/${var.gateway_repository}/services.yml"
filename = "${path.module}/services.yml"
content = templatefile("${path.module}/templates/traefik.services.tpl", {
services = local.traefik_services
})
}
resource "null_resource" "commit_traefik" {
depends_on = [local_file.traefik_config]
resource "null_resource" "deploy_traefik_config" {
depends_on = [
local_file.traefik_config,
module.gateway
]
triggers = {
config_sha = sha256(local_file.traefik_config.content)
}
provisioner "local-exec" {
working_dir = "${path.module}/${var.gateway_repository}"
command = "git add services.yml && git commit -m 'Update Traefik services' && git push"
}
}
provisioner "file" {
source = "${path.module}/services.yml"
destination = "/home/gateway/services.yaml"
resource "null_resource" "notify_gateway" {
depends_on = [null_resource.commit_traefik]
triggers = {
config_sha = sha256(local_file.traefik_config.content)
}
provisioner "local-exec" {
command = "curl -X POST -H 'X-Webhook-Token: ${var.gateway_token}' http://192.168.1.89:5555/reload"
connection {
type = "ssh"
host = module.gateway.vm_ip_address
user = "gateway"
agent = true
}
}
}
module "gateway" {
source = "./modules/apps/gateway"
providers = {}
vm_ip_address = "192.168.1.89"
name = "gateway"
hostname = "gateway"
@@ -80,6 +82,7 @@ module "gateway" {
module "gitea" {
source = "./modules/apps/gitea"
providers = {}
vm_ip_address = "192.168.1.90"
name = "gitea"
hostname = "gitea"
@@ -98,10 +101,14 @@ module "gitea" {
proxmox_host_ip = var.proxmox_host_ip
}
# Needs gitea
module "bookshelf" {
source = "./modules/apps/bookshelf"
providers = {}
vm_ip_address = "192.168.1.91"
depends_on = [
module.gitea
]
name = "bookshelf"
hostname = "bookshelf"
@@ -120,10 +127,14 @@ module "bookshelf" {
proxmox_host_ip = var.proxmox_host_ip
}
# Needs gitea
module "fefan" {
source = "./modules/apps/fefan"
providers = {}
vm_ip_address = "192.168.1.92"
depends_on = [
module.gitea
]
name = "fefan"
hostname = "fefan"