blob: dc9de1c7ff4742b54d1f7e005413154a5582dd48 [file] [log] [blame]
Vladimir Khlyunev25f1e742018-11-07 16:52:10 +04001{% from 'cookied-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %}
2{% from 'cookied-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CTL01 with context %}
3{% from 'cookied-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CTL02 with context %}
4{% from 'cookied-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CTL03 with context %}
5{% from 'cookied-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 %}
Pavel Glazov78e6c592018-10-24 12:20:12 +040012{% import 'shared-salt.yaml' as SHARED with context %}
ibumarskov942417e2018-08-23 22:05:59 +040013
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030014# Install OpenStack control services
15
Tatyana Leontovichd08f8812017-11-09 12:52:21 +020016{%- if OVERRIDE_POLICY != '' %}
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +030017- description: Upload policy override
18 upload:
19 local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
20 local_filename: overrides-policy.yml
21 remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/
22 node_name: {{ HOSTNAME_CFG01 }}
23
24- description: Create custom cluster control class
25 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
26 node_name: {{ HOSTNAME_CFG01 }}
27
28- description: Rename control classes
29 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 &&
30 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 &&
31 salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all &&
32 salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
33 node_name: {{ HOSTNAME_CFG01 }}
Dmitry Tyzhnenko33eea152017-11-02 23:25:09 +020034{%- endif %}
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +030035
ibumarskov7bdc7ed2018-08-24 12:06:38 +040036# Deploy nginx before openstack services (PROD-22740)
37- description: Deploy nginx proxy
38 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
39 -C 'I@nginx:server' state.sls nginx
40 node_name: {{ HOSTNAME_CFG01 }}
41 retry: {count: 1, delay: 5}
42 skip_fail: true
43
sgudz62df2fc2018-10-09 12:26:19 +030044{{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE() }}
ibumarskove23c10e2018-08-20 15:47:58 +040045
ibumarskov7e886672018-08-23 13:52:13 +040046{{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }}
Dennis Dmitriev4ab889c2017-04-27 14:11:04 +030047
ibumarskov7e886672018-08-23 13:52:13 +040048{{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }}
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030049
ibumarskov7e886672018-08-23 13:52:13 +040050{{ SHARED_OPENSTACK.MACRO_INSTALL_CINDER() }}
Tatyana Leontovichfa7ae4d2017-04-25 13:46:14 +030051
ibumarskov7e886672018-08-23 13:52:13 +040052{{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON() }}
Tatyana Leontovichfa7ae4d2017-04-25 13:46:14 +030053
ibumarskov7e886672018-08-23 13:52:13 +040054{{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }}
Dennis Dmitriev4ab889c2017-04-27 14:11:04 +030055
ibumarskov7e886672018-08-23 13:52:13 +040056# install designate backend
Pavel Glazov24e61d12018-11-14 17:49:03 +040057- description: Install bind
Tatyana Leontovichc33be1f2017-07-19 17:38:30 +030058 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Pavel Glazov24e61d12018-11-14 17:49:03 +040059 -C 'I@bind:server' state.sls bind
Tatyana Leontovichc33be1f2017-07-19 17:38:30 +030060 node_name: {{ HOSTNAME_CFG01 }}
61 retry: {count: 1, delay: 5}
62 skip_fail: false
63
ibumarskov7e886672018-08-23 13:52:13 +040064{{ SHARED_OPENSTACK.MACRO_INSTALL_DESIGNATE() }}
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030065
ibumarskov7e886672018-08-23 13:52:13 +040066{{ SHARED_OPENSTACK.MACRO_INSTALL_HORIZON() }}
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030067
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030068# Install compute node
69
70- description: Apply formulas for compute node
71 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
72 node_name: {{ HOSTNAME_CFG01 }}
73 retry: {count: 1, delay: 5}
74 skip_fail: true
75
76- description: Re-apply(as in doc) formulas for compute node
77 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
78 node_name: {{ HOSTNAME_CFG01 }}
79 retry: {count: 1, delay: 5}
Oleksii Butenko9f2601c2018-02-08 15:13:21 +020080 skip_fail: false
Tatyana Leontovich38be41b2017-04-12 14:45:23 +030081
82- description: Check IP on computes
83 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
84 'ip a'
85 node_name: {{ HOSTNAME_CFG01 }}
86 retry: {count: 10, delay: 30}
87 skip_fail: false
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +030088
89
90 # Upload cirros image
91
92- description: Upload cirros image on ctl01
93 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
ibumarskov2cea0d42018-07-24 08:40:50 +040094 'wget http://images.mirantis.com.s3.amazonaws.com/cirros-x64-20170828.qcow2'
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +030095 node_name: {{ HOSTNAME_CFG01 }}
96 retry: {count: 2, delay: 30}
97 skip_fail: false
98
99- description: Register image in glance
100 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
ibumarskov2cea0d42018-07-24 08:40:50 +0400101 '. /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 +0300102 node_name: {{ HOSTNAME_CFG01 }}
103 retry: {count: 1, delay: 30}
104 skip_fail: false
105
106- description: Create net04_external
107 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
Tatyana Leontovich674abf82017-07-20 15:44:15 +0300108 '. /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 +0300109 node_name: {{ HOSTNAME_CFG01 }}
110 retry: {count: 1, delay: 30}
111 skip_fail: false
112
113- description: Create subnet_external
114 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
115 '. /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'
116 node_name: {{ HOSTNAME_CFG01 }}
117 retry: {count: 1, delay: 30}
118 skip_fail: false
119
120- description: Create net04
121 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
122 '. /root/keystonercv3; neutron net-create net04'
123 node_name: {{ HOSTNAME_CFG01 }}
124 retry: {count: 1, delay: 30}
125 skip_fail: false
126
127- description: Create subnet_net04
128 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
129 '. /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'
130 node_name: {{ HOSTNAME_CFG01 }}
131 retry: {count: 1, delay: 30}
132 skip_fail: false
133
134- description: Create router
135 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
136 '. /root/keystonercv3; neutron router-create net04_router01'
137 node_name: {{ HOSTNAME_CFG01 }}
138 retry: {count: 1, delay: 30}
139 skip_fail: false
140
ibumarskovc075df82018-07-30 13:23:07 +0400141- description: Set gateway
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +0300142 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
143 '. /root/keystonercv3; neutron router-gateway-set net04_router01 net04_ext'
144 node_name: {{ HOSTNAME_CFG01 }}
145 retry: {count: 1, delay: 30}
146 skip_fail: false
147
148- description: Add interface
149 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
150 '. /root/keystonercv3; neutron router-interface-add net04_router01 net04__subnet'
151 node_name: {{ HOSTNAME_CFG01 }}
152 retry: {count: 1, delay: 30}
153 skip_fail: false
154
155- description: Allow all tcp
156 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
157 '. /root/keystonercv3; nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0'
158 node_name: {{ HOSTNAME_CFG01 }}
159 retry: {count: 1, delay: 30}
160 skip_fail: false
161
162- description: Allow all icmp
163 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
164 '. /root/keystonercv3; nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0'
165 node_name: {{ HOSTNAME_CFG01 }}
166 retry: {count: 1, delay: 30}
167 skip_fail: false
168
Tatyana Leontovichfa31b392017-07-24 18:37:41 +0300169- description: sync time
170 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run
171 'service ntp stop; ntpd -gq; service ntp start'
172 node_name: {{ HOSTNAME_CFG01 }}
173 retry: {count: 1, delay: 30}
174 skip_fail: false
175
Pavel Glazov78e6c592018-10-24 12:20:12 +0400176{{ SHARED.INSTALL_DOCKER_ON_GTW() }}
Tatyana Leontovichd6bcbc92018-03-23 15:02:28 +0200177
Tatyana Leontovich7c97e802017-07-19 17:08:39 +0300178- description: create rc file on cfg
179 cmd: scp ctl01:/root/keystonercv3 /root
180 node_name: {{ HOSTNAME_CFG01 }}
181 retry: {count: 1, delay: 30}
182 skip_fail: false
183
184- description: Copy rc file
185 cmd: scp /root/keystonercv3 gtw01:/root
186 node_name: {{ HOSTNAME_CFG01 }}
187 retry: {count: 1, delay: 30}
188 skip_fail: false