2018-08-23 14:17:18 +00:00
|
|
|
---
|
|
|
|
- name: "Check vars defined correctly"
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "calico_pool_name is defined"
|
2018-10-17 19:27:11 +00:00
|
|
|
- "calico_pool_name is match('^[a-zA-Z0-9-_\\\\.]{2,63}$')"
|
2020-03-12 08:20:37 +00:00
|
|
|
msg: "calico_pool_name contains invalid characters"
|
|
|
|
|
|
|
|
- name: "Check calico network backend defined correctly"
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "calico_network_backend in ['bird', 'vxlan', 'none']"
|
|
|
|
msg: "calico network backend is not 'bird', 'vxlan' or 'none'"
|
|
|
|
when:
|
|
|
|
- calico_network_backend is defined
|
|
|
|
|
|
|
|
- name: "Check ipip and vxlan mode defined correctly"
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "calico_ipip_mode in ['Always', 'CrossSubnet', 'Never']"
|
|
|
|
- "calico_vxlan_mode in ['Always', 'CrossSubnet', 'Never']"
|
|
|
|
msg: "calico inter host encapsulation mode is not 'Always', 'CrossSubnet' or 'Never'"
|
|
|
|
|
|
|
|
- name: "Check ipip and vxlan mode if simultaneously enabled"
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "calico_vxlan_mode in ['Never']"
|
|
|
|
msg: "IP in IP and VXLAN mode is mutualy exclusive modes"
|
|
|
|
when:
|
|
|
|
- "calico_ipip_mode in ['Always', 'CrossSubnet']"
|
|
|
|
|
|
|
|
- name: "Check ipip and vxlan mode if simultaneously enabled"
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "calico_ipip_mode in ['Never']"
|
|
|
|
msg: "IP in IP and VXLAN mode is mutualy exclusive modes"
|
|
|
|
when:
|
|
|
|
- "calico_vxlan_mode in ['Always', 'CrossSubnet']"
|
2018-08-23 14:17:18 +00:00
|
|
|
|
2020-09-03 06:55:40 +00:00
|
|
|
- name: "Get current version of calico cluster version"
|
|
|
|
shell: "set -o pipefail && {{ bin_dir }}/calicoctl.sh version | grep 'Cluster Version:' | awk '{ print $3}'"
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2018-08-23 14:17:18 +00:00
|
|
|
register: calico_version_on_server
|
2020-08-21 07:13:51 +00:00
|
|
|
async: 10
|
|
|
|
poll: 3
|
2018-08-23 14:17:18 +00:00
|
|
|
run_once: yes
|
2019-02-26 04:09:30 +00:00
|
|
|
changed_when: false
|
2020-09-03 06:55:40 +00:00
|
|
|
failed_when: false
|
2018-08-23 14:17:18 +00:00
|
|
|
|
|
|
|
- name: "Determine if calico upgrade is needed"
|
|
|
|
block:
|
2018-09-23 13:33:17 +00:00
|
|
|
- name: "Check that calico version is enough for upgrade"
|
2018-08-23 14:17:18 +00:00
|
|
|
assert:
|
|
|
|
that:
|
2018-10-16 22:33:30 +00:00
|
|
|
- calico_version_on_server.stdout is version('v2.6.5', '>=')
|
2018-08-23 14:17:18 +00:00
|
|
|
msg: "Your version of calico is not fresh enough for upgrade"
|
2018-09-11 12:14:10 +00:00
|
|
|
when: calico_upgrade_enabled
|
2018-08-23 14:17:18 +00:00
|
|
|
|
|
|
|
- name: "Set upgrade flag when version needs to be updated"
|
|
|
|
set_fact:
|
|
|
|
calico_upgrade_needed: True
|
|
|
|
when:
|
2018-10-16 22:33:30 +00:00
|
|
|
- calico_version_on_server.stdout is version('v2.6.5', '>=')
|
|
|
|
- calico_version_on_server.stdout is version('v3.0.0', '<')
|
2018-08-23 14:17:18 +00:00
|
|
|
|
|
|
|
when:
|
2019-04-29 06:00:20 +00:00
|
|
|
- calico_version_on_server.stdout is defined
|
|
|
|
- calico_version_on_server.stdout
|
2018-08-23 14:17:18 +00:00
|
|
|
- inventory_hostname == groups['kube-master'][0]
|
2018-08-23 14:47:18 +00:00
|
|
|
run_once: yes
|