Dennis Dmitriev | ab83ea4 | 2017-05-12 16:52:45 +0300 | [diff] [blame] | 1 | {% from 'virtual-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %} |
Tatyana Leontovich | 6238ba5 | 2017-06-22 19:31:56 +0300 | [diff] [blame] | 2 | {% 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 Leontovich | 7c97e80 | 2017-07-19 17:08:39 +0300 | [diff] [blame] | 5 | {% from 'virtual-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_GTW01 with context %} |
Sergii Golovatiuk | 50f9189 | 2017-08-04 18:11:06 +0200 | [diff] [blame] | 6 | {% from 'shared-salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %} |
| 7 | {% from 'shared-salt.yaml' import IPV4_NET_TENANT_PREFIX with context %} |
Dmitry Tyzhnenko | 8f6a63e | 2017-09-05 15:37:23 +0300 | [diff] [blame] | 8 | {% set LAB_CONFIG_NAME = os_env('LAB_CONFIG_NAME') %} |
Tatyana Leontovich | d08f881 | 2017-11-09 12:52:21 +0200 | [diff] [blame] | 9 | {% set OVERRIDE_POLICY = os_env('OVERRIDE_POLICY', '') %} |
Tatyana Leontovich | 38be41b | 2017-04-12 14:45:23 +0300 | [diff] [blame] | 10 | |
ibumarskov | 942417e | 2018-08-23 22:05:59 +0400 | [diff] [blame^] | 11 | {% import 'shared-openstack.yaml' as SHARED_OPENSTACK with context %} |
| 12 | |
Tatyana Leontovich | 38be41b | 2017-04-12 14:45:23 +0300 | [diff] [blame] | 13 | # Install OpenStack control services |
| 14 | |
Tatyana Leontovich | d08f881 | 2017-11-09 12:52:21 +0200 | [diff] [blame] | 15 | {%- if OVERRIDE_POLICY != '' %} |
Dmitry Tyzhnenko | 8f6a63e | 2017-09-05 15:37:23 +0300 | [diff] [blame] | 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 }} |
Dmitry Tyzhnenko | 33eea15 | 2017-11-02 23:25:09 +0200 | [diff] [blame] | 33 | {%- endif %} |
Dmitry Tyzhnenko | 8f6a63e | 2017-09-05 15:37:23 +0300 | [diff] [blame] | 34 | |
ibumarskov | 7e88667 | 2018-08-23 13:52:13 +0400 | [diff] [blame] | 35 | {{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE() }} |
ibumarskov | e23c10e | 2018-08-20 15:47:58 +0400 | [diff] [blame] | 36 | |
ibumarskov | 7e88667 | 2018-08-23 13:52:13 +0400 | [diff] [blame] | 37 | {{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }} |
Dennis Dmitriev | 4ab889c | 2017-04-27 14:11:04 +0300 | [diff] [blame] | 38 | |
ibumarskov | 7e88667 | 2018-08-23 13:52:13 +0400 | [diff] [blame] | 39 | {{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }} |
Tatyana Leontovich | 38be41b | 2017-04-12 14:45:23 +0300 | [diff] [blame] | 40 | |
ibumarskov | 7e88667 | 2018-08-23 13:52:13 +0400 | [diff] [blame] | 41 | {{ SHARED_OPENSTACK.MACRO_INSTALL_CINDER() }} |
Tatyana Leontovich | fa7ae4d | 2017-04-25 13:46:14 +0300 | [diff] [blame] | 42 | |
ibumarskov | 7e88667 | 2018-08-23 13:52:13 +0400 | [diff] [blame] | 43 | {{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON() }} |
Tatyana Leontovich | fa7ae4d | 2017-04-25 13:46:14 +0300 | [diff] [blame] | 44 | |
ibumarskov | 7e88667 | 2018-08-23 13:52:13 +0400 | [diff] [blame] | 45 | {{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }} |
Dennis Dmitriev | 4ab889c | 2017-04-27 14:11:04 +0300 | [diff] [blame] | 46 | |
ibumarskov | 7e88667 | 2018-08-23 13:52:13 +0400 | [diff] [blame] | 47 | # install designate backend |
Tatyana Leontovich | c33be1f | 2017-07-19 17:38:30 +0300 | [diff] [blame] | 48 | - description: Install powerdns |
| 49 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
Tatyana Leontovich | 8d815a8 | 2017-10-05 16:01:26 +0300 | [diff] [blame] | 50 | -C 'I@powerdns:server' state.sls powerdns.server |
Tatyana Leontovich | c33be1f | 2017-07-19 17:38:30 +0300 | [diff] [blame] | 51 | node_name: {{ HOSTNAME_CFG01 }} |
| 52 | retry: {count: 1, delay: 5} |
| 53 | skip_fail: false |
| 54 | |
ibumarskov | 7e88667 | 2018-08-23 13:52:13 +0400 | [diff] [blame] | 55 | {{ SHARED_OPENSTACK.MACRO_INSTALL_DESIGNATE() }} |
Tatyana Leontovich | 38be41b | 2017-04-12 14:45:23 +0300 | [diff] [blame] | 56 | |
ibumarskov | 7e88667 | 2018-08-23 13:52:13 +0400 | [diff] [blame] | 57 | {{ SHARED_OPENSTACK.MACRO_INSTALL_HORIZON() }} |
Tatyana Leontovich | 38be41b | 2017-04-12 14:45:23 +0300 | [diff] [blame] | 58 | |
Tatyana Leontovich | 38be41b | 2017-04-12 14:45:23 +0300 | [diff] [blame] | 59 | # Install compute node |
| 60 | |
| 61 | - description: Apply formulas for compute node |
| 62 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply |
| 63 | node_name: {{ HOSTNAME_CFG01 }} |
| 64 | retry: {count: 1, delay: 5} |
| 65 | skip_fail: true |
| 66 | |
| 67 | - description: Re-apply(as in doc) formulas for compute node |
| 68 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply |
| 69 | node_name: {{ HOSTNAME_CFG01 }} |
| 70 | retry: {count: 1, delay: 5} |
Oleksii Butenko | 9f2601c | 2018-02-08 15:13:21 +0200 | [diff] [blame] | 71 | skip_fail: false |
Tatyana Leontovich | 38be41b | 2017-04-12 14:45:23 +0300 | [diff] [blame] | 72 | |
| 73 | - description: Check IP on computes |
| 74 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run |
| 75 | 'ip a' |
| 76 | node_name: {{ HOSTNAME_CFG01 }} |
| 77 | retry: {count: 10, delay: 30} |
| 78 | skip_fail: false |
Oleksandr Ivashchenko | a95a72b | 2017-06-06 15:55:59 +0300 | [diff] [blame] | 79 | |
| 80 | |
| 81 | # Upload cirros image |
| 82 | |
| 83 | - description: Upload cirros image on ctl01 |
| 84 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
ibumarskov | 2cea0d4 | 2018-07-24 08:40:50 +0400 | [diff] [blame] | 85 | 'wget http://images.mirantis.com.s3.amazonaws.com/cirros-x64-20170828.qcow2' |
Oleksandr Ivashchenko | a95a72b | 2017-06-06 15:55:59 +0300 | [diff] [blame] | 86 | node_name: {{ HOSTNAME_CFG01 }} |
| 87 | retry: {count: 2, delay: 30} |
| 88 | skip_fail: false |
| 89 | |
| 90 | - description: Register image in glance |
| 91 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
ibumarskov | 2cea0d4 | 2018-07-24 08:40:50 +0400 | [diff] [blame] | 92 | '. /root/keystonercv3; glance --timeout 120 image-create --name cirros --visibility public --disk-format qcow2 --container-format bare --progress < /root/cirros-x64-20170828.qcow2' |
Oleksandr Ivashchenko | a95a72b | 2017-06-06 15:55:59 +0300 | [diff] [blame] | 93 | node_name: {{ HOSTNAME_CFG01 }} |
| 94 | retry: {count: 1, delay: 30} |
| 95 | skip_fail: false |
| 96 | |
| 97 | - description: Create net04_external |
| 98 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
Tatyana Leontovich | 674abf8 | 2017-07-20 15:44:15 +0300 | [diff] [blame] | 99 | '. /root/keystonercv3; neutron net-create net04_ext --router:external True --provider:physical_network physnet1 --provider:network_type flat' |
Oleksandr Ivashchenko | a95a72b | 2017-06-06 15:55:59 +0300 | [diff] [blame] | 100 | node_name: {{ HOSTNAME_CFG01 }} |
| 101 | retry: {count: 1, delay: 30} |
| 102 | skip_fail: false |
| 103 | |
| 104 | - description: Create subnet_external |
| 105 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 106 | '. /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' |
| 107 | node_name: {{ HOSTNAME_CFG01 }} |
| 108 | retry: {count: 1, delay: 30} |
| 109 | skip_fail: false |
| 110 | |
| 111 | - description: Create net04 |
| 112 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 113 | '. /root/keystonercv3; neutron net-create net04' |
| 114 | node_name: {{ HOSTNAME_CFG01 }} |
| 115 | retry: {count: 1, delay: 30} |
| 116 | skip_fail: false |
| 117 | |
| 118 | - description: Create subnet_net04 |
| 119 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 120 | '. /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' |
| 121 | node_name: {{ HOSTNAME_CFG01 }} |
| 122 | retry: {count: 1, delay: 30} |
| 123 | skip_fail: false |
| 124 | |
| 125 | - description: Create router |
| 126 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 127 | '. /root/keystonercv3; neutron router-create net04_router01' |
| 128 | node_name: {{ HOSTNAME_CFG01 }} |
| 129 | retry: {count: 1, delay: 30} |
| 130 | skip_fail: false |
| 131 | |
ibumarskov | c075df8 | 2018-07-30 13:23:07 +0400 | [diff] [blame] | 132 | - description: Set gateway |
Oleksandr Ivashchenko | a95a72b | 2017-06-06 15:55:59 +0300 | [diff] [blame] | 133 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 134 | '. /root/keystonercv3; neutron router-gateway-set net04_router01 net04_ext' |
| 135 | node_name: {{ HOSTNAME_CFG01 }} |
| 136 | retry: {count: 1, delay: 30} |
| 137 | skip_fail: false |
| 138 | |
| 139 | - description: Add interface |
| 140 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 141 | '. /root/keystonercv3; neutron router-interface-add net04_router01 net04__subnet' |
| 142 | node_name: {{ HOSTNAME_CFG01 }} |
| 143 | retry: {count: 1, delay: 30} |
| 144 | skip_fail: false |
| 145 | |
| 146 | - description: Allow all tcp |
| 147 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 148 | '. /root/keystonercv3; nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0' |
| 149 | node_name: {{ HOSTNAME_CFG01 }} |
| 150 | retry: {count: 1, delay: 30} |
| 151 | skip_fail: false |
| 152 | |
| 153 | - description: Allow all icmp |
| 154 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 155 | '. /root/keystonercv3; nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0' |
| 156 | node_name: {{ HOSTNAME_CFG01 }} |
| 157 | retry: {count: 1, delay: 30} |
| 158 | skip_fail: false |
| 159 | |
Tatyana Leontovich | fa31b39 | 2017-07-24 18:37:41 +0300 | [diff] [blame] | 160 | - description: sync time |
| 161 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run |
| 162 | 'service ntp stop; ntpd -gq; service ntp start' |
| 163 | node_name: {{ HOSTNAME_CFG01 }} |
| 164 | retry: {count: 1, delay: 30} |
| 165 | skip_fail: false |
| 166 | |
Tatyana Leontovich | fa31b39 | 2017-07-24 18:37:41 +0300 | [diff] [blame] | 167 | # Configure cinder-volume salt-call PROD-13167 |
Oleksandr Ivashchenko | a95a72b | 2017-06-06 15:55:59 +0300 | [diff] [blame] | 168 | - description: Set disks 01 |
| 169 | cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb' |
| 170 | node_name: {{ HOSTNAME_CTL01 }} |
| 171 | retry: {count: 1, delay: 30} |
| 172 | skip_fail: false |
| 173 | |
| 174 | - description: Set disks 02 |
| 175 | cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb' |
| 176 | node_name: {{ HOSTNAME_CTL02 }} |
| 177 | retry: {count: 1, delay: 30} |
| 178 | skip_fail: false |
| 179 | |
| 180 | - description: Set disks 03 |
| 181 | cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb' |
| 182 | node_name: {{ HOSTNAME_CTL03 }} |
| 183 | retry: {count: 1, delay: 30} |
| 184 | skip_fail: false |
| 185 | |
| 186 | - description: Create partitions 01 |
| 187 | cmd: salt-call cmd.run 'pvcreate /dev/vdb1' |
| 188 | node_name: {{ HOSTNAME_CTL01 }} |
| 189 | retry: {count: 1, delay: 30} |
| 190 | skip_fail: false |
| 191 | |
| 192 | - description: Create partitions 02 |
| 193 | cmd: salt-call cmd.run 'pvcreate /dev/vdb1' |
sgudz | 2e39339 | 2017-10-17 12:51:26 +0300 | [diff] [blame] | 194 | node_name: {{ HOSTNAME_CTL02 }} |
Oleksandr Ivashchenko | a95a72b | 2017-06-06 15:55:59 +0300 | [diff] [blame] | 195 | retry: {count: 1, delay: 30} |
| 196 | skip_fail: false |
| 197 | |
| 198 | - description: Create partitions 03 |
| 199 | cmd: salt-call cmd.run 'pvcreate /dev/vdb1' |
sgudz | 2e39339 | 2017-10-17 12:51:26 +0300 | [diff] [blame] | 200 | node_name: {{ HOSTNAME_CTL03 }} |
Oleksandr Ivashchenko | a95a72b | 2017-06-06 15:55:59 +0300 | [diff] [blame] | 201 | retry: {count: 1, delay: 30} |
Tatyana Leontovich | 7c97e80 | 2017-07-19 17:08:39 +0300 | [diff] [blame] | 202 | skip_fail: false |
| 203 | |
| 204 | - description: create volume_group |
| 205 | cmd: salt "ctl*" cmd.run 'vgcreate cinder-volumes /dev/vdb1' |
| 206 | node_name: {{ HOSTNAME_CFG01 }} |
| 207 | retry: {count: 1, delay: 30} |
| 208 | skip_fail: false |
| 209 | |
| 210 | - description: Install cinder-volume |
| 211 | cmd: salt 'ctl*' cmd.run 'apt-get install cinder-volume -y' |
| 212 | node_name: {{ HOSTNAME_CFG01 }} |
| 213 | retry: {count: 1, delay: 30} |
| 214 | skip_fail: false |
| 215 | |
| 216 | - description: Install crudini |
| 217 | cmd: salt "ctl*" cmd.run 'apt-get install crudini -y' |
| 218 | node_name: {{ HOSTNAME_CFG01 }} |
| 219 | retry: {count: 1, delay: 30} |
| 220 | skip_fail: false |
| 221 | |
| 222 | - description: Temporary WR set enabled backends value 01 |
| 223 | cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm' |
| 224 | node_name: {{ HOSTNAME_CTL01 }} |
| 225 | retry: {count: 1, delay: 30} |
| 226 | skip_fail: false |
| 227 | |
| 228 | - description: Temporary WR set enabled backends value 02 |
| 229 | cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm' |
| 230 | node_name: {{ HOSTNAME_CTL02 }} |
| 231 | retry: {count: 1, delay: 30} |
| 232 | skip_fail: false |
| 233 | |
| 234 | - description: Temporary WR set enabled backends value 03 |
| 235 | cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm' |
| 236 | node_name: {{ HOSTNAME_CTL03 }} |
| 237 | retry: {count: 1, delay: 30} |
| 238 | skip_fail: false |
| 239 | |
| 240 | - description: Install docker.io on gtw |
| 241 | cmd: salt-call cmd.run 'apt-get install docker.io -y' |
| 242 | node_name: {{ HOSTNAME_GTW01 }} |
| 243 | retry: {count: 1, delay: 30} |
| 244 | skip_fail: false |
| 245 | |
Tatyana Leontovich | d6bcbc9 | 2018-03-23 15:02:28 +0200 | [diff] [blame] | 246 | - description: Enable forward policy |
| 247 | cmd: iptables --policy FORWARD ACCEPT |
| 248 | node_name: {{ HOSTNAME_GTW01 }} |
| 249 | retry: {count: 1, delay: 30} |
| 250 | skip_fail: false |
| 251 | |
Tatyana Leontovich | 47f7bfe | 2018-01-05 13:36:09 +0200 | [diff] [blame] | 252 | - description: Restart cinder volume |
| 253 | cmd: | |
| 254 | salt -C 'I@cinder:controller' service.restart cinder-volume; |
| 255 | node_name: {{ HOSTNAME_CFG01 }} |
| 256 | retry: {count: 2, delay: 5} |
| 257 | skip_fail: false |
| 258 | |
Tatyana Leontovich | 7c97e80 | 2017-07-19 17:08:39 +0300 | [diff] [blame] | 259 | - description: create rc file on cfg |
| 260 | cmd: scp ctl01:/root/keystonercv3 /root |
| 261 | node_name: {{ HOSTNAME_CFG01 }} |
| 262 | retry: {count: 1, delay: 30} |
| 263 | skip_fail: false |
| 264 | |
| 265 | - description: Copy rc file |
| 266 | cmd: scp /root/keystonercv3 gtw01:/root |
| 267 | node_name: {{ HOSTNAME_CFG01 }} |
| 268 | retry: {count: 1, delay: 30} |
| 269 | skip_fail: false |