Compare commits
1 Commits
main
..
b46d163bae
| Author | SHA1 | Date | |
|---|---|---|---|
| b46d163bae |
@@ -3,7 +3,6 @@
|
||||
terraform.tfstate
|
||||
terraform.tfstate.backup
|
||||
ansible/lookup_plugins
|
||||
ansible/galaxy_roles
|
||||
|
||||
!.gitignore
|
||||
!.editorconfig
|
||||
|
||||
@@ -4,17 +4,16 @@ opentofu_dir := "infra/"
|
||||
ansible_proton_pass_plugin_ref := "4bd0741c347646060ec59c73f8adf7ed8e706cf3"
|
||||
ansible_proton_pass_plugin_url := "https://raw.githubusercontent.com/protonpass/proton-pass-ansible-integration/" + ansible_proton_pass_plugin_ref + "/lookup_plugins/proton_pass.py"
|
||||
|
||||
init: tofu-init fetch-ansible-deps fetch-ansible-plugins
|
||||
up: tofu-apply ansible-run-playbook
|
||||
down: tofu-destroy
|
||||
|
||||
tofu-init:
|
||||
tofu -chdir={{ opentofu_dir }} init -upgrade
|
||||
|
||||
tofu-apply:
|
||||
tofu-apply: tofu-init
|
||||
tofu -chdir={{ opentofu_dir }} apply -auto-approve
|
||||
|
||||
tofu-destroy:
|
||||
tofu-destroy: tofu-init
|
||||
tofu -chdir={{ opentofu_dir }} apply -auto-approve -destroy
|
||||
|
||||
tofu-destroy-instances:
|
||||
@@ -31,9 +30,6 @@ headlamp:
|
||||
clean: tofu-destroy
|
||||
git clean -fdx
|
||||
|
||||
fetch-ansible-deps:
|
||||
ansible-galaxy install --role-file ansible/requirements.yml --roles-path ansible/galaxy_roles
|
||||
|
||||
fetch-ansible-plugins:
|
||||
fetch-plugins:
|
||||
mkdir -p ansible/lookup_plugins
|
||||
curl -fsSL -o ansible/lookup_plugins/proton_pass.py {{ ansible_proton_pass_plugin_url }}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
# Home Infrastructure
|
||||
|
||||
An Ansible + OpenTofu project for installing a minimal Kubernetes installation
|
||||
to bare-metal and virtual machines.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Get started with a local Kubernetes cluster which can be used to design and test
|
||||
@@ -16,19 +13,13 @@ new configuration before pushing them to real machines.
|
||||
export SSH_AUTH_SOCK="$HOME/.ssh/proton-pass-agent.sock"
|
||||
```
|
||||
|
||||
2. Install the Proton Pass plugin for Ansible
|
||||
|
||||
```shell
|
||||
just fetch-plugins
|
||||
```
|
||||
|
||||
3. Launch Incus virtual machines
|
||||
2. Launch Incus virtual machines
|
||||
|
||||
```shell
|
||||
just up
|
||||
```
|
||||
|
||||
4. Tear down the Incus virtual machines
|
||||
3. Tear down the Incus virtual machines
|
||||
|
||||
```shell
|
||||
just down
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
[defaults]
|
||||
roles_path = ansible/roles:ansible/galaxy_roles
|
||||
lookup_plugins = ansible/lookup_plugins
|
||||
callback_result_format = yaml
|
||||
|
||||
-1
@@ -3,6 +3,5 @@ ansible_become_exe: sudo.ws
|
||||
ansible_user: kolibri
|
||||
vip_interface: eno1
|
||||
vip_address: 10.0.0.200
|
||||
cluster_name: hive
|
||||
cluster_pod_subnet: 172.16.0.0/16
|
||||
cluster_service_subnet: 10.96.0.0/16
|
||||
@@ -0,0 +1,8 @@
|
||||
masters:
|
||||
hosts:
|
||||
vineta:
|
||||
ansible_host: 10.0.0.201
|
||||
rotfront:
|
||||
ansible_host: 10.0.0.202
|
||||
leng:
|
||||
ansible_host: 10.0.0.203
|
||||
@@ -1,8 +0,0 @@
|
||||
masters:
|
||||
hosts:
|
||||
vineta:
|
||||
ansible_host: vineta.local
|
||||
rotfront:
|
||||
ansible_host: rotfront.local
|
||||
leng:
|
||||
ansible_host: leng.local
|
||||
@@ -2,6 +2,5 @@ ansible_python_interpreter: /usr/bin/python3
|
||||
ansible_user: kolibri
|
||||
vip_interface: enp5s0
|
||||
vip_address: 10.150.0.100
|
||||
cluster_name: hive
|
||||
cluster_pod_subnet: 172.16.0.0/16
|
||||
cluster_service_subnet: 10.96.0.0/16
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
- name: Configure performance tuning
|
||||
hosts: all
|
||||
become: true
|
||||
roles:
|
||||
- giovtorres.tuned
|
||||
- irqbalance
|
||||
@@ -10,7 +10,6 @@
|
||||
groups:
|
||||
- sudo
|
||||
shell: /bin/bash
|
||||
system: true
|
||||
|
||||
- name: Ensure authorised keys for Kolibri
|
||||
ansible.posix.authorized_key:
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
collections:
|
||||
- ansible.posix
|
||||
roles:
|
||||
- name: giovtorres.tuned
|
||||
version: 2.0.2
|
||||
@@ -1,11 +0,0 @@
|
||||
---
|
||||
- name: Install irqbalance
|
||||
ansible.builtin.package:
|
||||
name: irqbalance
|
||||
state: present
|
||||
|
||||
- name: Ensure irqbalance service
|
||||
ansible.builtin.service:
|
||||
name: irqbalance
|
||||
state: started
|
||||
enabled: true
|
||||
@@ -2,13 +2,13 @@
|
||||
ansible.builtin.import_tasks: kube-vip.yaml
|
||||
|
||||
- name: Initialise Kubernetes cluster
|
||||
ansible.builtin.import_tasks: init-cluster.yaml
|
||||
ansible.builtin.include_tasks: init-cluster.yaml
|
||||
|
||||
- name: Join nodes as control planes
|
||||
ansible.builtin.import_tasks: join-cluster.yaml
|
||||
ansible.builtin.include_tasks: join-cluster.yaml
|
||||
|
||||
- name: Copy Kubernetes admin configuration on all nodes
|
||||
ansible.builtin.import_tasks: copy-config.yaml
|
||||
ansible.builtin.include_tasks: copy-config.yaml
|
||||
|
||||
- name: Remove control plane scheduling restrictions
|
||||
ansible.builtin.import_tasks: untaint.yaml
|
||||
ansible.builtin.include_tasks: untaint.yaml
|
||||
|
||||
@@ -4,7 +4,7 @@ kind: InitConfiguration
|
||||
---
|
||||
apiVersion: kubeadm.k8s.io/v1beta4
|
||||
kind: ClusterConfiguration
|
||||
clusterName: "{{ cluster_name }}"
|
||||
clusterName: aeon
|
||||
controlPlaneEndpoint: "{{ vip_address }}"
|
||||
networking:
|
||||
podSubnet: "{{ cluster_pod_subnet }}"
|
||||
|
||||
+4
-3
@@ -1,6 +1,3 @@
|
||||
- name: Apply power and performance settings
|
||||
ansible.builtin.import_playbook: playbooks/performance.yaml
|
||||
|
||||
- name: Baseline configuration
|
||||
hosts: all
|
||||
become: true
|
||||
@@ -8,6 +5,10 @@
|
||||
- common
|
||||
- kubernetes_common
|
||||
|
||||
# ========================
|
||||
# Setup Kubernetes Cluster
|
||||
# ========================
|
||||
|
||||
- name: Initialise Kubernetes Cluster
|
||||
hosts: masters
|
||||
become: true
|
||||
|
||||
+8
-4
@@ -3,10 +3,14 @@
|
||||
# ------
|
||||
|
||||
locals {
|
||||
image = "ubuntu/26.04"
|
||||
root_disk_size = "16GiB"
|
||||
ext_disk_size = "16GiB"
|
||||
network_cidr = "10.150.0.1/24"
|
||||
|
||||
master_count = 3
|
||||
worker_count = 0
|
||||
|
||||
image = "ubuntu/26.04"
|
||||
}
|
||||
|
||||
# ---------
|
||||
@@ -42,7 +46,7 @@ resource "incus_network" "this" {
|
||||
|
||||
module "master" {
|
||||
source = "./modules/incus_vm"
|
||||
count = var.master_count
|
||||
count = local.master_count
|
||||
|
||||
name = "master-${count.index}"
|
||||
project = incus_project.this.name
|
||||
@@ -56,7 +60,7 @@ module "master" {
|
||||
|
||||
module "worker" {
|
||||
source = "./modules/incus_vm"
|
||||
count = var.worker_count
|
||||
count = local.worker_count
|
||||
|
||||
name = "worker-${count.index}"
|
||||
project = incus_project.this.name
|
||||
@@ -73,7 +77,7 @@ module "worker" {
|
||||
# ---------
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.11.5"
|
||||
required_version = "~> 1.12"
|
||||
|
||||
required_providers {
|
||||
incus = {
|
||||
|
||||
@@ -1,17 +1,3 @@
|
||||
variable "master_count" {
|
||||
description = "The number of master nodes to provision."
|
||||
type = number
|
||||
default = 1
|
||||
nullable = false
|
||||
}
|
||||
|
||||
variable "worker_count" {
|
||||
description = "The number of worker nodes to provision."
|
||||
type = number
|
||||
default = 0
|
||||
nullable = false
|
||||
}
|
||||
|
||||
variable "cpus" {
|
||||
description = "The number of CPU cores allocated to each virtual machine."
|
||||
type = number
|
||||
|
||||
Reference in New Issue
Block a user