manage vcpus and memory of VMs

fix kitchenowl connectivity
This commit is contained in:
Pim Kunis 2024-02-08 23:44:36 +01:00
parent 8b8106fade
commit f38b9af075
8 changed files with 36 additions and 31 deletions

View file

@ -1,11 +1,11 @@
all:
hosts:
primary:
ansible_host: 192.168.30.42
manager:
ansible_host: maestro.dmz
children:
secondaries:
workers:
hosts:
bancomart:
ansible_host: bancomart2.dmz
ansible_host: bancomart.dmz
vpay:
ansible_host: vpay2.dmz
ansible_host: vpay.dmz

View file

@ -1,23 +1,23 @@
---
- name: Setup Docker Swarm primary
hosts: primary
- name: Setup Docker Swarm manager
hosts: manager
tasks:
- name: Create Docker Swarm
docker_swarm:
- name: Get Docker Swarm primary info
- name: Get Docker Swarm manager info
docker_swarm_info:
nodes: yes
nodes_filters:
name: primary
name: manager
register: swarm_info
- hosts: secondaries
- hosts: workers
tasks:
- name: Join Docker Swarm
docker_swarm:
state: join
join_token: "{{ hostvars.primary.swarm_info.swarm_facts.JoinTokens.Worker }}"
join_token: "{{ hostvars.manager.swarm_info.swarm_facts.JoinTokens.Worker }}"
remote_addrs:
- "{{ hostvars.primary.ansible_default_ipv4.address }}"
- "{{ hostvars.manager.ansible_default_ipv4.address }}"

View file

@ -1,5 +0,0 @@
---
- name: Start Docker stacks
hosts: primary
roles:
- {role: cyberchef2, tags: cyberchef2}

View file

@ -33,8 +33,9 @@ services:
target: /data
volume:
nocopy: true
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
# TODO: fix this
# - /etc/timezone:/etc/timezone:ro
# - /etc/localtime:/etc/localtime:ro
deploy:
placement:
constraints:

View file

@ -36,6 +36,8 @@ services:
kitchenowl:
image: tombursch/kitchenowl:v92
networks:
kitchenowl:
aliases:
- kitchenowl
environment:
- JWT_SECRET_KEY={{ jwt_secret_key }}
@ -45,3 +47,4 @@ services:
target: /data
volume:
nocopy: true
hostname: kitchenowl

View file

@ -83,29 +83,30 @@
};
};
maestro2 = {
maestro = {
type = "virtual";
hypervisorName = "atlas";
nixosModule = { pkgs, lib, config, ... }: {
nixosModule = { config, ... }: {
microvm.balloonMem = 7680;
lab = {
dockerSwarm.enable = true;
vm = {
id = 1;
staticNetworking = true;
staticIPv4 = "192.168.30.42";
staticIPv6 = "2a0d:6e00:1a77:30::42";
};
};
};
};
bancomart2 = {
bancomart = {
type = "virtual";
hypervisorName = "jefke";
nixosModule = { pkgs, lib, config, ... }: {
nixosModule = {
microvm.balloonMem = 7680;
lab = {
dockerSwarm.enable = true;
vm.id = 2;
@ -113,11 +114,13 @@
};
};
vpay2 = {
vpay = {
type = "virtual";
hypervisorName = "lewis";
nixosModule = { pkgs, lib, config, ... }: {
nixosModule = {
microvm.balloonMem = 5632;
lab = {
dockerSwarm.enable = true;
vm.id = 3;

View file

@ -17,7 +17,7 @@ in
port = "5353";
host-record = [
"hermes.dmz,${cfg.dmz.ipv4.services},${cfg.dmz.ipv6.services}"
"ipv4.hermes.dmz,${cfg.dmz.ipv4.services}"
"ipv4.hermes.dmz,${cfg.dmz.ipv4.services}" # TODO: Do we need these?
"ipv6.hermes.dmz,${cfg.dmz.ipv6.services}"
];
@ -34,7 +34,7 @@ in
dhcp-host = [
"b8:27:eb:b9:ab:e2,esrom"
"ca:fe:c0:ff:ee:08,maestro,${cfg.dmz.ipv4.dockerSwarm}"
"ba:db:ee:f0:00:01,maestro,${cfg.dmz.ipv4.dockerSwarm}"
];
dhcp-option = [

View file

@ -85,6 +85,9 @@
};
microvm = {
# TODO: make this dependent on the host CPU
vcpu = 4;
shares = [{
source = "/nix/store";
mountPoint = "/nix/.ro-store";