From 781a62c881b2519e9d3ed8013a94fa6825fe15d2 Mon Sep 17 00:00:00 2001 From: James Allenby Date: Tue, 23 Jun 2026 21:58:14 +0100 Subject: [PATCH] refactor: switch to ubuntu 26.04 lts --- Justfile | 7 +----- ansible/group_vars/all.yaml | 2 ++ .../incus}/incus.yaml | 2 +- ansible/playbook.yaml | 3 --- ansible/playbooks/common.yaml | 22 ------------------- ansible/roles/common/tasks/main.yaml | 3 +++ ansible/roles/common/tasks/packages.yaml | 5 +++++ ansible/site.yaml | 5 +++++ infra/bootstrap.sh => bootstrap.sh | 9 -------- infra/main.tofu | 14 +++++++----- 10 files changed, 25 insertions(+), 47 deletions(-) create mode 100644 ansible/group_vars/all.yaml rename ansible/{inventory => inventories/incus}/incus.yaml (65%) delete mode 100644 ansible/playbook.yaml delete mode 100644 ansible/playbooks/common.yaml create mode 100644 ansible/roles/common/tasks/main.yaml create mode 100644 ansible/roles/common/tasks/packages.yaml create mode 100644 ansible/site.yaml rename infra/bootstrap.sh => bootstrap.sh (80%) diff --git a/Justfile b/Justfile index 572dc9a..c7a72b9 100644 --- a/Justfile +++ b/Justfile @@ -15,12 +15,7 @@ tofu-destroy: tofu-init tofu -chdir={{ opentofu_dir }} apply -auto-approve -destroy ansible-run-playbook: - ansible-playbook -i ansible/inventory/incus.yaml -c community.general.incus ansible/playbook.yaml - -clean: - rm ansible/hosts.ini || true - rm -r ansible/.ssh/ || true - rm admin.conf || true + ansible-playbook -i ansible/inventories/incus/incus.yaml -c community.general.incus ansible/site.yaml get-admin-conf: incus exec master-0 -- cat /etc/kubernetes/admin.conf > k8s-admin.conf diff --git a/ansible/group_vars/all.yaml b/ansible/group_vars/all.yaml new file mode 100644 index 0000000..e425179 --- /dev/null +++ b/ansible/group_vars/all.yaml @@ -0,0 +1,2 @@ +--- +ansible_python_interpreter: /usr/bin/python3 diff --git a/ansible/inventory/incus.yaml b/ansible/inventories/incus/incus.yaml similarity index 65% rename from ansible/inventory/incus.yaml rename to ansible/inventories/incus/incus.yaml index 4bd7250..46c3ae0 100644 --- a/ansible/inventory/incus.yaml +++ b/ansible/inventories/incus/incus.yaml @@ -2,4 +2,4 @@ plugin: community.general.incus strict: true remotes: - - local:deskpi-cluster + - local:home-infrastructure diff --git a/ansible/playbook.yaml b/ansible/playbook.yaml deleted file mode 100644 index 83fce0a..0000000 --- a/ansible/playbook.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- name: Provision with Incus - ansible.builtin.import_playbook: playbooks/common.yaml diff --git a/ansible/playbooks/common.yaml b/ansible/playbooks/common.yaml deleted file mode 100644 index 04c0dfc..0000000 --- a/ansible/playbooks/common.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -- name: Bootstrap - Stage 1 - hosts: all - gather_facts: false - tasks: - - name: Install Python 3 - ansible.builtin.raw: | - if ! command -v python3 >/dev/null 2>&1; then - apk add --no-cache python3 - fi - register: apk_result - changed_when: "'OK' in apk_result.stdout or 'Installing' in apk_result.stdout" - -- name: Bootstrap - Stage 2 - hosts: all - tasks: - - name: Install Python 3 Libraries - ansible.builtin.package: - name: "{{ item }}" - loop: - - py3-yaml - - py3-kubernetes diff --git a/ansible/roles/common/tasks/main.yaml b/ansible/roles/common/tasks/main.yaml new file mode 100644 index 0000000..f087a90 --- /dev/null +++ b/ansible/roles/common/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- name: Install required provision packages + ansible.builtin.import_tasks: packages.yaml diff --git a/ansible/roles/common/tasks/packages.yaml b/ansible/roles/common/tasks/packages.yaml new file mode 100644 index 0000000..6737e0f --- /dev/null +++ b/ansible/roles/common/tasks/packages.yaml @@ -0,0 +1,5 @@ +--- +- name: Upgrade all packages + ansible.builtin.package: + name: '*' + state: latest diff --git a/ansible/site.yaml b/ansible/site.yaml new file mode 100644 index 0000000..468f01f --- /dev/null +++ b/ansible/site.yaml @@ -0,0 +1,5 @@ +--- +- name: Common + hosts: all + roles: + - common diff --git a/infra/bootstrap.sh b/bootstrap.sh similarity index 80% rename from infra/bootstrap.sh rename to bootstrap.sh index 05c3221..c9e76c2 100644 --- a/infra/bootstrap.sh +++ b/bootstrap.sh @@ -11,15 +11,6 @@ PACKAGES="dropbear openssh-sftp-server python3 py3-yaml py3-kubernetes cloud-uti apk update && apk upgrade apk add ${PACKAGES} -# Enable and start services -enable_and_start() { - service="$1" - rc-update add "${service}" default - service "${service}" start -} - -enable_and_start dropbear - # increase root partition size root_dev=$(readlink -f /dev/root) disk=$(lsblk -no pkname "$root_dev") diff --git a/infra/main.tofu b/infra/main.tofu index bfd13be..47413c5 100644 --- a/infra/main.tofu +++ b/infra/main.tofu @@ -9,6 +9,8 @@ locals { master_count = 2 worker_count = 0 + + image = "ubuntu/26.04" } # --------- @@ -16,16 +18,16 @@ locals { # --------- resource "incus_project" "this" { - name = "deskpi-cluster" - description = "The emulated DeskPi Super6C stack." + name = "home-infrastructure" + description = "An emulated home infrastructure stack." } -resource "incus_image" "alpine" { +resource "incus_image" "this" { project = incus_project.this.name source_image = { remote = "images" - name = "alpine/edge" + name = local.image type = "virtual-machine" } } @@ -76,7 +78,7 @@ resource "incus_instance" "master" { project = incus_project.this.name type = "virtual-machine" - image = incus_image.alpine.fingerprint + image = incus_image.this.fingerprint profiles = [incus_profile.this.name] wait_for { @@ -127,7 +129,7 @@ resource "incus_instance" "worker" { project = incus_project.this.name type = "virtual-machine" - image = incus_image.alpine.fingerprint + image = incus_image.this.fingerprint profiles = [incus_profile.this.name] wait_for {