/
prepare_aio_config.yml
202 lines (181 loc) · 7.24 KB
/
prepare_aio_config.yml
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
---
# Copyright 2015, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Create the required deployment directories
file:
path: "{{ item }}"
state: directory
with_items: "{{ bootstrap_host_target_config_paths }}"
tags:
- create-directories
- name: Deploy user conf.d configuration
config_template:
src: "{{ item.path | default(bootstrap_host_aio_config_path ~ '/conf.d') }}/{{ item.name }}"
dest: "/etc/openstack_deploy/conf.d/{{ item.name | regex_replace('.aio$', '') }}"
config_overrides: "{{ item.override | default({}) }}"
config_type: "yaml"
with_items: "{{ openstack_confd_entries | default([]) }}"
tags:
- deploy-confd
- name: Deploy openstack_user_config
config_template:
src: "{{ bootstrap_host_aio_config_path }}/openstack_user_config.yml.aio.j2"
dest: "/etc/openstack_deploy/openstack_user_config.yml"
config_overrides: "{{ openstack_user_config_overrides | default({}) }}"
config_type: "yaml"
list_extend: false
tags:
- deploy-openstack-user-config
- name: Deploy user_secrets file
config_template:
src: "{{ bootstrap_host_aio_config_path }}/user_secrets.yml"
dest: "/etc/openstack_deploy/{{ bootstrap_host_user_secrets_filename }}"
config_overrides: "{{ user_secrets_overrides | default({}) }}"
config_type: "yaml"
tags:
- deploy-user-secrets
- name: Generate any missing values in user_secrets
command: "/opt/ansible-runtime/bin/python {{ bootstrap_host_aio_script_path }}/pw-token-gen.py --file /etc/openstack_deploy/{{ bootstrap_host_user_secrets_filename }}"
changed_when: false
tags:
- generate_secrets
- name: Detect whether the host is an OpenStack-CI host
stat:
path: /etc/nodepool
register: nodepool_dir
- name: Set facts when inside of OpenStack-Infra
when:
- nodepool_dir.stat.exists
block:
# OVH nodepool nodes have an issue which causes nested virt
# instances to crash with a hardware error, then a dump.
# We therefore detect whether we're running on OVH and
# force it to use qemu instead.
- name: Discover the OpenStack-Infra mirrors
shell: |
source /etc/ci/mirror_info.sh
NODEPOOL_OVERRIDES="/etc/openstack_deploy/user_openstackci.yml"
echo "uca_apt_repo_url: '${NODEPOOL_UCA_MIRROR}'" >> ${NODEPOOL_OVERRIDES}
echo "openstack_hosts_centos_mirror_url: '${NODEPOOL_CENTOS_MIRROR}'" >> ${NODEPOOL_OVERRIDES}
echo "opensuse_mirror: '${NODEPOOL_OPENSUSE_MIRROR}'" >> ${NODEPOOL_OVERRIDES}
if [[ ${NODEPOOL_PYPI_MIRROR} == *.ovh.* ]]; then
echo "nova_virt_type: 'qemu'" >> ${NODEPOOL_OVERRIDES}
fi
echo "repo_build_pip_default_index: '${NODEPOOL_PYPI_MIRROR}'" >> ${NODEPOOL_OVERRIDES}
args:
executable: /bin/bash
tags:
- skip_ansible_lint
- name: Discover the OpenStack-Infra pypi/wheel mirror
shell: |
source /etc/ci/mirror_info.sh
echo "${NODEPOOL_PYPI_MIRROR}"
echo "${NODEPOOL_WHEEL_MIRROR}"
args:
executable: /bin/bash
register: _pypi_wheel_mirror
tags:
- skip_ansible_lint
- name: Discover the OpenStack-Infra LXC reverse proxy
shell: |
source /etc/ci/mirror_info.sh
echo ${NODEPOOL_LXC_IMAGE_PROXY}
register: _lxc_mirror
args:
executable: /bin/bash
tags:
- skip_ansible_lint
- name: Set the package cache timeout to 60 mins in OpenStack-CI
set_fact:
cache_timeout: 3600
when:
- cache_timeout is not defined
# This is a very dirty hack due to images.linuxcontainers.org
# constantly failing to resolve in openstack-infra.
- name: Implement hard-coded hosts entries for consistently failing name
lineinfile:
path: "/etc/hosts"
line: "{{ item }}"
state: present
with_items:
- "91.189.91.21 images.linuxcontainers.org us.images.linuxcontainers.org"
- "91.189.88.37 images.linuxcontainers.org uk.images.linuxcontainers.org"
- name: Set facts when outside of OpenStack-Infra
when:
- not nodepool_dir.stat.exists
block:
- name: Determine the fastest available OpenStack-Infra wheel mirror
command: "{{ bootstrap_host_aio_script_path }}/fastest-infra-wheel-mirror.py"
register: fastest_wheel_mirror
- name: Set repo_build_pip_extra_indexes fact
set_fact:
repo_build_pip_extra_indexes: "{{ fastest_wheel_mirror.stdout_lines }}"
# NOTE(mhayden): The OpenStack CI images for CentOS 7 recently set SELinux to
# Enforcing mode by default. While I am normally a supporter of this change,
# the SELinux policy work for CentOS 7 is not done yet.
- name: Set SELinux to permissive mode in OpenStack-CI
selinux:
policy: targeted
state: permissive
when:
- ansible_selinux.status == "enabled"
- name: Set the user_variables
config_template:
src: "{{ bootstrap_user_variables_template }}"
dest: "/etc/openstack_deploy/{{ bootstrap_host_user_variables_filename }}"
config_overrides: "{{ user_variables_overrides | default({}) }}"
config_type: yaml
- name: Drop the extra user_variables files for this scenario
config_template:
src: "{{ item.src }}"
dest: "/etc/openstack_deploy/{{ item.dest }}"
config_overrides: "{{ item.config_overrides | default({}) }}"
config_type: yaml
with_items: "{{ bootstrap_user_variables_extra_templates[bootstrap_host_scenario] | default([]) }}"
- name: Copy modified cinder-volume env.d file for ceph scenario
copy:
src: "{{ playbook_dir }}/../etc/openstack_deploy/env.d/cinder-volume.yml.container.example"
dest: "/etc/openstack_deploy/env.d/cinder-volume.yml"
when:
- "bootstrap_host_scenario == 'ceph'"
- name: Copy modified env.d file for metal scenario
copy:
src: "{{ playbook_dir }}/../etc/openstack_deploy/env.d/aio_metal.yml.example"
dest: "/etc/openstack_deploy/env.d/aio_metal.yml"
when:
- "bootstrap_host_scenario == 'aio_metal'"
- name: Create vars override folders if we need to test them
file:
path: "{{ item }}"
state: directory
with_items:
- /etc/openstack_deploy/group_vars
- /etc/openstack_deploy/host_vars
when: "(lookup('env','ACTION') | default(false,true)) == 'varstest'"
- name: Create user-space overrides
lineinfile:
path: "{{ item.path }}"
state: present
line: "{{ item.line }}"
create: yes
with_items:
- path: /etc/openstack_deploy/group_vars/hosts.yml
line: 'babar: "elephant"'
- path: /etc/openstack_deploy/group_vars/hosts.yml
line: 'lxc_hosts_package_state: "present"'
- path: /etc/openstack_deploy/host_vars/localhost.yml
line: 'security_package_state: "present"'
- path: /etc/openstack_deploy/host_vars/localhost.yml
line: 'tintin: "milou"'
when: "(lookup('env','ACTION') | default(false,true)) == 'varstest'"