From dfe7bbf4a77d7dca94dfdb948ef665fcc919e3cd Mon Sep 17 00:00:00 2001 From: juvdiaz Date: Tue, 26 May 2026 23:01:22 -0600 Subject: [PATCH] Skip manually created first Pimox worker --- README.md | 12 ++++++++++++ lab.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/README.md b/README.md index e5a2557..d8dbb91 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,13 @@ clones on `nvme_thin_pool` by default, checks that the Pimox bridge already exists, refuses `local` as worker clone storage, and refuses to edit Orange Pi host networking. +`LAB_PIMOX_SKIP_WORKER_INDEXES` defaults to `1` because the first Pimox worker +slot was created manually. With the default `LAB_PIMOX_WORKER_COUNT=1`, the +pipeline keeps the template current and leaves VMID `9010` alone. Set +`LAB_PIMOX_SKIP_WORKER_INDEXES=''` if you want the pipeline to own the first +slot, or set `LAB_PIMOX_WORKER_COUNT=2` to manage the second slot while still +skipping the first. + OpenWrt firewall VM automation is opt-in because it attaches to both WAN and LAN bridges. Set `LAB_OPENWRT_VM=true` after `vmbr1` already exists on the Orange Pi. The pipeline downloads the OpenWrt ARM SystemReady EFI image, writes @@ -146,6 +153,11 @@ the observed host: Pimox SSH host `192.168.100.80`, bridge `vmbr0`, template VMI storage `nvme_thin_pool`. Details and override variables are in `bootstrap/provisioning/README.md`. +Worker indexes are stable. Index `1` maps to VMID `9010`, node name +`pimox-worker-01`, and worker key `pimox01`; index `2` maps to VMID `9011`, and +so on. `LAB_PIMOX_SKIP_WORKER_INDEXES=1` leaves the already-created first slot +unmanaged while allowing higher indexes to be automated. + Add entries to `bootstrap/cluster/variables.tf` or a `.tfvars` file: ```hcl diff --git a/lab.sh b/lab.sh index 1525fc9..e13ff2f 100755 --- a/lab.sh +++ b/lab.sh @@ -60,6 +60,26 @@ disabled_value() { esac } +worker_index_is_skipped() { + local index="$1" + local skip_indexes="$2" + local skip_index + + skip_indexes="${skip_indexes//,/ }" + for skip_index in ${skip_indexes}; do + [[ -z "${skip_index}" ]] && continue + if ! [[ "${skip_index}" =~ ^[0-9]+$ ]]; then + echo "LAB_PIMOX_SKIP_WORKER_INDEXES must contain only comma or space separated positive integers." >&2 + exit 1 + fi + if ((skip_index == index)); then + return 0 + fi + done + + return 1 +} + ensure_python3() { if command -v python3 >/dev/null 2>&1; then return 0 @@ -305,6 +325,7 @@ run_pimox_pipeline() { local worker_name_prefix="${LAB_PIMOX_WORKER_NAME_PREFIX:-pimox-worker}" local worker_node_prefix="${LAB_PIMOX_WORKER_NODE_PREFIX:-pimox-worker}" local worker_key_prefix="${LAB_PIMOX_WORKER_KEY_PREFIX:-pimox}" + local worker_skip_indexes="${LAB_PIMOX_SKIP_WORKER_INDEXES:-1}" local worker_cores="${LAB_PIMOX_WORKER_CORES:-2}" local worker_memory="${LAB_PIMOX_WORKER_MEMORY:-2048}" local worker_storage="${LAB_PIMOX_WORKER_STORAGE:-${TF_VAR_pimox_worker_storage:-nvme_thin_pool}}" @@ -403,6 +424,11 @@ fi" 2>&1)" mkdir -p "${REPO_ROOT}/.lab" : >"${spec_file}" for ((index = 1; index <= worker_count; index++)); do + if worker_index_is_skipped "${index}" "${worker_skip_indexes}"; then + echo "Skipping Pimox worker index ${index} because LAB_PIMOX_SKIP_WORKER_INDEXES=${worker_skip_indexes}." + continue + fi + ensure_pimox_worker_node \ "${index}" \ "${spec_file}" \