refactor: use ansible native incus connection

This commit is contained in:
2026-06-23 21:17:21 +01:00
parent f58488e5fd
commit c00faad987
5 changed files with 32 additions and 93 deletions
+5
View File
@@ -0,0 +1,5 @@
---
plugin: community.general.incus
strict: true
remotes:
- local:deskpi-cluster
+2 -35
View File
@@ -1,36 +1,3 @@
---
- name: Initialise empty disk with BTRFS
hosts: all
vars:
target_disk: /dev/disk/by-id/ata-QEMU_HARDDISK_incus_ext
tasks:
- name: Ensure btrfs-progs, parted and blkid is installed
ansible.builtin.package:
name: "{{ item }}"
state: present
loop:
- btrfs-progs
- parted
- blkid
- name: Ensure external disk has single partition on GPT
community.general.parted:
device: "{{ target_disk }}"
name: ext
number: 1
label: gpt
state: present
- name: Ensure BTRFS is formatted on external disk
community.general.filesystem:
dev: "{{ target_disk }}-part1"
fstype: btrfs
- name: Mount external disk to /mnt
ansible.posix.mount:
src: "{{ target_disk }}-part1"
path: /mnt
fstype: btrfs
state: mounted
# - name: Create BTRFS filesystem on external disk
# community.general.filesystem:
# fstype: btrfs
# dev: "{{ target_disk }}"
- name: Provision with Incus
ansible.builtin.import_playbook: playbooks/common.yaml
+22
View File
@@ -0,0 +1,22 @@
---
- 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