-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.yml
167 lines (147 loc) · 5.76 KB
/
configure.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
- name: Configure Undercloud
hosts: undercloud
tags: configure
gather_facts: no
any_errors_fatal: true
vars:
- conf: "{{ install.config|default({}) }}"
- osp_release: "{{ install.version|openstack_release }}"
- conf_instack: '/usr/share/instack-undercloud/undercloud.conf.sample'
- conf_oooclient: '/usr/share/python-tripleoclient/undercloud.conf.sample'
- conf_oooclient_py3: '/usr/share/python3-tripleoclient/undercloud.conf.sample'
- default_conf: "{{ (osp_release <= 13) | ternary(conf_instack, (osp_release < 15) | ternary(conf_oooclient, conf_oooclient_py3)) }}"
- local_src: "{%- if conf.file|default('') -%}
{{ conf.file }}
{%- elif 'hypervisor' in groups.all or 'bmc' in groups -%}
templates/undercloud.conf.j2
{%- else -%}
False
{%- endif -%}"
tasks:
- name: install custom CA if needed
become: yes
become_user: root
when:
- install.tls.ca != ''
block:
- name: "fetch {{ install.tls.ca }}"
get_url:
url: "{{ install.tls.ca }}"
dest: /etc/pki/ca-trust/source/anchors/custom-ssl-ca.crt
validate_certs: no
register: custom_ca
- name: update system trust store
when: custom_ca is changed
command: update-ca-trust
- name: set workingr_dir fact
set_fact:
working_dir: "/home/{{ install.user.name }}"
- name: template the undercloud.conf from local machine
template:
src: "{{ local_src }}"
dest: ~/undercloud.conf
force: yes
mode: 0755
when:
- local_src is defined
- local_src != False
- name: make sure ~/.ssh exists
file:
path: ~/.ssh
state: directory
mode: 0700
- name: create default developer-friendly ~/.ssh/config for the stack user
template:
src: templates/ssh.config.j2
dest: ~/.ssh/config
mode: 0600
- name: copy default undercloud config
copy:
remote_src: yes
src: "{{ default_conf }}"
dest: ~/undercloud.conf
force: yes
mode: 0755
when: not local_src
- name: override values in undercloud conf
include_tasks: tasks/inject_undercloud_conf.yml
with_dict: "{{ conf.options|default({}) }}"
loop_control:
loop_var: section
- name: enable undercloud-ssl
include_tasks: tasks/ssl.yml
when: install.ssl or install.version|openstack_release > 13
tags: ssl
- name: create the base undercloud deploy script
template:
src: undercloud_deploy.sh.j2
dest: ~/undercloud_deploy.sh
mode: 0755
- name: the undercloud deploy script
command: "cat undercloud_deploy.sh"
tags: deploy
- name: generate container images environment file
import_tasks: tasks/prepare_uc_images.yml
when:
- install.version|openstack_distribution == 'OSP'
- install.version|openstack_release > 13
# to avoid i/o bottlenecks during overcloud deployment
# limit the number of nodes being deployed simultaneously to 5
- block:
- name: set max_concurrent_builds via hieradata
copy:
content: 'nova::compute::ironic::max_concurrent_builds: 5'
dest: "{{ working_dir }}/hiera_override.yaml"
- name: set additional config via hieradata
lineinfile:
path: "{{ working_dir }}/hiera_override.yaml"
state: present
line: "{{ item.key }}: {{ item.value }}"
regexp: "{{ item.key }}"
with_dict: "{{ install.hieradata.config|default({}) }}"
when: '"hieradata" in install'
- name: set hieradata in undercloud.conf
ini_file:
path: "{{ working_dir }}/undercloud.conf"
section: DEFAULT
option: hieradata_override
value: "{{ working_dir }}/hiera_override.yaml"
when:
- install.version|openstack_release > 9
- block:
- name: download workarounds file
get_url:
url: "{{ install.workarounds }}"
dest: ./workarounds.yml
delegate_to: localhost
- name: load workarounds vars
include_vars:
file: workarounds.yml
- name: create workarounds scripts
template:
src: templates/workarounds.sh.j2
dest: "~/{{ item }}.sh"
mode: 0775
with_items:
- 'pre_undercloud_deploy_workarounds'
- 'post_undercloud_deploy_workarounds'
when: install.workarounds != ''
- block:
- name: Initialize a variable with undercloud custom env file content
set_fact:
undercloud_custom_env_content: |
parameter_defaults:
IronicDefaultDeployInterface: direct
- name: Create the undercloud custom env file
copy:
dest: "{{ working_dir }}/undercloud_custom_env.yaml"
content: "{{ undercloud_custom_env_content }}"
- name: set custom env file in undercloud.conf
ini_file:
path: "{{ working_dir }}/undercloud.conf"
section: DEFAULT
option: custom_env_files
value: "{{ working_dir }}/undercloud_custom_env.yaml"
when:
- install.deploy_interface_default == 'direct'
- install.version|default(undercloud_version) | openstack_release > 13