check-prerequisites.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. ---
  2. # Check ansible
  3. - name: Check Ansible version
  4. assert:
  5. that: >
  6. (ansible_version.major == 2 and ansible_version.minor >= 3) or
  7. (ansible_version.major > 2)
  8. msg: "Ansible version must be at least 2.3"
  9. # Check shade
  10. - name: Try to import python module shade
  11. command: python -c "import shade"
  12. ignore_errors: yes
  13. register: shade_result
  14. - name: Check if shade is installed
  15. assert:
  16. that: 'shade_result.rc == 0'
  17. msg: "Python module shade is not installed"
  18. # Gather Neutron extension facts
  19. - name: Check for Neutron trunk support
  20. os_network_extensions:
  21. # Gather OpenStack service catalog endpoint facts
  22. - name: Check for cloud service catalog endpoints
  23. os_service_catalog:
  24. # Check trunk support
  25. - fail:
  26. msg: "Trunk ports enabled but support lacking in Neutron"
  27. when: (use_trunk_ports | default(False)) and
  28. ('trunk' not in openstack_network_extensions)
  29. # Check jmespath
  30. - name: Try to import python module shade
  31. command: python -c "import jmespath"
  32. ignore_errors: yes
  33. register: jmespath_result
  34. - name: Check if jmespath is installed
  35. assert:
  36. that: 'jmespath_result.rc == 0'
  37. msg: "Python module jmespath is not installed"
  38. # Check python-dns
  39. - name: Try to import python DNS module
  40. command: python -c "import dns"
  41. ignore_errors: yes
  42. register: pythondns_result
  43. when: openshift_openstack_external_nsupdate_keys is defined
  44. - name: Check if python-dns is installed
  45. assert:
  46. that: 'pythondns_result.rc == 0'
  47. msg: "Python module python-dns is not installed"
  48. when: openshift_openstack_external_nsupdate_keys is defined
  49. # Check jinja2
  50. - name: Try to import jinja2 module
  51. command: python -c "import jinja2"
  52. ignore_errors: yes
  53. register: jinja_result
  54. - name: Check if jinja2 is installed
  55. assert:
  56. that: 'jinja_result.rc == 0'
  57. msg: "Python module jinja2 is not installed"
  58. # Check network name
  59. - name: Try to get network facts
  60. os_networks_facts:
  61. name: "{{ openshift_openstack_external_network_name }}"
  62. register: network_result
  63. when: not openshift_openstack_provider_network_name|default(None)
  64. - name: Check that network is available
  65. assert:
  66. that: "network_result.ansible_facts.openstack_networks"
  67. msg: "Network {{ openshift_openstack_external_network_name }} is not available"
  68. when: not openshift_openstack_provider_network_name|default(None)
  69. # Check keypair
  70. # TODO kpilatov: there is no Ansible module for getting OS keypairs
  71. # (os_keypair is not suitable for this)
  72. # this method does not force python-openstackclient dependency
  73. - name: Try to show keypair
  74. command: >
  75. python -c 'import shade; cloud = shade.openstack_cloud();
  76. exit(cloud.get_keypair("{{ openshift_openstack_keypair_name }}") is None)'
  77. ignore_errors: yes
  78. register: key_result
  79. - name: Check that keypair is available
  80. assert:
  81. that: 'key_result.rc == 0'
  82. msg: "Keypair {{ openshift_openstack_keypair_name }} is not available"
  83. # Check flavors and images
  84. - include_tasks: image-and-flavor-check.yml
  85. with_items:
  86. - { image: "{{ openshift_openstack_default_image_name }}", flavor: "{{ openshift_openstack_default_flavor }}" }
  87. - { image: "{{ openshift_openstack_master_image }}", flavor: "{{ openshift_openstack_master_flavor }}" }
  88. - { image: "{{ openshift_openstack_infra_image }}", flavor: "{{ openshift_openstack_infra_flavor }}" }
  89. - { image: "{{ openshift_openstack_cns_image }}", flavor: "{{ openshift_openstack_cns_flavor }}" }
  90. - { image: "{{ openshift_openstack_node_image }}", flavor: "{{ openshift_openstack_node_flavor }}" }
  91. - { image: "{{ openshift_openstack_lb_image }}", flavor: "{{ openshift_openstack_lb_flavor }}" }
  92. - { image: "{{ openshift_openstack_etcd_image }}", flavor: "{{ openshift_openstack_etcd_flavor }}" }
  93. - name: Check Load Balancer options
  94. fail:
  95. msg: >
  96. Only one of `openshift_openstack_use_lbaas_load_balancer` and
  97. `openshift_openstack_use_vm_load_balancer` can be true at a time.
  98. when:
  99. - openshift_openstack_use_lbaas_load_balancer
  100. - openshift_openstack_use_vm_load_balancer
  101. - name: Check LBaaS Load Balancer providers
  102. fail:
  103. msg: >
  104. Your configured openshift_openstack_lbaasv2_provider is not supported
  105. by your cloud.
  106. when: (openshift_openstack_use_lbaas_load_balancer and openshift_openstack_lbaasv2_provider == 'Neutron::LBaaS' and 'lbaasv2' not in openstack_network_extensions) or
  107. (openshift_openstack_use_lbaas_load_balancer and openshift_openstack_lbaasv2_provider == 'Octavia' and 'load-balancer' not in openstack_service_catalog)
  108. - name: Verify the nsupdate zone is a subset of the full cluster domain
  109. fail:
  110. msg: >
  111. The `openshift_openstack_nsupdate_zone` ({{ openshift_openstack_nsupdate_zone }})
  112. must be a substring of `openshift_openstack_full_dns_domain ({{ openshift_openstack_full_dns_domain }})`
  113. when:
  114. - openshift_openstack_nsupdate_zone is defined
  115. - openshift_openstack_full_dns_domain is defined
  116. - openshift_openstack_full_dns_domain is not match(".*\." + openshift_openstack_nsupdate_zone + "$")