parent
cf3b9f4518
commit
70aff7bed1
4 changed files with 87 additions and 0 deletions
|
@ -15,6 +15,7 @@ env:
|
||||||
TF_PLUGIN_CACHE_DIR: ${{ gitea.workspace }}/.terraform.d/plugin-cache
|
TF_PLUGIN_CACHE_DIR: ${{ gitea.workspace }}/.terraform.d/plugin-cache
|
||||||
TF_IN_AUTOMATION: true
|
TF_IN_AUTOMATION: true
|
||||||
TF_CLI_ARGS: "-no-color"
|
TF_CLI_ARGS: "-no-color"
|
||||||
|
NOMAD_ADDR: "${{ vars.NOMAD_ADDR }}"
|
||||||
NOMAD_TOKEN: "${{ secrets.NOMAD_TOKEN }}"
|
NOMAD_TOKEN: "${{ secrets.NOMAD_TOKEN }}"
|
||||||
PG_CONN_STR: "${{ secrets.PG_CONN_STR }}"
|
PG_CONN_STR: "${{ secrets.PG_CONN_STR }}"
|
||||||
|
|
||||||
|
@ -44,6 +45,11 @@ jobs:
|
||||||
id: plan
|
id: plan
|
||||||
run: terraform plan -out=tfplan
|
run: terraform plan -out=tfplan
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
- uses: hashicorp/setup-nomad@main
|
||||||
|
- name: Install jq
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y jq
|
||||||
|
- name: Nomad Validate
|
||||||
|
run: terraform show -json tfplan | jq -r '.planned_values.root_module.child_modules[].resources[].values.jobspec' | nomad job validate -json -
|
||||||
- uses: actions/github-script@v7
|
- uses: actions/github-script@v7
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
env:
|
env:
|
||||||
|
|
4
main.tf
4
main.tf
|
@ -5,3 +5,7 @@ terraform {
|
||||||
module "dummy" {
|
module "dummy" {
|
||||||
source = "./modules/dummy"
|
source = "./modules/dummy"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module "media-centre" {
|
||||||
|
source = "./modules/media-centre"
|
||||||
|
}
|
||||||
|
|
73
modules/media-centre/jobspec.json
Normal file
73
modules/media-centre/jobspec.json
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
{
|
||||||
|
"ID": "media-centre",
|
||||||
|
"Name": "Media Centre",
|
||||||
|
"TaskGroups": [
|
||||||
|
{
|
||||||
|
"Name": "Media Servers",
|
||||||
|
"Tasks": [
|
||||||
|
{
|
||||||
|
"Name": "Jellyfin",
|
||||||
|
"Type": "docker",
|
||||||
|
"Config": {
|
||||||
|
"image": "lscr.io/linuxserver/jellyfin:latest",
|
||||||
|
"ports": [
|
||||||
|
"jellyfin"
|
||||||
|
],
|
||||||
|
"mounts": [
|
||||||
|
{
|
||||||
|
"type": "volume",
|
||||||
|
"target": "/media",
|
||||||
|
"VolumeOptions": {
|
||||||
|
"driver": "local",
|
||||||
|
"driver_opts": {
|
||||||
|
"type": "nfs",
|
||||||
|
"o": "addr=martinibar.lan,nolock,soft,rw",
|
||||||
|
"device": ":/volume1/docker"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "volume",
|
||||||
|
"target": "/config",
|
||||||
|
"source": "jellyfin-config"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Env": {
|
||||||
|
"TZ": "Europe/London",
|
||||||
|
"PUID": "985",
|
||||||
|
"PGID": "997",
|
||||||
|
"JELLYFIN_PublishedServerUrl": "192.168.1.5"
|
||||||
|
},
|
||||||
|
"Resources": {
|
||||||
|
"CPU": 3100,
|
||||||
|
"MemoryMB": 8129
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Services": [
|
||||||
|
{
|
||||||
|
"Name": "Jellyfin",
|
||||||
|
"Provider": "nomad",
|
||||||
|
"PortLabel": "jellyfin",
|
||||||
|
"Tags": [
|
||||||
|
"traefik.enable=true",
|
||||||
|
"traefik.http.routers.jellyfin.entrypoints=websecure",
|
||||||
|
"traefik.http.routers.jellyfin.rule=Host(`jellyfin.brmartin.co.uk`)"
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Networks": [
|
||||||
|
{
|
||||||
|
"DynamicPorts": [
|
||||||
|
{
|
||||||
|
"Label": "jellyfin",
|
||||||
|
"To": 8096
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
4
modules/media-centre/main.tf
Normal file
4
modules/media-centre/main.tf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
resource "nomad_job" "media-centre" {
|
||||||
|
jobspec = file("${path.module}/jobspec.json")
|
||||||
|
json = true
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue