/
main.yaml
43 lines (39 loc) · 1.39 KB
/
main.yaml
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
---
- name: Open needed ports at default security group
os_security_group_rule:
cloud: "{{ os_cloud_name }}"
security_group: default
protocol: tcp
port_range_min: "{{ item }}"
port_range_max: "{{ item }}"
remote_ip_prefix: 0.0.0.0/0
with_items:
- 19885
- 22
- name: Get installed images names
os_image_info:
cloud: "{{ os_cloud_name }}"
until: os_image_data.openstack_image is defined and os_image_data.openstack_image|list|length > 0
register: os_image_data
retries: 3
delay: 5
- name: Check image are uploaded
fail:
msg: |
Cannot find {{ item }} at the openstack cloud, you can upload one from
https://nb02.opendev.org/images/ and add your ssh pub key with
virt-edit and upload it to your openstack cloud.
e.g. virt-sysprep -a centos-8-stream-00001.qcow2 --ssh-inject zuul:file:/home/user/.ssh/id_rsa.pub --selinux-relabel
when: |
os_image_data.openstack_image|selectattr( 'name', 'equalto', item )|list|length == 0
with_items:
- "{{ os_centos8_image }}"
- name: Gather facts about a previously created network by name
os_networks_info:
cloud: "{{ os_cloud_name }}"
register: os_network_data
- name: Check if networks present in the tenant
fail:
msg: 'Network "{{ item }} is not found!'
when: "item not in os_network_data.openstack_networks|map(attribute='name')|list"
with_items: "{{ cloud_networks }}"