manage vcpus and memory of VMs
fix kitchenowl connectivity
This commit is contained in:
parent
8b8106fade
commit
f38b9af075
8 changed files with 36 additions and 31 deletions
|
@ -1,11 +1,11 @@
|
||||||
all:
|
all:
|
||||||
hosts:
|
hosts:
|
||||||
primary:
|
manager:
|
||||||
ansible_host: 192.168.30.42
|
ansible_host: maestro.dmz
|
||||||
children:
|
children:
|
||||||
secondaries:
|
workers:
|
||||||
hosts:
|
hosts:
|
||||||
bancomart:
|
bancomart:
|
||||||
ansible_host: bancomart2.dmz
|
ansible_host: bancomart.dmz
|
||||||
vpay:
|
vpay:
|
||||||
ansible_host: vpay2.dmz
|
ansible_host: vpay.dmz
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Setup Docker Swarm primary
|
- name: Setup Docker Swarm manager
|
||||||
hosts: primary
|
hosts: manager
|
||||||
tasks:
|
tasks:
|
||||||
- name: Create Docker Swarm
|
- name: Create Docker Swarm
|
||||||
docker_swarm:
|
docker_swarm:
|
||||||
|
|
||||||
- name: Get Docker Swarm primary info
|
- name: Get Docker Swarm manager info
|
||||||
docker_swarm_info:
|
docker_swarm_info:
|
||||||
nodes: yes
|
nodes: yes
|
||||||
nodes_filters:
|
nodes_filters:
|
||||||
name: primary
|
name: manager
|
||||||
register: swarm_info
|
register: swarm_info
|
||||||
|
|
||||||
- hosts: secondaries
|
- hosts: workers
|
||||||
tasks:
|
tasks:
|
||||||
- name: Join Docker Swarm
|
- name: Join Docker Swarm
|
||||||
docker_swarm:
|
docker_swarm:
|
||||||
state: join
|
state: join
|
||||||
join_token: "{{ hostvars.primary.swarm_info.swarm_facts.JoinTokens.Worker }}"
|
join_token: "{{ hostvars.manager.swarm_info.swarm_facts.JoinTokens.Worker }}"
|
||||||
remote_addrs:
|
remote_addrs:
|
||||||
- "{{ hostvars.primary.ansible_default_ipv4.address }}"
|
- "{{ hostvars.manager.ansible_default_ipv4.address }}"
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
- name: Start Docker stacks
|
|
||||||
hosts: primary
|
|
||||||
roles:
|
|
||||||
- {role: cyberchef2, tags: cyberchef2}
|
|
|
@ -33,8 +33,9 @@ services:
|
||||||
target: /data
|
target: /data
|
||||||
volume:
|
volume:
|
||||||
nocopy: true
|
nocopy: true
|
||||||
- /etc/timezone:/etc/timezone:ro
|
# TODO: fix this
|
||||||
- /etc/localtime:/etc/localtime:ro
|
# - /etc/timezone:/etc/timezone:ro
|
||||||
|
# - /etc/localtime:/etc/localtime:ro
|
||||||
deploy:
|
deploy:
|
||||||
placement:
|
placement:
|
||||||
constraints:
|
constraints:
|
||||||
|
|
|
@ -36,7 +36,9 @@ services:
|
||||||
kitchenowl:
|
kitchenowl:
|
||||||
image: tombursch/kitchenowl:v92
|
image: tombursch/kitchenowl:v92
|
||||||
networks:
|
networks:
|
||||||
- kitchenowl
|
kitchenowl:
|
||||||
|
aliases:
|
||||||
|
- kitchenowl
|
||||||
environment:
|
environment:
|
||||||
- JWT_SECRET_KEY={{ jwt_secret_key }}
|
- JWT_SECRET_KEY={{ jwt_secret_key }}
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -45,3 +47,4 @@ services:
|
||||||
target: /data
|
target: /data
|
||||||
volume:
|
volume:
|
||||||
nocopy: true
|
nocopy: true
|
||||||
|
hostname: kitchenowl
|
||||||
|
|
|
@ -83,29 +83,30 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
maestro2 = {
|
maestro = {
|
||||||
type = "virtual";
|
type = "virtual";
|
||||||
hypervisorName = "atlas";
|
hypervisorName = "atlas";
|
||||||
|
|
||||||
nixosModule = { pkgs, lib, config, ... }: {
|
nixosModule = { config, ... }: {
|
||||||
|
microvm.balloonMem = 7680;
|
||||||
|
|
||||||
lab = {
|
lab = {
|
||||||
dockerSwarm.enable = true;
|
dockerSwarm.enable = true;
|
||||||
|
|
||||||
vm = {
|
vm = {
|
||||||
id = 1;
|
id = 1;
|
||||||
staticNetworking = true;
|
|
||||||
staticIPv4 = "192.168.30.42";
|
|
||||||
staticIPv6 = "2a0d:6e00:1a77:30::42";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
bancomart2 = {
|
bancomart = {
|
||||||
type = "virtual";
|
type = "virtual";
|
||||||
hypervisorName = "jefke";
|
hypervisorName = "jefke";
|
||||||
|
|
||||||
nixosModule = { pkgs, lib, config, ... }: {
|
nixosModule = {
|
||||||
|
microvm.balloonMem = 7680;
|
||||||
|
|
||||||
lab = {
|
lab = {
|
||||||
dockerSwarm.enable = true;
|
dockerSwarm.enable = true;
|
||||||
vm.id = 2;
|
vm.id = 2;
|
||||||
|
@ -113,11 +114,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
vpay2 = {
|
vpay = {
|
||||||
type = "virtual";
|
type = "virtual";
|
||||||
hypervisorName = "lewis";
|
hypervisorName = "lewis";
|
||||||
|
|
||||||
nixosModule = { pkgs, lib, config, ... }: {
|
nixosModule = {
|
||||||
|
microvm.balloonMem = 5632;
|
||||||
|
|
||||||
lab = {
|
lab = {
|
||||||
dockerSwarm.enable = true;
|
dockerSwarm.enable = true;
|
||||||
vm.id = 3;
|
vm.id = 3;
|
||||||
|
|
|
@ -17,7 +17,7 @@ in
|
||||||
port = "5353";
|
port = "5353";
|
||||||
host-record = [
|
host-record = [
|
||||||
"hermes.dmz,${cfg.dmz.ipv4.services},${cfg.dmz.ipv6.services}"
|
"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}"
|
"ipv6.hermes.dmz,${cfg.dmz.ipv6.services}"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ in
|
||||||
|
|
||||||
dhcp-host = [
|
dhcp-host = [
|
||||||
"b8:27:eb:b9:ab:e2,esrom"
|
"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 = [
|
dhcp-option = [
|
||||||
|
|
|
@ -85,6 +85,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
microvm = {
|
microvm = {
|
||||||
|
# TODO: make this dependent on the host CPU
|
||||||
|
vcpu = 4;
|
||||||
|
|
||||||
shares = [{
|
shares = [{
|
||||||
source = "/nix/store";
|
source = "/nix/store";
|
||||||
mountPoint = "/nix/.ro-store";
|
mountPoint = "/nix/.ro-store";
|
||||||
|
|
Loading…
Reference in a new issue