blob: d057d510da23750147bf8d7639fb8b0b7218c295 [file] [log] [blame]
Dennis Dmitrievab83ea42017-05-12 16:52:45 +03001{% from 'virtual-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %}
Tatyana Leontovich6238ba52017-06-22 19:31:56 +03002{% from 'virtual-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CTL01 with context %}
3{% from 'virtual-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CTL02 with context %}
4{% from 'virtual-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CTL03 with context %}
Tatyana Leontovich7c97e802017-07-19 17:08:39 +03005{% from 'virtual-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_GTW01 with context %}
Sergii Golovatiuk50f91892017-08-04 18:11:06 +02006{% from 'shared-salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %}
7{% from 'shared-salt.yaml' import IPV4_NET_TENANT_PREFIX with context %}
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +03008{% set LAB_CONFIG_NAME = os_env('LAB_CONFIG_NAME') %}
Tatyana Leontovichd08f8812017-11-09 12:52:21 +02009{% set OVERRIDE_POLICY = os_env('OVERRIDE_POLICY', '') %}
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030010
ibumarskov942417e2018-08-23 22:05:59 +040011{% import 'shared-openstack.yaml' as SHARED_OPENSTACK with context %}
12
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030013# Install OpenStack control services
14
Tatyana Leontovichd08f8812017-11-09 12:52:21 +020015{%- if OVERRIDE_POLICY != '' %}
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +030016- 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 }}
Dmitry Tyzhnenko33eea152017-11-02 23:25:09 +020033{%- endif %}
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +030034
ibumarskov7bdc7ed2018-08-24 12:06:38 +040035# Deploy nginx before openstack services (PROD-22740)
36- description: Deploy nginx proxy
37 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
38 -C 'I@nginx:server' state.sls nginx
39 node_name: {{ HOSTNAME_CFG01 }}
40 retry: {count: 1, delay: 5}
41 skip_fail: true
42
sgudz62df2fc2018-10-09 12:26:19 +030043{{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE() }}
ibumarskove23c10e2018-08-20 15:47:58 +040044
ibumarskov7e886672018-08-23 13:52:13 +040045{{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }}
Dennis Dmitriev4ab889c2017-04-27 14:11:04 +030046
ibumarskov7e886672018-08-23 13:52:13 +040047{{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }}
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030048
ibumarskov7e886672018-08-23 13:52:13 +040049{{ SHARED_OPENSTACK.MACRO_INSTALL_CINDER() }}
Tatyana Leontovichfa7ae4d2017-04-25 13:46:14 +030050
ibumarskov7e886672018-08-23 13:52:13 +040051{{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON() }}
Tatyana Leontovichfa7ae4d2017-04-25 13:46:14 +030052
ibumarskov7e886672018-08-23 13:52:13 +040053{{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }}
Dennis Dmitriev4ab889c2017-04-27 14:11:04 +030054
ibumarskov7e886672018-08-23 13:52:13 +040055# install designate backend
Tatyana Leontovichc33be1f2017-07-19 17:38:30 +030056- description: Install powerdns
57 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Tatyana Leontovich8d815a82017-10-05 16:01:26 +030058 -C 'I@powerdns:server' state.sls powerdns.server
Tatyana Leontovichc33be1f2017-07-19 17:38:30 +030059 node_name: {{ HOSTNAME_CFG01 }}
60 retry: {count: 1, delay: 5}
61 skip_fail: false
62
ibumarskov7e886672018-08-23 13:52:13 +040063{{ SHARED_OPENSTACK.MACRO_INSTALL_DESIGNATE() }}
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030064
ibumarskov7e886672018-08-23 13:52:13 +040065{{ SHARED_OPENSTACK.MACRO_INSTALL_HORIZON() }}
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030066
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030067# Install compute node
68
69- description: Apply formulas for compute node
70 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
71 node_name: {{ HOSTNAME_CFG01 }}
72 retry: {count: 1, delay: 5}
73 skip_fail: true
74
75- description: Re-apply(as in doc) formulas for compute node
76 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
77 node_name: {{ HOSTNAME_CFG01 }}
78 retry: {count: 1, delay: 5}
Oleksii Butenko9f2601c2018-02-08 15:13:21 +020079 skip_fail: false
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030080
81- description: Check IP on computes
82 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
83 'ip a'
84 node_name: {{ HOSTNAME_CFG01 }}
85 retry: {count: 10, delay: 30}
86 skip_fail: false
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +030087
88
89 # Upload cirros image
90
91- description: Upload cirros image on ctl01
92 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
ibumarskov2cea0d42018-07-24 08:40:50 +040093 'wget http://images.mirantis.com.s3.amazonaws.com/cirros-x64-20170828.qcow2'
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +030094 node_name: {{ HOSTNAME_CFG01 }}
95 retry: {count: 2, delay: 30}
96 skip_fail: false
97
98- description: Register image in glance
99 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
ibumarskov2cea0d42018-07-24 08:40:50 +0400100 '. /root/keystonercv3; glance --timeout 120 image-create --name cirros --visibility public --disk-format qcow2 --container-format bare --progress < /root/cirros-x64-20170828.qcow2'
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +0300101 node_name: {{ HOSTNAME_CFG01 }}
102 retry: {count: 1, delay: 30}
103 skip_fail: false
104
105- description: Create net04_external
106 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
Tatyana Leontovich674abf82017-07-20 15:44:15 +0300107 '. /root/keystonercv3; neutron net-create net04_ext --router:external True --provider:physical_network physnet1 --provider:network_type flat'
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +0300108 node_name: {{ HOSTNAME_CFG01 }}
109 retry: {count: 1, delay: 30}
110 skip_fail: false
111
112- description: Create subnet_external
113 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
114 '. /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'
115 node_name: {{ HOSTNAME_CFG01 }}
116 retry: {count: 1, delay: 30}
117 skip_fail: false
118
119- description: Create net04
120 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
121 '. /root/keystonercv3; neutron net-create net04'
122 node_name: {{ HOSTNAME_CFG01 }}
123 retry: {count: 1, delay: 30}
124 skip_fail: false
125
126- description: Create subnet_net04
127 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
128 '. /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'
129 node_name: {{ HOSTNAME_CFG01 }}
130 retry: {count: 1, delay: 30}
131 skip_fail: false
132
133- description: Create router
134 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
135 '. /root/keystonercv3; neutron router-create net04_router01'
136 node_name: {{ HOSTNAME_CFG01 }}
137 retry: {count: 1, delay: 30}
138 skip_fail: false
139
ibumarskovc075df82018-07-30 13:23:07 +0400140- description: Set gateway
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +0300141 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
142 '. /root/keystonercv3; neutron router-gateway-set net04_router01 net04_ext'
143 node_name: {{ HOSTNAME_CFG01 }}
144 retry: {count: 1, delay: 30}
145 skip_fail: false
146
147- description: Add interface
148 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
149 '. /root/keystonercv3; neutron router-interface-add net04_router01 net04__subnet'
150 node_name: {{ HOSTNAME_CFG01 }}
151 retry: {count: 1, delay: 30}
152 skip_fail: false
153
154- description: Allow all tcp
155 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
156 '. /root/keystonercv3; nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0'
157 node_name: {{ HOSTNAME_CFG01 }}
158 retry: {count: 1, delay: 30}
159 skip_fail: false
160
161- description: Allow all icmp
162 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
163 '. /root/keystonercv3; nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0'
164 node_name: {{ HOSTNAME_CFG01 }}
165 retry: {count: 1, delay: 30}
166 skip_fail: false
167
Tatyana Leontovichfa31b392017-07-24 18:37:41 +0300168- description: sync time
169 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run
170 'service ntp stop; ntpd -gq; service ntp start'
171 node_name: {{ HOSTNAME_CFG01 }}
172 retry: {count: 1, delay: 30}
173 skip_fail: false
174
Tatyana Leontovichfa31b392017-07-24 18:37:41 +0300175# Configure cinder-volume salt-call PROD-13167
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +0300176- description: Set disks 01
177 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
178 node_name: {{ HOSTNAME_CTL01 }}
179 retry: {count: 1, delay: 30}
180 skip_fail: false
181
182- description: Set disks 02
183 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
184 node_name: {{ HOSTNAME_CTL02 }}
185 retry: {count: 1, delay: 30}
186 skip_fail: false
187
188- description: Set disks 03
189 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
190 node_name: {{ HOSTNAME_CTL03 }}
191 retry: {count: 1, delay: 30}
192 skip_fail: false
193
194- description: Create partitions 01
195 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
196 node_name: {{ HOSTNAME_CTL01 }}
197 retry: {count: 1, delay: 30}
198 skip_fail: false
199
200- description: Create partitions 02
201 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
sgudz2e393392017-10-17 12:51:26 +0300202 node_name: {{ HOSTNAME_CTL02 }}
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +0300203 retry: {count: 1, delay: 30}
204 skip_fail: false
205
206- description: Create partitions 03
207 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
sgudz2e393392017-10-17 12:51:26 +0300208 node_name: {{ HOSTNAME_CTL03 }}
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +0300209 retry: {count: 1, delay: 30}
Tatyana Leontovich7c97e802017-07-19 17:08:39 +0300210 skip_fail: false
211
212- description: create volume_group
213 cmd: salt "ctl*" cmd.run 'vgcreate cinder-volumes /dev/vdb1'
214 node_name: {{ HOSTNAME_CFG01 }}
215 retry: {count: 1, delay: 30}
216 skip_fail: false
217
218- description: Install cinder-volume
219 cmd: salt 'ctl*' cmd.run 'apt-get install cinder-volume -y'
220 node_name: {{ HOSTNAME_CFG01 }}
221 retry: {count: 1, delay: 30}
222 skip_fail: false
223
224- description: Install crudini
225 cmd: salt "ctl*" cmd.run 'apt-get install crudini -y'
226 node_name: {{ HOSTNAME_CFG01 }}
227 retry: {count: 1, delay: 30}
228 skip_fail: false
229
230- description: Temporary WR set enabled backends value 01
231 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
232 node_name: {{ HOSTNAME_CTL01 }}
233 retry: {count: 1, delay: 30}
234 skip_fail: false
235
236- description: Temporary WR set enabled backends value 02
237 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
238 node_name: {{ HOSTNAME_CTL02 }}
239 retry: {count: 1, delay: 30}
240 skip_fail: false
241
242- description: Temporary WR set enabled backends value 03
243 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
244 node_name: {{ HOSTNAME_CTL03 }}
245 retry: {count: 1, delay: 30}
246 skip_fail: false
247
248- description: Install docker.io on gtw
249 cmd: salt-call cmd.run 'apt-get install docker.io -y'
250 node_name: {{ HOSTNAME_GTW01 }}
251 retry: {count: 1, delay: 30}
252 skip_fail: false
253
Tatyana Leontovichd6bcbc92018-03-23 15:02:28 +0200254- description: Enable forward policy
255 cmd: iptables --policy FORWARD ACCEPT
256 node_name: {{ HOSTNAME_GTW01 }}
257 retry: {count: 1, delay: 30}
258 skip_fail: false
259
Tatyana Leontovich47f7bfe2018-01-05 13:36:09 +0200260- description: Restart cinder volume
261 cmd: |
262 salt -C 'I@cinder:controller' service.restart cinder-volume;
263 node_name: {{ HOSTNAME_CFG01 }}
264 retry: {count: 2, delay: 5}
265 skip_fail: false
266
Tatyana Leontovich7c97e802017-07-19 17:08:39 +0300267- description: create rc file on cfg
268 cmd: scp ctl01:/root/keystonercv3 /root
269 node_name: {{ HOSTNAME_CFG01 }}
270 retry: {count: 1, delay: 30}
271 skip_fail: false
272
273- description: Copy rc file
274 cmd: scp /root/keystonercv3 gtw01:/root
275 node_name: {{ HOSTNAME_CFG01 }}
276 retry: {count: 1, delay: 30}
277 skip_fail: false