blob: 1e487d434a13ae2cf8f92d00b0da5aa7cf62abf7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
---
# Check ansible
- name: Check Ansible version
assert:
that: >
(ansible_version.major == 2 and ansible_version.minor >= 3) or
(ansible_version.major > 2)
msg: "Ansible version must be at least 2.3"
# Check shade
- name: Try to import python module shade
command: python -c "import shade"
ignore_errors: yes
register: shade_result
- name: Check if shade is installed
assert:
that: 'shade_result.rc == 0'
msg: "Python module shade is not installed"
# Check jmespath
- name: Try to import python module shade
command: python -c "import jmespath"
ignore_errors: yes
register: jmespath_result
- name: Check if jmespath is installed
assert:
that: 'jmespath_result.rc == 0'
msg: "Python module jmespath is not installed"
# Check python-dns
- name: Try to import python DNS module
command: python -c "import dns"
ignore_errors: yes
register: pythondns_result
when: openshift_openstack_external_nsupdate_keys is defined
- name: Check if python-dns is installed
assert:
that: 'pythondns_result.rc == 0'
msg: "Python module python-dns is not installed"
when: openshift_openstack_external_nsupdate_keys is defined
# Check jinja2
- name: Try to import jinja2 module
command: python -c "import jinja2"
ignore_errors: yes
register: jinja_result
- name: Check if jinja2 is installed
assert:
that: 'jinja_result.rc == 0'
msg: "Python module jinja2 is not installed"
# Check Glance image
- name: Try to get image facts
os_image_facts:
image: "{{ openshift_openstack_default_image_name }}"
register: image_result
- name: Check that image is available
assert:
that: "image_result.ansible_facts.openstack_image"
msg: "Image {{ openshift_openstack_default_image_name }} is not available"
# Check network name
- name: Try to get network facts
os_networks_facts:
name: "{{ openshift_openstack_external_network_name }}"
register: network_result
when: not openshift_openstack_provider_network_name|default(None)
- name: Check that network is available
assert:
that: "network_result.ansible_facts.openstack_networks"
msg: "Network {{ openshift_openstack_external_network_name }} is not available"
when: not openshift_openstack_provider_network_name|default(None)
# Check keypair
# TODO kpilatov: there is no Ansible module for getting OS keypairs
# (os_keypair is not suitable for this)
# this method does not force python-openstackclient dependency
- name: Try to show keypair
command: >
python -c 'import shade; cloud = shade.openstack_cloud();
exit(cloud.get_keypair("{{ openshift_openstack_keypair_name }}") is None)'
ignore_errors: yes
register: key_result
- name: Check that keypair is available
assert:
that: 'key_result.rc == 0'
msg: "Keypair {{ openshift_openstack_keypair_name }} is not available"
# Check that custom images are available
- include_tasks: custom_image_check.yaml
with_items:
- "{{ openshift_openstack_master_image }}"
- "{{ openshift_openstack_infra_image }}"
- "{{ openshift_openstack_cns_image }}"
- "{{ openshift_openstack_node_image }}"
- "{{ openshift_openstack_lb_image }}"
- "{{ openshift_openstack_etcd_image }}"
# Check that custom flavors are available
- include_tasks: custom_flavor_check.yaml
with_items:
- "{{ openshift_openstack_master_flavor }}"
- "{{ openshift_openstack_infra_flavor }}"
- "{{ openshift_openstack_cns_flavor }}"
- "{{ openshift_openstack_node_flavor }}"
- "{{ openshift_openstack_lb_flavor }}"
- "{{ openshift_openstack_etcd_flavor }}"
|