feat : Add Proxmox LXC IP parsing with Ansible utils

Updated the 'wait for LXC to boot and get IP' task to use Ansible's ipaddr module for more accurate IP parsing, ensuring consistent results across different environments.
This commit is contained in:
2025-11-08 09:02:30 +01:00
parent 4561a64edb
commit d855be2c80

View File

@@ -47,10 +47,10 @@
- name: Wait for LXC to boot and get IP - name: Wait for LXC to boot and get IP
ansible.builtin.shell: "pct exec {{ lxc_id }} -- hostname -I | awk '{print $1}'" ansible.builtin.shell: "pct exec {{ lxc_id }} -- hostname -I | awk '{print $1}'"
register: lxc_ip register: lxc_ip
until: lxc_ip.stdout | ipaddr until: lxc_ip.stdout | ansible.utils.ipaddr
retries: 20 retries: 20
delay: 3 delay: 3
- name: Add temporary LXC to in-memory inventory - name: Add temporary LXC to in-memory inventory
ansible.builtin.add_host: ansible.builtin.add_host:
name: lxc_builder name: lxc_builder