Compare commits
2 Commits
c00faad987
...
781a62c881
| Author | SHA1 | Date | |
|---|---|---|---|
| 781a62c881 | |||
| 0cc8ea528a |
@@ -12,3 +12,7 @@ indent_style = space
|
|||||||
[*.json]
|
[*.json]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
indent_style = space
|
indent_style = space
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
|||||||
@@ -15,12 +15,7 @@ tofu-destroy: tofu-init
|
|||||||
tofu -chdir={{ opentofu_dir }} apply -auto-approve -destroy
|
tofu -chdir={{ opentofu_dir }} apply -auto-approve -destroy
|
||||||
|
|
||||||
ansible-run-playbook:
|
ansible-run-playbook:
|
||||||
ansible-playbook -i ansible/inventory/incus.yaml -c community.general.incus ansible/playbook.yaml
|
ansible-playbook -i ansible/inventories/incus/incus.yaml -c community.general.incus ansible/site.yaml
|
||||||
|
|
||||||
clean:
|
|
||||||
rm ansible/hosts.ini || true
|
|
||||||
rm -r ansible/.ssh/ || true
|
|
||||||
rm admin.conf || true
|
|
||||||
|
|
||||||
get-admin-conf:
|
get-admin-conf:
|
||||||
incus exec master-0 -- cat /etc/kubernetes/admin.conf > k8s-admin.conf
|
incus exec master-0 -- cat /etc/kubernetes/admin.conf > k8s-admin.conf
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
plugin: community.general.incus
|
plugin: community.general.incus
|
||||||
strict: true
|
strict: true
|
||||||
remotes:
|
remotes:
|
||||||
- local:deskpi-cluster
|
- local:home-infrastructure
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Provision with Incus
|
|
||||||
ansible.builtin.import_playbook: playbooks/common.yaml
|
|
||||||
@@ -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
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
- name: Install required provision packages
|
||||||
|
ansible.builtin.import_tasks: packages.yaml
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: Upgrade all packages
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: '*'
|
||||||
|
state: latest
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: Common
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- common
|
||||||
@@ -11,15 +11,6 @@ PACKAGES="dropbear openssh-sftp-server python3 py3-yaml py3-kubernetes cloud-uti
|
|||||||
apk update && apk upgrade
|
apk update && apk upgrade
|
||||||
apk add ${PACKAGES}
|
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
|
# increase root partition size
|
||||||
root_dev=$(readlink -f /dev/root)
|
root_dev=$(readlink -f /dev/root)
|
||||||
disk=$(lsblk -no pkname "$root_dev")
|
disk=$(lsblk -no pkname "$root_dev")
|
||||||
+8
-6
@@ -9,6 +9,8 @@ locals {
|
|||||||
|
|
||||||
master_count = 2
|
master_count = 2
|
||||||
worker_count = 0
|
worker_count = 0
|
||||||
|
|
||||||
|
image = "ubuntu/26.04"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ---------
|
# ---------
|
||||||
@@ -16,16 +18,16 @@ locals {
|
|||||||
# ---------
|
# ---------
|
||||||
|
|
||||||
resource "incus_project" "this" {
|
resource "incus_project" "this" {
|
||||||
name = "deskpi-cluster"
|
name = "home-infrastructure"
|
||||||
description = "The emulated DeskPi Super6C stack."
|
description = "An emulated home infrastructure stack."
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "incus_image" "alpine" {
|
resource "incus_image" "this" {
|
||||||
project = incus_project.this.name
|
project = incus_project.this.name
|
||||||
|
|
||||||
source_image = {
|
source_image = {
|
||||||
remote = "images"
|
remote = "images"
|
||||||
name = "alpine/edge"
|
name = local.image
|
||||||
type = "virtual-machine"
|
type = "virtual-machine"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,7 +78,7 @@ resource "incus_instance" "master" {
|
|||||||
project = incus_project.this.name
|
project = incus_project.this.name
|
||||||
|
|
||||||
type = "virtual-machine"
|
type = "virtual-machine"
|
||||||
image = incus_image.alpine.fingerprint
|
image = incus_image.this.fingerprint
|
||||||
profiles = [incus_profile.this.name]
|
profiles = [incus_profile.this.name]
|
||||||
|
|
||||||
wait_for {
|
wait_for {
|
||||||
@@ -127,7 +129,7 @@ resource "incus_instance" "worker" {
|
|||||||
project = incus_project.this.name
|
project = incus_project.this.name
|
||||||
|
|
||||||
type = "virtual-machine"
|
type = "virtual-machine"
|
||||||
image = incus_image.alpine.fingerprint
|
image = incus_image.this.fingerprint
|
||||||
profiles = [incus_profile.this.name]
|
profiles = [incus_profile.this.name]
|
||||||
|
|
||||||
wait_for {
|
wait_for {
|
||||||
|
|||||||
Reference in New Issue
Block a user