From 0c82504299514cc18dd84cf92b5dfb6893a58d9b Mon Sep 17 00:00:00 2001 From: Ruakij Date: Sun, 19 Mar 2023 14:00:46 +0100 Subject: [PATCH] Separate getting name and ips to fix bug easily --- kubernetes/tasks/prerequisites.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kubernetes/tasks/prerequisites.yml b/kubernetes/tasks/prerequisites.yml index 2565f85..98060e7 100644 --- a/kubernetes/tasks/prerequisites.yml +++ b/kubernetes/tasks/prerequisites.yml @@ -29,10 +29,14 @@ - import_tasks: ./prerequisites/containerd.yml +- name: Gather interface-name + set_fact: + interface: "{{ kubernetes.ipPool.nodeIp_interface | replace('-', '_') }}" + - name: Getting nodeIp-data from interface set_fact: - nodeip_ipv4: "{{ ansible_facts[ kubernetes.ipPool.nodeIp_interface ].ipv4.address }}" - nodeip_ipv6: "{{ ansible_facts[ kubernetes.ipPool.nodeIp_interface ].ipv6[0].address }}" + nodeip_ipv4: "{{ ansible_facts[ interface ].ipv4.address }}" + nodeip_ipv6: "{{ ansible_facts[ interface ].ipv6[0].address if ansible_facts[ interface ].ipv6 is defined }}" - name: Run handlers to reload configurations meta: flush_handlers