blob: a779e5d095e51fb50fbba453180654b9e81a7b67 [file] [log] [blame]
Dennis Dmitriev47433912018-03-25 04:24:59 +03001{% from 'cookied-mcp-pike-dvr-ssl/underlay.yaml' import HOSTNAME_CFG01 with context %}
2{% from 'cookied-mcp-pike-dvr-ssl/underlay.yaml' import HOSTNAME_CTL01 with context %}
3{% from 'cookied-mcp-pike-dvr-ssl/underlay.yaml' import HOSTNAME_CTL02 with context %}
4{% from 'cookied-mcp-pike-dvr-ssl/underlay.yaml' import HOSTNAME_CTL03 with context %}
5{% from 'cookied-mcp-pike-dvr-ssl/underlay.yaml' import HOSTNAME_GTW01 with context %}
6{% from 'shared-salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %}
7{% from 'shared-salt.yaml' import IPV4_NET_TENANT_PREFIX with context %}
8{% set LAB_CONFIG_NAME = os_env('LAB_CONFIG_NAME') %}
9{% set OVERRIDE_POLICY = os_env('OVERRIDE_POLICY', '') %}
10
Dennis Dmitriev4034db02018-08-26 21:50:13 +030011{% import 'shared-openstack.yaml' as SHARED_OPENSTACK with context %}
12
Dennis Dmitriev47433912018-03-25 04:24:59 +030013# Install OpenStack control services
14
15{%- if OVERRIDE_POLICY != '' %}
16- description: Upload policy override
17 upload:
18 local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
19 local_filename: overrides-policy.yml
20 remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/
21 node_name: {{ HOSTNAME_CFG01 }}
22
23- description: Create custom cluster control class
24 cmd: echo -e "classes:\n- cluster.{{ LAB_CONFIG_NAME }}.openstack.control_orig\n$(cat /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/overrides-policy.yml)" > /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/overrides-policy.yml
25 node_name: {{ HOSTNAME_CFG01 }}
26
27- description: Rename control classes
28 cmd: mv /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control_orig.yml &&
29 ln -s /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/overrides-policy.yml /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml &&
30 salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all &&
31 salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
32 node_name: {{ HOSTNAME_CFG01 }}
33{%- endif %}
34
35- description: Nginx
36 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
37 -C 'I@nginx:server' state.sls salt.minion
38 node_name: {{ HOSTNAME_CFG01 }}
39 retry: {count: 1, delay: 5}
40 skip_fail: true
41
42- description: Deploy nginx proxy
43 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
44 -C 'I@nginx:server' state.sls nginx
45 node_name: {{ HOSTNAME_CFG01 }}
46 retry: {count: 1, delay: 5}
47 skip_fail: true
48
sgudz62df2fc2018-10-09 12:26:19 +030049{{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE() }}
Dennis Dmitriev47433912018-03-25 04:24:59 +030050
Dennis Dmitriev4034db02018-08-26 21:50:13 +030051{{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }}
Dennis Dmitriev47433912018-03-25 04:24:59 +030052
Dennis Dmitriev4034db02018-08-26 21:50:13 +030053{{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }}
Dennis Dmitriev47433912018-03-25 04:24:59 +030054
Dennis Dmitriev4034db02018-08-26 21:50:13 +030055{{ SHARED_OPENSTACK.MACRO_INSTALL_CINDER() }}
Dennis Dmitriev47433912018-03-25 04:24:59 +030056
Dennis Dmitriev4034db02018-08-26 21:50:13 +030057{{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON() }}
Dennis Dmitriev47433912018-03-25 04:24:59 +030058
59# isntall designate
60- description: Install powerdns
61 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
62 -C 'I@powerdns:server' state.sls powerdns.server
63 node_name: {{ HOSTNAME_CFG01 }}
64 retry: {count: 1, delay: 5}
65 skip_fail: false
66
67- description: Install designate
68 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
69 -C 'I@designate:server' state.sls designate -b 1
70 node_name: {{ HOSTNAME_CFG01 }}
71 retry: {count: 5, delay: 10}
72 skip_fail: false
73
Dennis Dmitriev4034db02018-08-26 21:50:13 +030074{{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }}
Dennis Dmitriev47433912018-03-25 04:24:59 +030075
76- description: Deploy horizon dashboard
77 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
78 -C 'I@horizon:server' state.sls horizon
79 node_name: {{ HOSTNAME_CFG01 }}
80 retry: {count: 1, delay: 5}
81 skip_fail: true
82
83# Install compute node
84
85- description: Apply formulas for compute node
86 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
87 node_name: {{ HOSTNAME_CFG01 }}
88 retry: {count: 1, delay: 5}
89 skip_fail: true
90
91- description: Re-apply(as in doc) formulas for compute node
92 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
93 node_name: {{ HOSTNAME_CFG01 }}
94 retry: {count: 1, delay: 5}
95 skip_fail: false
96
97- description: Check IP on computes
98 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
99 'ip a'
100 node_name: {{ HOSTNAME_CFG01 }}
101 retry: {count: 10, delay: 30}
102 skip_fail: false
103
104
105 # Upload cirros image
106
107- description: Upload cirros image on ctl01
108 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
109 'wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-i386-disk.img'
110 node_name: {{ HOSTNAME_CFG01 }}
111 retry: {count: 2, delay: 30}
112 skip_fail: false
113
114- description: Register image in glance
115 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
116 '. /root/keystonercv3; glance --timeout 120 image-create --name cirros --visibility public --disk-format qcow2 --container-format bare --progress < /root/cirros-0.3.4-i386-disk.img'
117 node_name: {{ HOSTNAME_CFG01 }}
118 retry: {count: 1, delay: 30}
119 skip_fail: false
120
121- description: Create net04_external
122 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
123 '. /root/keystonercv3; neutron net-create net04_ext --router:external True --provider:physical_network physnet1 --provider:network_type flat'
124 node_name: {{ HOSTNAME_CFG01 }}
125 retry: {count: 1, delay: 30}
126 skip_fail: false
127
128- description: Create subnet_external
129 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
130 '. /root/keystonercv3; neutron subnet-create net04_ext {{ IPV4_NET_EXTERNAL_PREFIX }}.0/24 --name net04_ext__subnet --disable-dhcp --allocation-pool start={{ IPV4_NET_EXTERNAL_PREFIX }}.150,end={{ IPV4_NET_EXTERNAL_PREFIX }}.180 --gateway {{ IPV4_NET_EXTERNAL_PREFIX }}.1'
131 node_name: {{ HOSTNAME_CFG01 }}
132 retry: {count: 1, delay: 30}
133 skip_fail: false
134
135- description: Create net04
136 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
137 '. /root/keystonercv3; neutron net-create net04'
138 node_name: {{ HOSTNAME_CFG01 }}
139 retry: {count: 1, delay: 30}
140 skip_fail: false
141
142- description: Create subnet_net04
143 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
144 '. /root/keystonercv3; neutron subnet-create net04 {{ IPV4_NET_TENANT_PREFIX }}.0/24 --name net04__subnet --allocation-pool start={{ IPV4_NET_TENANT_PREFIX }}.120,end={{ IPV4_NET_TENANT_PREFIX }}.240'
145 node_name: {{ HOSTNAME_CFG01 }}
146 retry: {count: 1, delay: 30}
147 skip_fail: false
148
149- description: Create router
150 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
151 '. /root/keystonercv3; neutron router-create net04_router01'
152 node_name: {{ HOSTNAME_CFG01 }}
153 retry: {count: 1, delay: 30}
154 skip_fail: false
155
156- description: Set geteway
157 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
158 '. /root/keystonercv3; neutron router-gateway-set net04_router01 net04_ext'
159 node_name: {{ HOSTNAME_CFG01 }}
160 retry: {count: 1, delay: 30}
161 skip_fail: false
162
163- description: Add interface
164 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
165 '. /root/keystonercv3; neutron router-interface-add net04_router01 net04__subnet'
166 node_name: {{ HOSTNAME_CFG01 }}
167 retry: {count: 1, delay: 30}
168 skip_fail: false
169
170#- description: Allow all tcp
171# cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
172# '. /root/keystonercv3; nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0'
173# node_name: {{ HOSTNAME_CFG01 }}
174# retry: {count: 1, delay: 30}
175# skip_fail: false
176#
177#- description: Allow all icmp
178# cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
179# '. /root/keystonercv3; nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0'
180# node_name: {{ HOSTNAME_CFG01 }}
181# retry: {count: 1, delay: 30}
182# skip_fail: false
183
184- description: sync time
185 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run
186 'service ntp stop; ntpd -gq; service ntp start'
187 node_name: {{ HOSTNAME_CFG01 }}
188 retry: {count: 1, delay: 30}
189 skip_fail: false
190
191# Configure cinder-volume salt-call PROD-13167
192- description: Set disks 01
193 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
194 node_name: {{ HOSTNAME_CTL01 }}
195 retry: {count: 1, delay: 30}
196 skip_fail: false
197
198- description: Set disks 02
199 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
200 node_name: {{ HOSTNAME_CTL02 }}
201 retry: {count: 1, delay: 30}
202 skip_fail: false
203
204- description: Set disks 03
205 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
206 node_name: {{ HOSTNAME_CTL03 }}
207 retry: {count: 1, delay: 30}
208 skip_fail: false
209
210- description: Create partitions 01
211 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
212 node_name: {{ HOSTNAME_CTL01 }}
213 retry: {count: 1, delay: 30}
214 skip_fail: false
215
216- description: Create partitions 02
217 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
218 node_name: {{ HOSTNAME_CTL02 }}
219 retry: {count: 1, delay: 30}
220 skip_fail: false
221
222- description: Create partitions 03
223 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
224 node_name: {{ HOSTNAME_CTL03 }}
225 retry: {count: 1, delay: 30}
226 skip_fail: false
227
228- description: create volume_group
229 cmd: salt "ctl*" cmd.run 'vgcreate cinder-volumes /dev/vdb1'
230 node_name: {{ HOSTNAME_CFG01 }}
231 retry: {count: 1, delay: 30}
232 skip_fail: false
233
234- description: Install cinder-volume
235 cmd: salt 'ctl*' cmd.run 'apt-get install cinder-volume -y'
236 node_name: {{ HOSTNAME_CFG01 }}
237 retry: {count: 1, delay: 30}
238 skip_fail: false
239
240- description: Install crudini
241 cmd: salt "ctl*" cmd.run 'apt-get install crudini -y'
242 node_name: {{ HOSTNAME_CFG01 }}
243 retry: {count: 1, delay: 30}
244 skip_fail: false
245
246- description: Temporary WR set enabled backends value 01
247 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
248 node_name: {{ HOSTNAME_CTL01 }}
249 retry: {count: 1, delay: 30}
250 skip_fail: false
251
252- description: Temporary WR set enabled backends value 02
253 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
254 node_name: {{ HOSTNAME_CTL02 }}
255 retry: {count: 1, delay: 30}
256 skip_fail: false
257
258- description: Temporary WR set enabled backends value 03
259 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
260 node_name: {{ HOSTNAME_CTL03 }}
261 retry: {count: 1, delay: 30}
262 skip_fail: false
263
264- description: Install docker.io on gtw
265 cmd: salt-call cmd.run 'apt-get install docker.io -y'
266 node_name: {{ HOSTNAME_GTW01 }}
267 retry: {count: 1, delay: 30}
268 skip_fail: false
269
270- description: Enable forward policy
271 cmd: iptables --policy FORWARD ACCEPT
272 node_name: {{ HOSTNAME_GTW01 }}
273 retry: {count: 1, delay: 30}
274 skip_fail: false
275
276- description: Restart cinder volume
277 cmd: |
278 salt -C 'I@cinder:controller' service.restart cinder-volume;
279 node_name: {{ HOSTNAME_CFG01 }}
280 retry: {count: 2, delay: 5}
281 skip_fail: false
282
283- description: create rc file on cfg
284 cmd: scp ctl01:/root/keystonercv3 /root
285 node_name: {{ HOSTNAME_CFG01 }}
286 retry: {count: 1, delay: 30}
287 skip_fail: false
288
289- description: Copy rc file
290 cmd: scp /root/keystonercv3 gtw01:/root
291 node_name: {{ HOSTNAME_CFG01 }}
292 retry: {count: 1, delay: 30}
293 skip_fail: false