check-prerequisites.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. # Check trunk support
  22. - fail:
  23. msg: "Trunk ports enabled but support lacking in Neutron"
  24. when: (use_trunk_ports | default(False)) and
  25. ('trunk' not in openstack_network_extensions)
  26. # Check lbaasv2 support
  27. - fail:
  28. msg: "Kuryr enabled but lacking required lbaasv2 support in Neutron"
  29. when: (openshift_use_kuryr | default(False)) and
  30. ('lbaasv2' not in openstack_network_extensions)
  31. # Check jmespath
  32. - name: Try to import python module shade
  33. command: python -c "import jmespath"
  34. ignore_errors: yes
  35. register: jmespath_result
  36. - name: Check if jmespath is installed
  37. assert:
  38. that: 'jmespath_result.rc == 0'
  39. msg: "Python module jmespath is not installed"
  40. # Check python-dns
  41. - name: Try to import python DNS module
  42. command: python -c "import dns"
  43. ignore_errors: yes
  44. register: pythondns_result
  45. when: openshift_openstack_external_nsupdate_keys is defined
  46. - name: Check if python-dns is installed
  47. assert:
  48. that: 'pythondns_result.rc == 0'
  49. msg: "Python module python-dns is not installed"
  50. when: openshift_openstack_external_nsupdate_keys is defined
  51. # Check jinja2
  52. - name: Try to import jinja2 module
  53. command: python -c "import jinja2"
  54. ignore_errors: yes
  55. register: jinja_result
  56. - name: Check if jinja2 is installed
  57. assert:
  58. that: 'jinja_result.rc == 0'
  59. msg: "Python module jinja2 is not installed"
  60. # Check network name
  61. - name: Try to get network facts
  62. os_networks_facts:
  63. name: "{{ openshift_openstack_external_network_name }}"
  64. register: network_result
  65. when: not openshift_openstack_provider_network_name|default(None)
  66. - name: Check that network is available
  67. assert:
  68. that: "network_result.ansible_facts.openstack_networks"
  69. msg: "Network {{ openshift_openstack_external_network_name }} is not available"
  70. when: not openshift_openstack_provider_network_name|default(None)
  71. # Check keypair
  72. # TODO kpilatov: there is no Ansible module for getting OS keypairs
  73. # (os_keypair is not suitable for this)
  74. # this method does not force python-openstackclient dependency
  75. - name: Try to show keypair
  76. command: >
  77. python -c 'import shade; cloud = shade.openstack_cloud();
  78. exit(cloud.get_keypair("{{ openshift_openstack_keypair_name }}") is None)'
  79. ignore_errors: yes
  80. register: key_result
  81. - name: Check that keypair is available
  82. assert:
  83. that: 'key_result.rc == 0'
  84. msg: "Keypair {{ openshift_openstack_keypair_name }} is not available"
  85. # Check flavors and images
  86. - include_tasks: image-and-flavor-check.yml
  87. with_items:
  88. - { image: "{{ openshift_openstack_default_image_name }}", flavor: "{{ openshift_openstack_default_flavor }}" }
  89. - { image: "{{ openshift_openstack_master_image }}", flavor: "{{ openshift_openstack_master_flavor }}" }
  90. - { image: "{{ openshift_openstack_infra_image }}", flavor: "{{ openshift_openstack_infra_flavor }}" }
  91. - { image: "{{ openshift_openstack_cns_image }}", flavor: "{{ openshift_openstack_cns_flavor }}" }
  92. - { image: "{{ openshift_openstack_node_image }}", flavor: "{{ openshift_openstack_node_flavor }}" }
  93. - { image: "{{ openshift_openstack_lb_image }}", flavor: "{{ openshift_openstack_lb_flavor }}" }
  94. - { image: "{{ openshift_openstack_etcd_image }}", flavor: "{{ openshift_openstack_etcd_flavor }}" }