diff --git a/provision/ansible/requirements.yml b/provision/ansible/requirements.yml index 8e6a75d8..c083ee14 100644 --- a/provision/ansible/requirements.yml +++ b/provision/ansible/requirements.yml @@ -6,6 +6,8 @@ collections: version: 1.2.1 - name: ansible.posix version: 1.3.0 + - name: ansible.utils + version: 2.6.1 roles: - src: xanmanning.k3s version: v3.1.2 diff --git a/provision/ansible/roles/ubuntu/tasks/checks.yml b/provision/ansible/roles/ubuntu/tasks/checks.yml new file mode 100644 index 00000000..9c95a42d --- /dev/null +++ b/provision/ansible/roles/ubuntu/tasks/checks.yml @@ -0,0 +1,17 @@ +--- +- name: Check if network interface provided for kube-vip is valid + ansible.builtin.assert: + that: + - ansible_{{ kubevip_interface }}.device is defined + - ansible_{{ kubevip_interface }}['ipv4']['address'] | ansible.utils.ipaddr('{{ ansible_host }}') + success_msg: |- + kube-vip is able to use {{ kubevip_interface }} for this node + fail_msg: |- + This node does not have a network interface called {{ kubevip_interface }}. + + You either provided the wrong BOOTSTRAP_KUBE_VIP_INTERFACE value or your nodes have different network interface names. + + See this link on how to set static interface names across your nodes by using netplan + https://askubuntu.com/a/1317043 + when: + "'master' in group_names" diff --git a/provision/ansible/roles/ubuntu/tasks/main.yml b/provision/ansible/roles/ubuntu/tasks/main.yml index df35ef64..988e976f 100644 --- a/provision/ansible/roles/ubuntu/tasks/main.yml +++ b/provision/ansible/roles/ubuntu/tasks/main.yml @@ -1,4 +1,8 @@ --- +- include: checks.yml + tags: + - checks + - include: locale.yml tags: - locale