From 5c2b43479f35cad9952e22d8edf315c277b6dd29 Mon Sep 17 00:00:00 2001 From: marmattheo Date: Fri, 13 Jun 2025 15:17:46 +0800 Subject: [PATCH] seprate incus-network --- README.md | 10 ++++++++++ playbook.yml | 14 +++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 001f739..67e6759 100644 --- a/README.md +++ b/README.md @@ -56,4 +56,14 @@ After the playbook completes successfully: > Follow the self-signed certificate instructions when prompted for mLTS +4. **Incus Network - Access Containers by Name (Optional):** + + Configuring name-to-IP resolution so the host OS can reach Incus containers using their names. + + ```bash + ansible-playbook incus-network.yml --ask-become-pass + ``` + > After this you should be able to reach your containers via their names or with the domain .incus + + > i.e., `sudo ping container_name`, `sudo ping container_name.incus` on terminal or `http://container_name.incus` inside an nginx config diff --git a/playbook.yml b/playbook.yml index ec77b92..5849b8e 100644 --- a/playbook.yml +++ b/playbook.yml @@ -73,10 +73,17 @@ register: incus_ready until: incus_ready.rc == 0 - - name: Run incus admin init with preseed - command: incus admin init --preseed < init-preseed.yml + - name: Run incus admin init with preseed via stdin + 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') }}" + - name: Add current user to incus-admin group user: @@ -104,9 +111,6 @@ - name: Allow routed outbound traffic on incusbr0 command: ufw route allow out on incusbr0 - - name: Run incus network DNS setup - import_playbook: incus-network.yml - - name: "Post Installation Instructions" debug: msg: "Post Installation Instructions: https://git.marmattheo.com/marmattheo/LXC-Incus-stable-playbook/src/branch/master/README.md"