From b10d45da45c63ef6bda46e9c7d1df2ba86d5c15a Mon Sep 17 00:00:00 2001 From: shenlan Date: Wed, 25 Jun 2025 23:14:00 +0800 Subject: [PATCH] Fix IP resolution templating --- playbooks/roles/vhosts/gpu-k8s/tasks/install_cluster.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/playbooks/roles/vhosts/gpu-k8s/tasks/install_cluster.yml b/playbooks/roles/vhosts/gpu-k8s/tasks/install_cluster.yml index 3c105ad..bcceaa3 100644 --- a/playbooks/roles/vhosts/gpu-k8s/tasks/install_cluster.yml +++ b/playbooks/roles/vhosts/gpu-k8s/tasks/install_cluster.yml @@ -13,13 +13,13 @@ - name: Resolve master and node IPs from hostnames when needed set_fact: master_ips: >- - {{ (master_ips | default([])) | length > 0 + {{ ((master_ips | default([])) | length > 0) | ternary(master_ips, - masters | default([]) | map('extract', hostvars, 'ansible_host') | list) }} + (masters | default([]) | map('extract', hostvars, 'ansible_host') | list)) }} node_ips: >- - {{ (node_ips | default([])) | length > 0 + {{ ((node_ips | default([])) | length > 0) | ternary(node_ips, - nodes | default([]) | map('extract', hostvars, 'ansible_host') | list) }} + (nodes | default([]) | map('extract', hostvars, 'ansible_host') | list)) }} delegate_to: "{{ ops_host | default(masters | default(master_ips) | first) }}" delegate_facts: true run_once: true