blob: 9de0459f592cc020deadf8b617b3afcc2cb446c1 [file] [log] [blame]
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +02001{% from 'virtual-mcp-pike-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %}
2{% from 'virtual-mcp-pike-dvr/underlay.yaml' import HOSTNAME_CTL01 with context %}
3{% from 'virtual-mcp-pike-dvr/underlay.yaml' import HOSTNAME_CTL02 with context %}
4{% from 'virtual-mcp-pike-dvr/underlay.yaml' import HOSTNAME_CTL03 with context %}
5{% from 'virtual-mcp-pike-dvr/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
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +020013# 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
Dennis Dmitriev4034db02018-08-26 21:50:13 +030035{{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE(USE_ORCHESTRATE=false) }}
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +020036
Dennis Dmitriev4034db02018-08-26 21:50:13 +030037{{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }}
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +020038
Dennis Dmitriev4034db02018-08-26 21:50:13 +030039{{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }}
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +020040
Dennis Dmitriev4034db02018-08-26 21:50:13 +030041{{ SHARED_OPENSTACK.MACRO_INSTALL_CINDER() }}
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +020042
Dennis Dmitriev4034db02018-08-26 21:50:13 +030043{{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON() }}
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +020044
45# isntall designate
46- description: Install powerdns
47 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
48 -C 'I@powerdns:server' state.sls powerdns.server
49 node_name: {{ HOSTNAME_CFG01 }}
50 retry: {count: 1, delay: 5}
51 skip_fail: false
52
53- description: Install designate
54 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
55 -C 'I@designate:server' state.sls designate -b 1
56 node_name: {{ HOSTNAME_CFG01 }}
57 retry: {count: 5, delay: 10}
58 skip_fail: false
59
Dennis Dmitriev4034db02018-08-26 21:50:13 +030060{{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }}
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +020061
62- description: Deploy horizon dashboard
63 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
64 -C 'I@horizon:server' state.sls horizon
65 node_name: {{ HOSTNAME_CFG01 }}
66 retry: {count: 1, delay: 5}
67 skip_fail: true
68
69- description: Deploy nginx proxy
70 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
71 -C 'I@nginx:server' state.sls nginx
72 node_name: {{ HOSTNAME_CFG01 }}
73 retry: {count: 1, delay: 5}
74 skip_fail: true
75
76
77# Install compute node
78
79- description: Apply formulas for compute node
80 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
81 node_name: {{ HOSTNAME_CFG01 }}
82 retry: {count: 1, delay: 5}
83 skip_fail: true
84
85- description: Re-apply(as in doc) 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: false
90
91- description: Check IP on computes
92 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
93 'ip a'
94 node_name: {{ HOSTNAME_CFG01 }}
95 retry: {count: 10, delay: 30}
96 skip_fail: false
97
98
99 # Upload cirros image
100
101- description: Upload cirros image on ctl01
102 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
103 'wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-i386-disk.img'
104 node_name: {{ HOSTNAME_CFG01 }}
105 retry: {count: 2, delay: 30}
106 skip_fail: false
107
108- description: Register image in glance
109 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
110 '. /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'
111 node_name: {{ HOSTNAME_CFG01 }}
112 retry: {count: 1, delay: 30}
113 skip_fail: false
114
115- description: Create net04_external
116 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
117 '. /root/keystonercv3; neutron net-create net04_ext --router:external True --provider:physical_network physnet1 --provider:network_type flat'
118 node_name: {{ HOSTNAME_CFG01 }}
119 retry: {count: 1, delay: 30}
120 skip_fail: false
121
122- description: Create subnet_external
123 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
124 '. /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'
125 node_name: {{ HOSTNAME_CFG01 }}
126 retry: {count: 1, delay: 30}
127 skip_fail: false
128
129- description: Create net04
130 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
131 '. /root/keystonercv3; neutron net-create net04'
132 node_name: {{ HOSTNAME_CFG01 }}
133 retry: {count: 1, delay: 30}
134 skip_fail: false
135
136- description: Create subnet_net04
137 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
138 '. /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'
139 node_name: {{ HOSTNAME_CFG01 }}
140 retry: {count: 1, delay: 30}
141 skip_fail: false
142
143- description: Create router
144 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
145 '. /root/keystonercv3; neutron router-create net04_router01'
146 node_name: {{ HOSTNAME_CFG01 }}
147 retry: {count: 1, delay: 30}
148 skip_fail: false
149
150- description: Set geteway
151 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
152 '. /root/keystonercv3; neutron router-gateway-set net04_router01 net04_ext'
153 node_name: {{ HOSTNAME_CFG01 }}
154 retry: {count: 1, delay: 30}
155 skip_fail: false
156
157- description: Add interface
158 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
159 '. /root/keystonercv3; neutron router-interface-add net04_router01 net04__subnet'
160 node_name: {{ HOSTNAME_CFG01 }}
161 retry: {count: 1, delay: 30}
162 skip_fail: false
163
164#- description: Allow all tcp
165# cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
166# '. /root/keystonercv3; nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0'
167# node_name: {{ HOSTNAME_CFG01 }}
168# retry: {count: 1, delay: 30}
169# skip_fail: false
170#
171#- description: Allow all icmp
172# cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
173# '. /root/keystonercv3; nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0'
174# node_name: {{ HOSTNAME_CFG01 }}
175# retry: {count: 1, delay: 30}
176# skip_fail: false
177
178- description: sync time
179 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run
180 'service ntp stop; ntpd -gq; service ntp start'
181 node_name: {{ HOSTNAME_CFG01 }}
182 retry: {count: 1, delay: 30}
183 skip_fail: false
184
185# Configure cinder-volume salt-call PROD-13167
186- description: Set disks 01
187 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
188 node_name: {{ HOSTNAME_CTL01 }}
189 retry: {count: 1, delay: 30}
190 skip_fail: false
191
192- description: Set disks 02
193 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
194 node_name: {{ HOSTNAME_CTL02 }}
195 retry: {count: 1, delay: 30}
196 skip_fail: false
197
198- description: Set disks 03
199 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
200 node_name: {{ HOSTNAME_CTL03 }}
201 retry: {count: 1, delay: 30}
202 skip_fail: false
203
204- description: Create partitions 01
205 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
206 node_name: {{ HOSTNAME_CTL01 }}
207 retry: {count: 1, delay: 30}
208 skip_fail: false
209
210- description: Create partitions 02
211 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
212 node_name: {{ HOSTNAME_CTL02 }}
213 retry: {count: 1, delay: 30}
214 skip_fail: false
215
216- description: Create partitions 03
217 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
218 node_name: {{ HOSTNAME_CTL03 }}
219 retry: {count: 1, delay: 30}
220 skip_fail: false
221
222- description: create volume_group
223 cmd: salt "ctl*" cmd.run 'vgcreate cinder-volumes /dev/vdb1'
224 node_name: {{ HOSTNAME_CFG01 }}
225 retry: {count: 1, delay: 30}
226 skip_fail: false
227
228- description: Install cinder-volume
229 cmd: salt 'ctl*' cmd.run 'apt-get install cinder-volume -y'
230 node_name: {{ HOSTNAME_CFG01 }}
231 retry: {count: 1, delay: 30}
232 skip_fail: false
233
234- description: Install crudini
235 cmd: salt "ctl*" cmd.run 'apt-get install crudini -y'
236 node_name: {{ HOSTNAME_CFG01 }}
237 retry: {count: 1, delay: 30}
238 skip_fail: false
239
240- description: Temporary WR set enabled backends value 01
241 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
242 node_name: {{ HOSTNAME_CTL01 }}
243 retry: {count: 1, delay: 30}
244 skip_fail: false
245
246- description: Temporary WR set enabled backends value 02
247 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
248 node_name: {{ HOSTNAME_CTL02 }}
249 retry: {count: 1, delay: 30}
250 skip_fail: false
251
252- description: Temporary WR set enabled backends value 03
253 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
254 node_name: {{ HOSTNAME_CTL03 }}
255 retry: {count: 1, delay: 30}
256 skip_fail: false
257
258- description: Install docker.io on gtw
259 cmd: salt-call cmd.run 'apt-get install docker.io -y'
260 node_name: {{ HOSTNAME_GTW01 }}
261 retry: {count: 1, delay: 30}
262 skip_fail: false
263
264- description: Restart cinder volume
265 cmd: |
266 salt -C 'I@cinder:controller' service.restart cinder-volume;
267 node_name: {{ HOSTNAME_CFG01 }}
268 retry: {count: 2, delay: 5}
269 skip_fail: false
270
271- description: create rc file on cfg
272 cmd: scp ctl01:/root/keystonercv3 /root
273 node_name: {{ HOSTNAME_CFG01 }}
274 retry: {count: 1, delay: 30}
275 skip_fail: false
276
277- description: Copy rc file
278 cmd: scp /root/keystonercv3 gtw01:/root
279 node_name: {{ HOSTNAME_CFG01 }}
280 retry: {count: 1, delay: 30}
281 skip_fail: false