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.

63 lines
2.4 KiB

  1. ---
  2. - name: Cilium | Check Cilium encryption `cilium_ipsec_key` for ipsec
  3. assert:
  4. that:
  5. - "cilium_ipsec_key is defined"
  6. msg: "cilium_ipsec_key should be defined to enable encryption using ipsec"
  7. when:
  8. - cilium_encryption_enabled
  9. - cilium_encryption_type == "ipsec"
  10. - cilium_tunnel_mode in ['vxlan']
  11. # TODO: Clean this task up when we drop backward compatibility support for `cilium_ipsec_enabled`
  12. - name: Stop if `cilium_ipsec_enabled` is defined and `cilium_encryption_type` is not `ipsec`
  13. assert:
  14. that: cilium_encryption_type == 'ipsec'
  15. msg: >
  16. It is not possible to use `cilium_ipsec_enabled` when `cilium_encryption_type` is set to {{ cilium_encryption_type }}.
  17. when:
  18. - cilium_ipsec_enabled is defined
  19. - cilium_ipsec_enabled
  20. - kube_network_plugin == 'cilium' or cilium_deploy_additionally | default(false) | bool
  21. - name: Stop if kernel version is too low for Cilium Wireguard encryption
  22. assert:
  23. that: ansible_kernel.split('-')[0] is version('5.6.0', '>=')
  24. when:
  25. - kube_network_plugin == 'cilium' or cilium_deploy_additionally | default(false) | bool
  26. - cilium_encryption_enabled
  27. - cilium_encryption_type == "wireguard"
  28. - not ignore_assert_errors
  29. - name: Stop if bad Cilium identity allocation mode
  30. assert:
  31. that: cilium_identity_allocation_mode in ['crd', 'kvstore']
  32. msg: "cilium_identity_allocation_mode must be either 'crd' or 'kvstore'"
  33. - name: Stop if bad Cilium Cluster ID
  34. assert:
  35. that:
  36. - cilium_cluster_id <= 255
  37. - cilium_cluster_id >= 0
  38. msg: "'cilium_cluster_id' must be between 1 and 255"
  39. when: cilium_cluster_id is defined
  40. - name: Stop if bad encryption type
  41. assert:
  42. that: cilium_encryption_type in ['ipsec', 'wireguard']
  43. msg: "cilium_encryption_type must be either 'ipsec' or 'wireguard'"
  44. when: cilium_encryption_enabled
  45. - name: Stop if cilium_version is < v1.10.0
  46. assert:
  47. that: cilium_version | regex_replace('v') is version(cilium_min_version_required, '>=')
  48. msg: "cilium_version is too low. Minimum version {{ cilium_min_version_required }}"
  49. # TODO: Clean this task up when we drop backward compatibility support for `cilium_ipsec_enabled`
  50. - name: Set `cilium_encryption_type` to "ipsec" and if `cilium_ipsec_enabled` is true
  51. set_fact:
  52. cilium_encryption_type: ipsec
  53. cilium_encryption_enabled: true
  54. when:
  55. - cilium_ipsec_enabled is defined
  56. - cilium_ipsec_enabled