WIP: Add support for creating a test cluster

This will help with verifying backups and making sure my configuration
is dynamic.
This commit is contained in:
IamTheFij 2023-11-30 09:57:18 -08:00
parent 2d733b278c
commit 25fcdd2292
4 changed files with 84 additions and 0 deletions

View File

@ -106,6 +106,8 @@
- name: photoprism-media
path: /srv/volumes/photos/Photoprism
read_only: false
# TODO: If test hosts, use a different path
- name: photoprism-storage
path: /srv/volumes/nas-container/photoprism
read_only: false

View File

@ -0,0 +1,25 @@
---
- name: Stop prod cluster
hosts: nomad_instances
vars:
template_vm_name: jammy-cloud-tmpl
tasks:
- name: Stop prod cluster
community.general.proxmox_kvm:
name: "{{ test_prod_vm }}"
state: stopped
delegate_to: localhost
when: test_prod_vm
- name: Create test instances
community.general.proxmox_kvm:
clone: "{{ template_vm_name }}"
name: "{{ ansible_hostname }}"
ipconfig:
ipconfig0: "ip={{ test_ip_address }},gw=192.168.2.1"
delegate_to: localhost
- name: Wait for cluster to spin up
- import_playbook: setup-cluster.yml

View File

@ -0,0 +1,55 @@
---
all:
children:
servers:
hosts:
tn1.thefij:
test_prod_vm: n1
test_ip_address: 192.168.2.201
nomad_node_role: both
nomad_unique_host_volumes:
- name: mysql-data
path: /srv/volumes/mysql
owner: "999"
group: "100"
mode: "0755"
read_only: false
- name: postgres-data
path: /srv/volumes/postgres
owner: "999"
group: "999"
mode: "0755"
read_only: false
tn2.thefij:
test_prod_vm: n2
test_ip_address: 192.168.2.202
nomad_node_class: ingress
nomad_node_role: both
nomad_unique_host_volumes:
- name: nextcloud-data
path: /srv/volumes/nextcloud
owner: "root"
group: "bin"
mode: "0755"
read_only: false
- name: gitea-data
path: /srv/volumes/gitea
owner: "root"
group: "bin"
mode: "0755"
read_only: false
- name: sonarr-data
path: /srv/volumes/sonarr
owner: "root"
group: "bin"
mode: "0755"
read_only: false
tn3:
test_ip_address: 192.168.2.203
nomad_node_role: both
nomad_instances:
children:
servers: {}

View File

@ -37,9 +37,11 @@ job "traefik" {
dns {
servers = [
# TODO: Get these IP addresses from ansible? Or, do these need to be here?
"192.168.2.101",
"192.168.2.102",
"192.168.2.30",
# Fallback DNS IP should be static
"192.168.2.170",
]
}