Compare commits
10 Commits
c7314b3ac8
...
7b8a41ea4a
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b8a41ea4a | |||
| 886cb3ac91 | |||
| 529511ab02 | |||
| a02628222e | |||
| 0af6f597f6 | |||
| f6e5eb5069 | |||
| 4764aad0e9 | |||
| fac90a194c | |||
| 4e2bd3a448 | |||
| c9e7e8b27c |
27
README.md
27
README.md
@@ -2,9 +2,32 @@
|
|||||||
|
|
||||||
Configuration Terraform pour gérer l'infrastructure domestique.
|
Configuration Terraform pour gérer l'infrastructure domestique.
|
||||||
|
|
||||||
|
## DNS
|
||||||
|
|
||||||
|
### Gestion des DNS
|
||||||
|
|
||||||
|
Une fois les enregistrements importés, vous pouvez :
|
||||||
|
|
||||||
|
- Modifier les enregistrements dans `ovh_dns_records.tf`
|
||||||
|
- Ajouter de nouveaux enregistrements
|
||||||
|
- Appliquer les changements avec `terraform apply`
|
||||||
|
|
||||||
|
### Exemple d'enregistrement
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
resource "ovh_domain_zone_record" "www" {
|
||||||
|
zone = "example.com"
|
||||||
|
subdomain = "www"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "203.0.113.1"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## AdGuard
|
## AdGuard
|
||||||
|
|
||||||
Gestion automatisée d'AdGuard Home via Terraform, incluant :
|
Gestion automatisée d'AdGuard Home via Terraform, incluant :
|
||||||
|
|
||||||
- Configuration des règles de réécriture DNS pour le réseau local
|
- Configuration des règles de réécriture DNS pour le réseau local
|
||||||
- Authentification sécurisée via `pass` (gestionnaire de mots de passe)
|
- Authentification sécurisée via `pass` (gestionnaire de mots de passe)
|
||||||
|
|
||||||
@@ -17,7 +40,7 @@ Gestion automatisée d'AdGuard Home via Terraform, incluant :
|
|||||||
### Utilisation
|
### Utilisation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd adguard
|
cd dns
|
||||||
terraform init
|
terraform init
|
||||||
terraform plan
|
terraform plan
|
||||||
terraform apply
|
terraform apply
|
||||||
@@ -25,4 +48,4 @@ terraform apply
|
|||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
Les rewrites DNS sont définis dans `adguard/variables.tf` et peuvent être personnalisés via un fichier `.tfvars`.
|
Les rewrites DNS sont définis dans `dns/variables.tf` et peuvent être personnalisés via un fichier `.tfvars`.
|
||||||
|
|||||||
@@ -42,3 +42,25 @@ provider "registry.opentofu.org/gmichels/adguard" {
|
|||||||
"zh:f809ab383cca0a5f83072981c64208cbd7fa67e986a86ee02dd2c82333221e32",
|
"zh:f809ab383cca0a5f83072981c64208cbd7fa67e986a86ee02dd2c82333221e32",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provider "registry.opentofu.org/ovh/ovh" {
|
||||||
|
version = "2.10.0"
|
||||||
|
constraints = "~> 2.10"
|
||||||
|
hashes = [
|
||||||
|
"h1:6CHM/tHZ7vAvQKtdqurs6ExO+46gpFooZ0zdaW74DKE=",
|
||||||
|
"zh:1582485c59b5e25fa407417de3040dfc31bfec3f9b884d51953f6625b930d2f6",
|
||||||
|
"zh:15b425716d5e05992cb1d68a49d58f0e9e0cbd7dbaa35ea9793404fa1ec45bed",
|
||||||
|
"zh:1c1547ff469c2f772d478f67d148d08b38468d43c9517b723b622a085625d949",
|
||||||
|
"zh:2491be291a8876da2dc1e71490428706cdca39002a1e89d10dd060474f59ce19",
|
||||||
|
"zh:2d9c7589764f838f04d38a87a0e6c9db6b560b6c5b510b69eabf2d67caa38d2b",
|
||||||
|
"zh:56c5b16a55dc4ac5f3eed69072e5ae74aafac2a4a8a84ba27fa06528320037cc",
|
||||||
|
"zh:629d2c7f709fc01adabba1c8b98ec7485dfebcc4b9f72f4bd4d36509166eb42c",
|
||||||
|
"zh:82f4b8b35a31a468d7a2a5aa4630f432ef64d9abfed8066afdaab0502886a72a",
|
||||||
|
"zh:84c5e65122efaee5e34c266cd750576969bd788c2bdbb804a7ffc08728ac3987",
|
||||||
|
"zh:85db08f3e1b27fda723b080bc5132069b6b7ba9699567cd44fb0a2207456a76c",
|
||||||
|
"zh:a84c043c96a01230e570163706f58c33ee59699fcc857d3db0f6e0b2a6b08bc6",
|
||||||
|
"zh:ad984516009930efc6ec465046287c6b293b6b219e3167aa4c0b900b903c6a50",
|
||||||
|
"zh:bd0114d45ec72134cf930a7619b70b0068e439759febba5717abb76219b85800",
|
||||||
|
"zh:f243a50dcf87687881972fcaba9226b4247588b6dc7368b0ef98168f643ee159",
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,15 +1,3 @@
|
|||||||
terraform {
|
|
||||||
required_providers {
|
|
||||||
adguard = {
|
|
||||||
source = "gmichels/adguard"
|
|
||||||
version = "~> 1.0"
|
|
||||||
}
|
|
||||||
pass = {
|
|
||||||
source = "camptocamp/pass"
|
|
||||||
version = "~> 2.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data "pass_password" "adguard" {
|
data "pass_password" "adguard" {
|
||||||
path = var.adguard_pass_path
|
path = var.adguard_pass_path
|
||||||
@@ -23,7 +11,7 @@ provider "adguard" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resource "adguard_rewrite" "rewrites" {
|
resource "adguard_rewrite" "rewrites" {
|
||||||
for_each = var.dns_rewrites
|
for_each = var.adguard_dns_rewrites
|
||||||
|
|
||||||
domain = each.key
|
domain = each.key
|
||||||
answer = each.value
|
answer = each.value
|
||||||
21
dns/ovh.conf.example
Normal file
21
dns/ovh.conf.example
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Configuration pour l'API OVH
|
||||||
|
# Copiez ce fichier vers ovh.conf et remplissez vos credentials
|
||||||
|
|
||||||
|
# Votre nom de domaine OVH
|
||||||
|
ZONE="votredomaine.com"
|
||||||
|
|
||||||
|
# Endpoint OVH (ovh-eu pour Europe, ovh-ca pour Canada)
|
||||||
|
OVH_ENDPOINT="ovh-eu"
|
||||||
|
|
||||||
|
# Credentials de l'API OVH
|
||||||
|
# Pour créer ces credentials, visitez: https://eu.api.ovh.com/createToken/
|
||||||
|
#
|
||||||
|
# Droits nécessaires:
|
||||||
|
# GET /domain/zone/*
|
||||||
|
# POST /domain/zone/* (optionnel, pour créer des enregistrements)
|
||||||
|
# PUT /domain/zone/* (optionnel, pour modifier des enregistrements)
|
||||||
|
# DELETE /domain/zone/* (optionnel, pour supprimer des enregistrements)
|
||||||
|
|
||||||
|
OVH_APPLICATION_KEY="votre_application_key"
|
||||||
|
OVH_APPLICATION_SECRET="votre_application_secret"
|
||||||
|
OVH_CONSUMER_KEY="votre_consumer_key"
|
||||||
10
dns/ovh.tf
Normal file
10
dns/ovh.tf
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
data "pass_password" "ovh" {
|
||||||
|
path = var.ovh_pass_path
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "ovh" {
|
||||||
|
endpoint = "ovh-eu"
|
||||||
|
application_key = data.pass_password.ovh.data.ak
|
||||||
|
application_secret = data.pass_password.ovh.data.as
|
||||||
|
consumer_key = data.pass_password.ovh.data.ck
|
||||||
|
}
|
||||||
287
dns/ovh_opytex_records.tf
Normal file
287
dns/ovh_opytex_records.tf
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
resource "ovh_domain_zone_record" "git_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "git"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "root_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = ""
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "raw_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "raw"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "www_cname" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "www"
|
||||||
|
fieldtype = "CNAME"
|
||||||
|
ttl = 3600
|
||||||
|
target = "opytex.org."
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "ftp_cname" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "ftp"
|
||||||
|
fieldtype = "CNAME"
|
||||||
|
ttl = 3600
|
||||||
|
target = "opytex.org."
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "admin_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "admin"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "91.121.90.228"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "storage_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "storage"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "minio_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "minio"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "chioggia_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "chioggia"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "chioggia_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "chioggia"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "sso_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "sso"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "rss_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "rss"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "rss_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "rss"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "bag_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "bag"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "bag_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "bag"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "liens_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "liens"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "liens_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "liens"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "storage_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "storage"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "minio_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "minio"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "git_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "git"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "paperless_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "paperless"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "paperless_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "paperless"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "grafana_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "grafana"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "grafana_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "grafana"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "photos_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "photos"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "photos_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "photos"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "ntfy_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "ntfy"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "ntfy_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "ntfy"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "livekit_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "livekit"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "livekit_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "livekit"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "vault_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "vault"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "vault_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "vault"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "plesna_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "plesna"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "plesna_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "plesna"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "maintenant_a" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "maintenant"
|
||||||
|
fieldtype = "A"
|
||||||
|
ttl = 3600
|
||||||
|
target = "188.165.240.182"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "ovh_domain_zone_record" "maintenant_aaaa" {
|
||||||
|
zone = "opytex.org"
|
||||||
|
subdomain = "maintenant"
|
||||||
|
fieldtype = "AAAA"
|
||||||
|
ttl = 3600
|
||||||
|
target = "2001:41d0:2:bbb6:0:0:0:1"
|
||||||
|
}
|
||||||
17
dns/providers.tf
Normal file
17
dns/providers.tf
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
adguard = {
|
||||||
|
source = "gmichels/adguard"
|
||||||
|
version = "~> 1.0"
|
||||||
|
}
|
||||||
|
pass = {
|
||||||
|
source = "camptocamp/pass"
|
||||||
|
version = "~> 2.0"
|
||||||
|
}
|
||||||
|
ovh = {
|
||||||
|
source = "ovh/ovh"
|
||||||
|
version = "~> 2.10"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,10 +1,16 @@
|
|||||||
|
variable "ovh_pass_path" {
|
||||||
|
type = string
|
||||||
|
description = "Path in pass for ovh dns tf creds"
|
||||||
|
default = "OVH/bb17629-ovh/tf-dns"
|
||||||
|
}
|
||||||
|
|
||||||
variable "adguard_pass_path" {
|
variable "adguard_pass_path" {
|
||||||
type = string
|
type = string
|
||||||
description = "Path in pass for AdGuard username"
|
description = "Path in pass for AdGuard username"
|
||||||
default = "home/adguard/admin"
|
default = "home/adguard/admin"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "dns_rewrites" {
|
variable "adguard_dns_rewrites" {
|
||||||
type = map(string)
|
type = map(string)
|
||||||
description = "DNS rewrites: domain -> IP"
|
description = "DNS rewrites: domain -> IP"
|
||||||
default = {
|
default = {
|
||||||
@@ -14,5 +20,10 @@ variable "dns_rewrites" {
|
|||||||
"*.nas.lan" = "192.168.10.50"
|
"*.nas.lan" = "192.168.10.50"
|
||||||
"salon.lan" = "192.168.10.92"
|
"salon.lan" = "192.168.10.92"
|
||||||
"crapaudine.net.opytex.org" = "192.168.1.90"
|
"crapaudine.net.opytex.org" = "192.168.1.90"
|
||||||
|
"pfsense.net.opytex.org" = "192.168.1.1"
|
||||||
|
"adguard.net.opytex.org" = "192.168.1.30"
|
||||||
|
"zebra.lan.opytex.org" = "192.168.10.60"
|
||||||
|
"ollama.lan.opytex.org" = "192.168.10.61"
|
||||||
|
"openwebui.lan.opytex.org" = "192.168.10.62"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user