check-prerequisites.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. - name: Check if python-dns is installed
  33. assert:
  34. that: 'pythondns_result.rc == 0'
  35. msg: "Python module python-dns is not installed"
  36. # Check jinja2
  37. - name: Try to import jinja2 module
  38. command: python -c "import jinja2"
  39. ignore_errors: yes
  40. register: jinja_result
  41. - name: Check if jinja2 is installed
  42. assert:
  43. that: 'jinja_result.rc == 0'
  44. msg: "Python module jinja2 is not installed"
  45. # Check Glance image
  46. - name: Try to get image facts
  47. os_image_facts:
  48. image: "{{ openstack_default_image_name }}"
  49. register: image_result
  50. - name: Check that image is available
  51. assert:
  52. that: "image_result.ansible_facts.openstack_image"
  53. msg: "Image {{ openstack_default_image_name }} is not available"
  54. # Check network name
  55. - name: Try to get network facts
  56. os_networks_facts:
  57. name: "{{ openstack_external_network_name }}"
  58. register: network_result
  59. when: not openstack_provider_network_name|default(None)
  60. - name: Check that network is available
  61. assert:
  62. that: "network_result.ansible_facts.openstack_networks"
  63. msg: "Network {{ openstack_external_network_name }} is not available"
  64. when: not openstack_provider_network_name|default(None)
  65. # Check keypair
  66. # TODO kpilatov: there is no Ansible module for getting OS keypairs
  67. # (os_keypair is not suitable for this)
  68. # this method does not force python-openstackclient dependency
  69. - name: Try to show keypair
  70. command: >
  71. python -c 'import shade; cloud = shade.openstack_cloud();
  72. exit(cloud.get_keypair("{{ openstack_keypair_name }}") is None)'
  73. ignore_errors: yes
  74. register: key_result
  75. - name: Check that keypair is available
  76. assert:
  77. that: 'key_result.rc == 0'
  78. msg: "Keypair {{ openstack_keypair_name }} is not available"
  79. # Check that custom images are available
  80. - include: custom_image_check.yaml
  81. with_items:
  82. - "{{ openstack_master_image }}"
  83. - "{{ openstack_infra_image }}"
  84. - "{{ openstack_node_image }}"
  85. - "{{ openstack_lb_image }}"
  86. - "{{ openstack_etcd_image }}"
  87. - "{{ openstack_dns_image }}"
  88. loop_control:
  89. loop_var: image
  90. # Check that custom flavors are available
  91. - include: custom_flavor_check.yaml
  92. with_items:
  93. - "{{ master_flavor }}"
  94. - "{{ infra_flavor }}"
  95. - "{{ node_flavor }}"
  96. - "{{ lb_flavor }}"
  97. - "{{ etcd_flavor }}"
  98. - "{{ dns_flavor }}"
  99. loop_control:
  100. loop_var: flavor