--- - ansible.builtin.meta: refresh_inventory - name: Wait a moment for container to be available in inventory ansible.builtin.pause: seconds: 2 - name: Debug - Check if container is in inventory ansible.builtin.debug: msg: "Container {{ lxc_hostname }} found with IP: {{ hostvars[lxc_hostname]['ansible_host'] | default('NOT FOUND') }}" - name: Wait for SSH to become available ansible.builtin.wait_for: host: "{{ hostvars[lxc_hostname]['ansible_host'] }}" port: 22 delay: 3 state: started register: ssh_wait_result until: ssh_wait_result is not failed