check-prerequisites.yml 3.3 KB

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