From fda363ea5a5ab59570f2ae09fc6b14d5c5a17366 Mon Sep 17 00:00:00 2001 From: Robert Bohne Date: Tue, 27 Jul 2021 08:52:01 +0200 Subject: [PATCH] Added an IPv6 check Playbook fails with propper error msg if IPv6 is enabled but not available. --- ansible/roles/openshift-4-cluster/tasks/create-network.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ansible/roles/openshift-4-cluster/tasks/create-network.yml b/ansible/roles/openshift-4-cluster/tasks/create-network.yml index 00438fd3..4249e05a 100644 --- a/ansible/roles/openshift-4-cluster/tasks/create-network.yml +++ b/ansible/roles/openshift-4-cluster/tasks/create-network.yml @@ -4,6 +4,13 @@ # src: templates/network.xml.j2 # dest: network.xml +- name: Check IPv6 + fail: + msg: "IPv6 is enabled via ip_families but your Host system do not have a public IPv6 subnet configured." + when: + - "'IPv6' in ip_families" + - hostvars['localhost']['ansible_default_ipv6'] | length == 0 + - name: Build IPv6 subnet set_fact: vn_subnet_ipv6: "{{ hostvars['localhost']['ansible_default_ipv6']['address'].split(':')[:4] | join(':') | string}}:{{ '%x' % vn_subnet.split('.')[2] | int }}"