add expand to two hypervisors

This commit is contained in:
Pim Kunis 2023-05-04 12:29:29 +02:00
parent d8787fa9a6
commit ed6723e1da
11 changed files with 105 additions and 43 deletions

View file

@ -1,18 +1,22 @@
docker_node_labels:
- hostname: maestro
labels: {}
- hostname: swarmpub1
labels:
traefik: "true"
forgejo: "true"
- hostname: worker1
labels:
syncthing: "true"
seafile: "true"
radicale: "true"
public: "true"
mastodon: "true"
freshrss: "true"
hedgedoc: "true"
- hostname: swarmpub2
labels:
public: "true"
- hostname: swarmpriv1
labels:
private: "true"
overleaf: "true"
data_directories:
- 'traefik'
- 'forgejo'
syncthing: "true"
hedgedoc: "true"
radicale: "true"
- hostname: swarmpriv2
labels:
private: "true"
seafile: "true"
freshrss: "true"

View file

@ -1,4 +0,0 @@
data_directories:
- 'syncthing'
- 'seafile/data'
- 'seafile/db'

View file

@ -5,5 +5,11 @@ all:
children:
workers:
hosts:
worker1:
ansible_host: worker1.dmz
swarmpub1:
ansible_host: swarmpub1.dmz
swarmpub2:
ansible_host: swarmpub2.dmz
swarmpriv1:
ansible_host: swarmpriv1.dmz
swarmpriv2:
ansible_host: swarmpriv2.dmz

View file

@ -15,15 +15,6 @@
changed_when: "rm.rc == 0"
failed_when: "false"
# TODO: this creates permission issues. Should create them by hand for now.
# - name: Create data directories
# file:
# state: directory
# path: "{{ data_directory_base }}/{{ item }}"
# recurse: true
# mode: 0777
# loop: "{{ data_directories }}"
roles:
- setup_apt
- docker

View file

@ -11,6 +11,9 @@ services:
networks:
- traefik
deploy:
placement:
constraints:
- "node.labels.public == true"
labels:
- traefik.enable=true
- traefik.http.routers.cyberchef.entrypoints=websecure

View file

@ -28,7 +28,7 @@ services:
deploy:
placement:
constraints:
- "node.labels.forgejo == true"
- node.role == manager
labels:
- traefik.port=443
- traefik.enable=true

View file

@ -2,8 +2,12 @@
version: "3.7"
services:
kms-server:
image: inbucket/inbucket
ports:
- 2500:2500
- 9000:9000
kms-server:
image: inbucket/inbucket
ports:
- 2500:2500
- 9000:9000
deploy:
placement:
constraints:
- "node.labels.public == true"

View file

@ -6,3 +6,7 @@ services:
image: teddysun/kms
ports:
- 1688:1688
deploy:
placement:
constraints:
- "node.labels.public == true"

View file

@ -20,7 +20,8 @@ services:
- 444:444
deploy:
placement:
constraints: [node.labels.traefik == true]
constraints:
- node.role == manager
labels:
- traefik.enable=true
- traefik.http.routers.dashboard.entrypoints=localsecure

View file

@ -1,3 +1,8 @@
- name: Create working directory
file:
path: /srv/traefik
state: directory
- name: Create Traefik network
docker_network:
name: traefik

View file

@ -15,20 +15,68 @@ provider "libvirt" {
uri = "qemu+ssh://root@atlas.hyp/system"
}
provider "libvirt" {
alias = "jefke"
uri = "qemu+ssh://root@jefke.hyp/system"
}
module "manager" {
source = "git::https://git.pim.kunis.nl/home/tf-modules.git//debian"
#source = "git::https://git.pim.kunis.nl/home/tf-modules.git//debian"
source = "/home/pim/repos/tf-modules/debian"
name = "maestro"
domain_name = "tf-maestro"
memory = 1024
mac = "CA:FE:C0:FF:EE:08"
hypervisor_host = "atlas.hyp"
providers = {
libvirt = libvirt
}
}
module "workers" {
for_each = {
worker1 = "tf-worker1"
module "swarmpub1" {
#source = "git::https://git.pim.kunis.nl/home/tf-modules.git//debian"
source = "/home/pim/repos/tf-modules/debian"
name = "swarmpub1"
domain_name = "tf-swarmpub1"
memory = 1024 * 5
hypervisor_host = "atlas.hyp"
providers = {
libvirt = libvirt
}
}
module "swarmpriv1" {
#source = "git::https://git.pim.kunis.nl/home/tf-modules.git//debian"
source = "/home/pim/repos/tf-modules/debian"
name = "swarmpriv1"
domain_name = "tf-swarmpriv1"
memory = 1024 * 5
hypervisor_host = "atlas.hyp"
providers = {
libvirt = libvirt
}
}
module "swarmpub2" {
#source = "git::https://git.pim.kunis.nl/home/tf-modules.git//debian"
source = "/home/pim/repos/tf-modules/debian"
name = "swarmpub2"
domain_name = "tf-swarmpub2"
memory = 1024 * 3
hypervisor_host = "jefke.hyp"
providers = {
libvirt = libvirt.jefke
}
}
module "swarmpriv2" {
#source = "git::https://git.pim.kunis.nl/home/tf-modules.git//debian"
source = "/home/pim/repos/tf-modules/debian"
name = "swarmpriv2"
domain_name = "tf-swarmpriv2"
memory = 1024 * 3
hypervisor_host = "jefke.hyp"
providers = {
libvirt = libvirt.jefke
}
source = "git::https://git.pim.kunis.nl/home/tf-modules.git//debian"
name = each.key
domain_name = each.value
memory = 1024 * 3
}