From 4272b071e4ea8efcd2fc4167a45e8d6e93666830 Mon Sep 17 00:00:00 2001 From: marito Date: Sat, 14 Jun 2025 09:06:28 +0800 Subject: [PATCH] initialization fixed --- README.md | 21 +++++++++++++++++---- playbook.yml | 16 ++++++++++++++-- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a88d947..203b070 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,6 @@ This playbook automates the installation and setup of the **stable** version of ## Post-Installation Instructions After the playbook completes successfully: - 1. **Configure User Access:** Refresh group membership. @@ -36,7 +35,6 @@ After the playbook completes successfully: ```bash newgrp incus-admin ``` - 2. **Verify Setup:** You can test the installation by running. @@ -45,7 +43,22 @@ After the playbook completes successfully: incus --version ``` -3. **Enable and Access the Incus Web UI:** +3. **Check Incus Initialization:** + + Try checking the storage: + + ```bash + incus storage show default + ``` + > If the display is: 'Error: Storage pool not found' then initialize it through interactive mode: + + Try interactive mode if initialization failed: + + ```bash + incus admin init + ``` + +4. **Enable and Access the Incus Web UI:** Enable port 8443: @@ -62,7 +75,7 @@ After the playbook completes successfully: > Follow the self-signed certificate instructions when prompted for mLTS -4. **Incus Network - Access Containers by Name (Optional):** +5. **Incus Network - Access Containers by Name (Optional):** Configuring name-to-IP resolution so the host OS can reach Incus containers using their names. diff --git a/playbook.yml b/playbook.yml index ee0c728..5e2be81 100644 --- a/playbook.yml +++ b/playbook.yml @@ -65,17 +65,29 @@ name: [incus, incus-client, incus-ui-canonical, ufw] state: present - - name: Check if Incus is already initialized (by checking for default storage pool) + - name: Check if Incus storage pool 'default' exists command: incus storage show default register: incus_check failed_when: false changed_when: false + - name: Check if Incus bridge 'incusbr0' exists + command: incus network show incusbr0 + register: net_check + failed_when: false + changed_when: false + + - name: Check if default profile exists + command: incus profile show default + register: profile_check + failed_when: false + changed_when: false + - name: Initialize Incus daemon with preseed file (if not already initialized) script: init-incus.sh args: chdir: "{{ playbook_dir }}" - when: incus_check.rc != 0 + when: incus_check.rc != 0 and net_check.rc != 0 and profile_check.rc != 0 - name: Add target user to the incus-admin group for passwordless access user: