From 428516978cd0a1aa929de55d1c137d655e46cc5e Mon Sep 17 00:00:00 2001 From: Jose Date: Sun, 2 Nov 2025 11:11:01 +0100 Subject: [PATCH] =?UTF-8?q?chore=20=F0=9F=93=A6:=20Improve=20setup=20proce?= =?UTF-8?q?ss=20for=20container=20creation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added checks to ensure container has an IP address and SSH is available before proceeding with the setup. This improves the reliability of the setup process. --- tasks/setupacdc.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tasks/setupacdc.yml b/tasks/setupacdc.yml index c423979..40c73dd 100644 --- a/tasks/setupacdc.yml +++ b/tasks/setupacdc.yml @@ -70,6 +70,20 @@ register: start_result changed_when: "'started' in start_result.stdout or start_result.rc == 0" + - name: Wait until container has an IP address + ansible.builtin.shell: "pct exec {{ container_id }} -- hostname -I | awk '{print $1}'" + register: lxc_ip + until: lxc_ip.stdout != "" + retries: 10 + delay: 5 + changed_when: false + + - name: Wait for SSH to become available + ansible.builtin.wait_for: + host: "{{ lxc_ip.stdout }}" + port: 22 + delay: 5 + timeout: 60 - name: Provision dc1 LXC hosts: dc1