You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.3 KiB

  1. ---
  2. - name: "Check vars defined correctly"
  3. assert:
  4. that:
  5. - "calico_pool_name is defined"
  6. - "calico_pool_name | match('^[a-zA-Z0-9-_\\\\.]{2,63}$')"
  7. - "ipip_mode is defined"
  8. - "ipip_mode in ['Always', 'CrossSubnet', 'Never']"
  9. msg: "Check variable definitions seems something is wrong"
  10. run_once: yes
  11. - name: "Get current version of calico cluster version"
  12. shell: "{{ bin_dir }}/calicoctl version | grep 'Cluster Version:' | awk '{ print $3}'"
  13. register: calico_version_on_server
  14. run_once: yes
  15. delegate_to: "{{ groups['kube-master'][0] }}"
  16. - name: "Determine if calico upgrade is needed"
  17. block:
  18. - name: "Check that calico version is enough for upgrade"
  19. assert:
  20. that:
  21. - calico_version_on_server.stdout is version('v2.6.5', '>=')
  22. msg: "Your version of calico is not fresh enough for upgrade"
  23. when: calico_upgrade_enabled
  24. - name: "Set upgrade flag when version needs to be updated"
  25. set_fact:
  26. calico_upgrade_needed: True
  27. when:
  28. - calico_version_on_server.stdout is version('v2.6.5', '>=')
  29. - calico_version_on_server.stdout is version('v3.0.0', '<')
  30. when:
  31. - 'calico_version_on_server.stdout is defined'
  32. - 'calico_version_on_server.stdout != ""'
  33. - inventory_hostname == groups['kube-master'][0]
  34. run_once: yes