This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathopenstack_mutinode_prep.yml
executable file
·261 lines (224 loc) · 6.61 KB
/
openstack_mutinode_prep.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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#!/usr/bin/env ansible-playbook
---
- name: Requirements for OpenStack Kolla Deployment
hosts: ampere
any_errors_fatal: true
handlers:
- name: "Move terraform"
shell: "mv /tmp/terraform /usr/local/bin/terraform"
args:
chdir: "/tmp"
- name: "Change permissions on terraform"
file: 'name={{item}} mode=0755'
with_items:
- "/usr/local/bin/terraform"
tasks:
- name: Ensure /etc/network/interfaces is properly configured
template:
src: interfaces.j2
dest: /etc/network/interfaces
owner: root
group: root
- name: Restart network
service:
name: networking
state: restarted
- name: Update-alternatives python2
alternatives:
name: python
link: /usr/bin/python
path: /usr/bin/python2.7
priority: 1
- name: Update-alternatives python3
alternatives:
name: python
link: /usr/bin/python
path: /usr/bin/python3.7
priority: 2
- name: Installing Base Packages
apt:
name: "{{ packages }}"
state: present
update_cache: true
vars:
packages:
- aptitude
- screen
- sudo
- rsync
- git
- curl
- byobu
- asciinema
- docker.io
- python3-dev
- python3-pip
- python3-selinux
- python3-setuptools
- python3-virtualenv
- libffi-dev
- gcc
- libssl-dev
- bridge-utils
- cpu-checker
- libvirt-daemon*
- qemu-system
- qemu-efi
- virtinst
- virt-manager
- open-iscsi
- unzip
- name: Use pip3 to upgrade to latest pip
pip:
name: pip
executable: pip3
extra_args: "-U"
- name: Comment out the line begining with 127.0.1.1 in /etc/hosts
command: "sed -i 's/^127.0.1.1/#127.0.1.1/' /etc/hosts"
- name: Stop and disable of libvirt, iscsi.
service: 'name={{ item }} enabled=false state=stopped'
with_items:
- libvirtd
- iscsid
- open-iscsi
- name: Adjust Apparmor for libvirtd
command: 'apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd'
- name: Add openstack1 as an insecure docker registry on all nodes
copy:
src: files/daemon.json
dest: /etc/docker/daemon.json
- name: Restart docker
service:
name: docker
state: restarted
- name: Ensure /etc/kolla/config directories
file:
path: "{{item}}"
state: directory
mode: 0775
owner: root
group: root
with_items:
- /etc/kolla
- /etc/kolla/config
- /etc/ansible
- /etc/ansible/inventory
- name: Copy ansible multinode inventory for this cluster to /etc/ansible/inventory/multinode on openstack1
copy:
src: files/multinode
dest: /etc/ansible/inventory/multinode
when:
- inventory_hostname == "openstack1"
- name: Copy globals.yaml for this multinode to openstack1
copy:
src: files/globals.yml
dest: /etc/kolla/globals.yml
when:
- inventory_hostname == "openstack1"
- name: Use git to retrieve OpenStack Kolla
git:
repo: https://opendev.org/openstack/kolla
dest: /opt/kolla
clone: yes
update: yes
force: yes
when:
- inventory_hostname == "openstack1"
- name: Use git to retrieve OpenStack kolla-ansible
git:
repo: https://opendev.org/openstack/kolla-ansible
dest: /opt/kolla-ansible
clone: yes
update: yes
force: yes
when:
- inventory_hostname == "openstack1"
- name: Use pip3 to install ansible
pip:
name: ansible
executable: pip3
extra_args: "-U"
when:
- inventory_hostname == "openstack1"
- name: Use pip3 to install openstack kolla
pip:
name: git+https://opendev.org/openstack/kolla
executable: pip3
when:
- inventory_hostname == "openstack1"
- name: Use pip3 to install openstack kolla-ansible
pip:
name: git+https://opendev.org/openstack/kolla-ansible
executable: pip3
when:
- inventory_hostname == "openstack1"
- name: Copy /opt/kolla-ansible/etc/kolla/passwords.yml to /etc/kolla/passwords.yml
copy:
src: /opt/kolla-ansible/etc/kolla/passwords.yml
dest: /etc/kolla/passwords.yml
remote_src: yes
when:
- inventory_hostname == "openstack1"
- name: Copy /usr/local/share/kolla/etc_examples/oslo-config-generator/kolla-build.conf to /etc/kolla/kolla-build.conf
copy:
src: /usr/local/share/kolla/etc_examples/oslo-config-generator/kolla-build.conf
dest: /etc/kolla/kolla-build.conf
remote_src: yes
when:
- inventory_hostname == "openstack1"
- name: Download and decompress terraform.
unarchive:
src: "https://releases.hashicorp.com/terraform/0.12.10/terraform_0.12.10_linux_arm.zip"
dest: "/tmp/"
remote_src: yes
when:
- inventory_hostname == "openstack1"
notify:
- "Move terraform"
- "Change permissions on terraform"
- name: Use git to retrieve terraform-openstack-images
git:
repo: https://github.com/amperecomputing/terraform-openstack-images
dest: /opt/terraform-openstack-images
clone: yes
update: yes
force: yes
when:
- inventory_hostname == "openstack1"
- name: Use git to retrieve terraform-openstack-magnum-clusters
git:
repo: https://github.com/ppouliot/terraform-openstack-magnum-clusters
dest: /opt/terraform-openstack-magnum-clusters
clone: yes
update: yes
force: yes
when:
- inventory_hostname == "openstack1"
- name: Run start-registry from installed kolla-ansible tools
command: /usr/local/share/kolla/tools/start-registry
args:
chdir: '/etc/kolla'
when:
- inventory_hostname == "openstack1"
# - name: Build kolla containers
# command: 'kolla-build -b debian -t source'
# when:
# - inventory_hostname == "openstack1"
- name: Generate kolla-ansible passwords
command: '/usr/local/bin/kolla-genpwd'
args:
chdir: '/etc/kolla'
when:
- inventory_hostname == "openstack1"
# - name: Generate kolla-ansible multinode certificates
# command: 'kolla-ansible -i /etc/ansible/inventory/multinode certificates'
# when:
# - inventory_hostname == "openstack1"
# - name: kolla-ansible multinode bootstrap servers
# command: 'kolla-ansible -i /etc/ansible/inventory/multinode bootstrap-servers'
# when:
# - inventory_hostname == "openstack1"
# - name: kolla-ansible multinode bootstrap prechecks
# command: 'kolla-ansible -i /etc/ansible/inventory/multinode bootstrap-servers'
# when:
# - inventory_hostname == "openstack1"