blob: 679763c644f776f606154f5948e86d4edec7beaf [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
Dennis Dmitriev47433912018-03-25 04:24:59 +0300191- description: Install docker.io on gtw
192 cmd: salt-call cmd.run 'apt-get install docker.io -y'
193 node_name: {{ HOSTNAME_GTW01 }}
194 retry: {count: 1, delay: 30}
195 skip_fail: false
196
197- description: Enable forward policy
198 cmd: iptables --policy FORWARD ACCEPT
199 node_name: {{ HOSTNAME_GTW01 }}
200 retry: {count: 1, delay: 30}
201 skip_fail: false
202
Dennis Dmitriev47433912018-03-25 04:24:59 +0300203- description: create rc file on cfg
204 cmd: scp ctl01:/root/keystonercv3 /root
205 node_name: {{ HOSTNAME_CFG01 }}
206 retry: {count: 1, delay: 30}
207 skip_fail: false
208
209- description: Copy rc file
210 cmd: scp /root/keystonercv3 gtw01:/root
211 node_name: {{ HOSTNAME_CFG01 }}
212 retry: {count: 1, delay: 30}
213 skip_fail: false