From e2bec3f7177ad04890a4ffdc36aad8765ae5fc4e Mon Sep 17 00:00:00 2001 From: marmattheo Date: Fri, 13 Jun 2025 15:32:15 +0800 Subject: [PATCH] seperated preseed data --- playbook.yml | 14 +++++++------- preseed-network-storage.yml | 13 +++++++++++++ preseed-profile.yml | 26 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 preseed-network-storage.yml create mode 100644 preseed-profile.yml diff --git a/playbook.yml b/playbook.yml index 5849b8e..73f0d7e 100644 --- a/playbook.yml +++ b/playbook.yml @@ -73,17 +73,17 @@ register: incus_ready until: incus_ready.rc == 0 - - name: Run incus admin init with preseed via stdin + - name: Preseed network and storage command: incus admin init --preseed args: chdir: "{{ playbook_dir }}" - register: init_result - become: true - become_user: root - vars: - ansible_shell_type: sh - stdin: "{{ lookup('file', 'init-preseed.yml') }}" + stdin: "{{ lookup('file', 'preseed-network-storage.yml') }}" + - name: Preseed profile and global config + command: incus admin init --preseed + args: + chdir: "{{ playbook_dir }}" + stdin: "{{ lookup('file', 'preseed-profile.yml') }}" - name: Add current user to incus-admin group user: diff --git a/preseed-network-storage.yml b/preseed-network-storage.yml new file mode 100644 index 0000000..a843a92 --- /dev/null +++ b/preseed-network-storage.yml @@ -0,0 +1,13 @@ +networks: +- config: + ipv4.address: 10.69.69.1/24 + ipv4.nat: "true" + ipv6.address: none + name: incusbr0 + type: bridge + +storage_pools: +- config: + source: /var/lib/incus/storage-pools/default + name: default + driver: dir diff --git a/preseed-profile.yml b/preseed-profile.yml new file mode 100644 index 0000000..7d26b31 --- /dev/null +++ b/preseed-profile.yml @@ -0,0 +1,26 @@ +profiles: +- name: default + config: {} + description: Default Incus profile + devices: + eth0: + name: eth0 + network: incusbr0 + type: nic + root: + path: / + pool: default + type: disk + +config: + core.https_address: :8443 + +projects: +- name: default + config: + features.images: "true" + features.networks: "true" + features.profiles: "true" + features.storage.volumes: "true" + features.storage.buckets: "true" + features.networks.zones: "true"