/
prepare.yaml
106 lines (97 loc) · 2.89 KB
/
prepare.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
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
---
- hosts: subnodes
vars:
update_subnodes: true
tempest_test_image_version: 0.3.5
tempest_test_image_name: cirros-{{ tempest_test_image_version }}-x86_64-disk.img
tempest_test_url_path: http://download.cirros-cloud.net/{{ tempest_test_image_version }}/{{ tempest_test_image_name }}
tempest_test_image_path: /opt/cache/files/{{ tempest_test_image_name }}
packages_list:
- git
- unbound
- tmux
- screen
- vim
- wget
- "{% if ansible_python.version.major == 3 -%}python3-virtualenv{%-
else -%}python-virtualenv{%- endif -%}"
tasks:
- name: Create /etc/nodepool directory
file:
path: /etc/nodepool
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: 0755
become: true
- name: Install repos (will be removed by toci_gate_test)
package:
name: "{{ item }}"
with_items:
- centos-release-openstack-queens
- epel-release
become: true
when: ansible_distribution|lower != 'fedora'
- name: Install packages
package:
name: "{{ packages_list }}"
state: latest
become: true
register: install_packages
retries: 5
delay: 10
until: not install_packages.failed
tags:
# We really want to install latest
- skip_ansible_lint
- name: Prepare directory for images
become: true
file:
path: "{{ tempest_test_image_path | dirname }}"
recurse: true
state: directory
mode: 0777
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
- name: Get cirros image
shell: |
curl "{{ tempest_test_url_path }}" -o {{ tempest_test_image_path }};
changed_when: true
- name: Scan SSH keys from subnodes
shell: |
for key in {{ hostvars[item].subnode_public_ip }} \
{{ hostvars[item].subnode_private_ip }}; do
if ! grep -q $key /etc/ssh/ssh_known_hosts ; then
ssh-keyscan $key >> /etc/ssh/ssh_known_hosts
fi
done
changed_when: true
with_inventory_hostnames:
- subnodes
become: true
- when: update_subnodes|bool
block:
- name: Update packages
package:
name: '*'
state: latest
become: true
register: update_packages
retries: 5
delay: 10
until: not update_packages.failed
tags:
# We really want to update
- skip_ansible_lint
- name: Reboot hosts
shell: sleep 2 && shutdown -r now
async: 1
poll: 0
ignore_errors: true
become: true
- name: Wait for provisioned hosts to become reachable
wait_for_connection:
delay: 35
sleep: 10
connect_timeout: 10
timeout: 180