This commit is contained in:
Eric Meehan 2024-09-14 13:09:38 -04:00
parent e7124040c9
commit aad786cb90
9 changed files with 170 additions and 44 deletions

3
.gitmodules vendored
View File

@ -13,3 +13,6 @@
[submodule "roles/ericomeehan.nvidia_driver"]
path = roles/ericomeehan.nvidia_driver
url = https://git.eom.dev/ansible-role-nvidia-driver
[submodule "roles/ericomeehan.pykraken"]
path = roles/ericomeehan.pykraken
url = https://git.eom.dev/kraken-bot

57
bmcluster.yaml Normal file
View File

@ -0,0 +1,57 @@
---
# Master playbook for eom.dev
- name: Initialize systems
hosts: clusters
become: true
roles:
- role: ericomeehan.debian
- role: ericomeehan.ericomeehan
- name: Initialize cluster nodes
hosts: clusters
become: true
pre_tasks:
- name: Update sysctl configuration to enable IPv4 packet forwarding
lineinfile:
path: /etc/sysctl.conf
line: 'net.ipv4.ip_forward = 1'
state: present
- name: Update sysctl configuration to enable IPv6 packet forwarding
lineinfile:
path: /etc/sysctl.conf
line: 'net.ipv6.conf.all.forwarding = 1'
state: present
- name: Reload sysctl configuration
command: sysctl --system
- name: Enable br_netfilter kernel module
command: modprobe br_netfilter
- name: Add the module to a configuration file for persistence
lineinfile:
path: /etc/modules-load.d/modules.conf
line: "br_netfilter"
- name: Install kubernetes library
apt:
name: python3-kubernetes
state: present
roles:
- role: geerlingguy.containerd
- role: geerlingguy.kubernetes
- role: geerlingguy.helm
when: kubernetes_role == 'control_plane'
- role: ericomeehan.nvidia_driver
vars:
- nvidia_driver_debian_install_tesla_driver: true
when: nvidia_driver_needed == true
- name: Deploy services
hosts: alpha-control-plane
vars_files:
- vars/secrets.yaml
become: true
roles:
- role: ericomeehan.eom
vars:
target_namespace: prod
- role: ericomeehan.gondwana
vars:
target_namespace: prod

View File

@ -1,57 +1,36 @@
---
# Master playbook for eom.dev
- name: Initialize systems
hosts: clusters
become: true
roles:
- role: ericomeehan.debian
- role: ericomeehan.ericomeehan
# Playbook for deploying a Kubernetes cluster
- name: Create network bridge
- name: Create virtual machines
- name: Initialize cluster nodes
hosts: clusters
- name: Prepare cluster environments
hosts: cluster_nodes
become: true
pre_tasks:
- name: Update sysctl configuration to enable IPv4 packet forwarding
lineinfile:
path: /etc/sysctl.conf
line: 'net.ipv4.ip_forward = 1'
state: present
- name: Update sysctl configuration to enable IPv6 packet forwarding
lineinfile:
path: /etc/sysctl.conf
line: 'net.ipv6.conf.all.forwarding = 1'
state: present
- name: Reload sysctl configuration
command: sysctl --system
- name: Enable br_netfilter kernel module
command: modprobe br_netfilter
- name: Add the module to a configuration file for persistence
lineinfile:
path: /etc/modules-load.d/modules.conf
line: "br_netfilter"
- name: Install kubernetes library
apt:
name: python3-kubernetes
state: present
- name: Enable IPv4 packet forwarding
lineinfile:
path: /etc/sysctl.conf
line: 'net.ipv4.ip_forward = 1'
state: present
- name: Enable IPv6 packet forwarding
lineinfile:
path: /etc/sysctl.conf
line: 'net.ipv6.conf.all.forwarding = 1'
state: present
- name: Enable br_netfilter kernel module
command: modprobe br_netfilter
- name: Persist br_netfilter kernel module
lineinfile:
path: /etc/modules-load.d/modules.conf
line: "br_netfilter"
- name: Reload sysctl configuration
command: sysctl --system
roles:
- role: geerlingguy.containerd
- role: geerlingguy.kubernetes
- role: geerlingguy.helm
when: kubernetes_role == 'control_plane'
- role: ericomeehan.nvidia_driver
vars:
- nvidia_driver_debian_install_tesla_driver: true
when: nvidia_driver_needed == true
- name: Deploy services
hosts: alpha-control-plane
vars_files:
- vars/secrets.yaml
become: true
roles:
- role: ericomeehan.eom
vars:
target_namespace: prod
- role: ericomeehan.gondwana
vars:
target_namespace: prod

11
inventories/old.yml Normal file
View File

@ -0,0 +1,11 @@
---
all:
children:
clusters:
children:
alpha:
hosts:
alpha-control-plane:
ansible-host: 192.168.1.137
alpha-worker-0:
ansible-host: 192.168.1.138

7
kraken-bot.yaml Normal file
View File

@ -0,0 +1,7 @@
---
# Playbook to deploy kraken bot
- name: Deploy Kraken bot
hosts: alpha-control-plane
become: true
roles:
- role: ericomeehan.pykraken

@ -0,0 +1 @@
Subproject commit d14bd9b4fcb3e5ad5327e38515f1d67c4e2a0d49

15
servers.yaml Normal file
View File

@ -0,0 +1,15 @@
---
# Playbook for deploying server infrastructure
- name: Initialize systems
hosts: clusters
become: true
roles:
- role: ericomeehan.debian
- role: ericomeehan.ericomeehan
tasks:
- name: Install QEMU
apt:
state: present
name:
- qemu-system
- libvirt-daemon-system

52
templates/qemu_vm.xml.j2 Normal file
View File

@ -0,0 +1,52 @@
<domain type='kvm'>
<name>{{ vm_name }}</name>
<memory unit='MiB'>{{ vm_ram_mb }}</memory>
<vcpu placement='static'>{{ vm_vcpus }}</vcpu>
<os>
<type arch='x86_64' machine='pc-q35-5.2'>hvm</type>
<boot dev='hd'/>
</os>
<cpu mode='host-model' check='none'/>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='{{ libvirt_pool_dir }}/{{ vm_name }}.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
</disk>
<interface type='network'>
<source network='{{ vm_net }}'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
<channel type='unix'>
<target type='virtio' name='org.qemu.guest_agent.0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
<address type='virtio-serial' controller='0' bus='0' port='2'/>
</channel>
<input type='tablet' bus='usb'>
<address type='usb' bus='0' port='1'/>
</input>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='spice' autoport='yes'>
<listen type='address'/>
<image compression='off'/>
</graphics>
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
</memballoon>
<rng model='virtio'>
<backend model='random'>/dev/urandom</backend>
<address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
</rng>
</devices>
</domain>

View File

@ -25,6 +25,7 @@
- davfs2
- gimp
- git
- gnome-boxes
- gphoto2
- gpsd
- latexml