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.

90 lines
3.2 KiB

  1. ---
  2. - name: Stop if ansible version is too low
  3. assert:
  4. that:
  5. - ansible_version.full|version_compare('2.3.0', '>=')
  6. run_once: yes
  7. - name: Stop if non systemd OS type
  8. assert:
  9. that: ansible_service_mgr == "systemd"
  10. ignore_errors: "{{ ignore_assert_errors }}"
  11. - name: Stop if unknown OS
  12. assert:
  13. that: ansible_distribution in ['RedHat', 'CentOS', 'Fedora', 'Ubuntu', 'Debian', 'CoreOS', 'Container Linux by CoreOS']
  14. ignore_errors: "{{ ignore_assert_errors }}"
  15. - name: Stop if unknown network plugin
  16. assert:
  17. that: network_plugin in ['calico', 'canal', 'flannel', 'weave', 'cloud']
  18. when: network_plugin is defined
  19. ignore_errors: "{{ ignore_assert_errors }}"
  20. - name: Stop if incompatible network plugin and cloudprovider
  21. assert:
  22. that: network_plugin != 'calico'
  23. msg: "Azure and Calico are not compatible. See https://github.com/projectcalico/calicoctl/issues/949 for details."
  24. when: cloud_provider is defined and cloud_provider == 'azure'
  25. ignore_errors: "{{ ignore_assert_errors }}"
  26. # simplify this items-list when https://github.com/ansible/ansible/issues/15753 is resolved
  27. - name: "Stop if known booleans are set as strings (Use JSON format on CLI: -e \"{'key': true }\")"
  28. assert:
  29. that: item.value|type_debug == 'bool'
  30. msg: "{{item.value}} isn't a bool"
  31. run_once: yes
  32. with_items:
  33. - { name: kubeadm_enabled, value: "{{ kubeadm_enabled }}" }
  34. - { name: download_run_once, value: "{{ download_run_once }}" }
  35. - { name: deploy_netchecker, value: "{{ deploy_netchecker }}" }
  36. - { name: download_always_pull, value: "{{ download_always_pull }}" }
  37. - { name: efk_enabled, value: "{{ efk_enabled }}" }
  38. - { name: helm_enabled, value: "{{ helm_enabled }}" }
  39. - { name: openstack_lbaas_enabled, value: "{{ openstack_lbaas_enabled }}" }
  40. ignore_errors: "{{ ignore_assert_errors }}"
  41. - name: Stop if even number of etcd hosts
  42. assert:
  43. that: groups.etcd|length is not divisibleby 2
  44. ignore_errors: "{{ ignore_assert_errors }}"
  45. - name: Stop if memory is too small for masters
  46. assert:
  47. that: ansible_memtotal_mb >= 1500
  48. ignore_errors: "{{ ignore_assert_errors }}"
  49. when: inventory_hostname in groups['kube-master']
  50. - name: Stop if memory is too small for nodes
  51. assert:
  52. that: ansible_memtotal_mb >= 1024
  53. ignore_errors: "{{ ignore_assert_errors }}"
  54. when: inventory_hostname in groups['kube-node']
  55. - name: Stop if ip var does not match local ips
  56. assert:
  57. that: ip in ansible_all_ipv4_addresses
  58. ignore_errors: "{{ ignore_assert_errors }}"
  59. when: ip is defined
  60. - name: Stop if access_ip is not pingable
  61. command: ping -c1 {{ access_ip }}
  62. when: access_ip is defined
  63. ignore_errors: "{{ ignore_assert_errors }}"
  64. - name: Stop if swap enabled
  65. assert:
  66. that: ansible_swaptotal_mb == 0
  67. when: kubelet_fail_swap_on|default(true)
  68. ignore_errors: "{{ ignore_assert_errors }}"
  69. - name: Stop if RBAC is not enabled when dashboard is enabled
  70. assert:
  71. that: rbac_enabled
  72. when: dashboard_enabled
  73. ignore_errors: "{{ ignore_assert_errors }}"
  74. - name: Stop if RBAC and anonymous-auth are not enabled when insecure port is disabled
  75. assert:
  76. that: rbac_enabled and kube_api_anonymous_auth
  77. when: kube_apiserver_insecure_port == 0
  78. ignore_errors: "{{ ignore_assert_errors }}"