Pavel Glazov | ca1de37 | 2018-08-21 15:38:00 +0400 | [diff] [blame] | 1 | {% from 'cookied-mcp-newton-ovs/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| 2 | {% from 'cookied-mcp-newton-ovs/underlay.yaml' import HOSTNAME_CTL01 with context %} |
| 3 | {% from 'cookied-mcp-newton-ovs/underlay.yaml' import HOSTNAME_CTL02 with context %} |
| 4 | {% from 'cookied-mcp-newton-ovs/underlay.yaml' import HOSTNAME_CTL03 with context %} |
| 5 | {% from 'cookied-mcp-newton-ovs/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 | |
| 9 | {% import 'shared-openstack.yaml' as SHARED_OPENSTACK with context %} |
| 10 | |
| 11 | # Deploy nginx before openstack services (PROD-22740) |
| 12 | - description: Deploy nginx proxy |
| 13 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 14 | -C 'I@nginx:server' state.sls nginx |
| 15 | node_name: {{ HOSTNAME_CFG01 }} |
| 16 | retry: {count: 1, delay: 5} |
| 17 | skip_fail: true |
| 18 | |
| 19 | {{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE(USE_ORCHESTRATE=false) }} |
| 20 | |
| 21 | {{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }} |
| 22 | |
| 23 | {{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }} |
| 24 | |
| 25 | {{ SHARED_OPENSTACK.MACRO_INSTALL_CINDER() }} |
| 26 | |
| 27 | # {{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON() }} |
| 28 | |
| 29 | - description: Install neutron service on primary node |
| 30 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 31 | -C "I@neutron:server and *01*" state.sls neutron.server |
| 32 | node_name: {{ HOSTNAME_CFG01 }} |
| 33 | retry: {count: 1, delay: 5} |
| 34 | skip_fail: false |
| 35 | |
| 36 | - description: Install neutron service on other nodes |
| 37 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 38 | -C "I@neutron:server" state.sls neutron.server |
| 39 | node_name: {{ HOSTNAME_CFG01 }} |
| 40 | retry: {count: 1, delay: 5} |
| 41 | skip_fail: false |
| 42 | |
| 43 | - description: Install neutron on gtw node |
| 44 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 45 | -C 'I@neutron:gateway' state.sls neutron |
| 46 | node_name: {{ HOSTNAME_CFG01 }} |
| 47 | retry: {count: 1, delay: 5} |
| 48 | skip_fail: false |
| 49 | |
| 50 | # WORKAROUND PROD-20976 |
| 51 | - description: WORKAROUND PROD-20976 |
| 52 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 53 | -C 'I@neutron:server or I@neutron:gateway' cmd.run "sed -i |
| 54 | 's/#min_l3_agents_per_router = 2/min_l3_agents_per_router = 1/' |
| 55 | /etc/neutron/neutron.conf" |
| 56 | node_name: {{ HOSTNAME_CFG01 }} |
| 57 | retry: {count: 1, delay: 5} |
| 58 | skip_fail: false |
| 59 | |
| 60 | - description: Restart Neutron services |
| 61 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 62 | -C 'I@neutron:server or I@neutron:gateway' cmd.run 'systemctl restart |
| 63 | neutron*' |
| 64 | node_name: {{ HOSTNAME_CFG01 }} |
| 65 | retry: {count: 1, delay: 5} |
| 66 | skip_fail: false |
| 67 | |
| 68 | - description: Check neutron agent-list |
| 69 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 70 | -C 'I@keystone:server' cmd.run '. /root/keystonerc; neutron agent-list' |
| 71 | node_name: {{ HOSTNAME_CFG01 }} |
| 72 | retry: {count: 3, delay: 20} |
| 73 | skip_fail: false |
| 74 | |
| 75 | {{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }} |
| 76 | |
| 77 | # install designate backend |
| 78 | - description: Install bind |
| 79 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 80 | -C 'I@bind:server' state.sls bind |
| 81 | node_name: {{ HOSTNAME_CFG01 }} |
| 82 | retry: {count: 1, delay: 5} |
| 83 | skip_fail: false |
| 84 | |
| 85 | {{ SHARED_OPENSTACK.MACRO_INSTALL_DESIGNATE() }} |
| 86 | |
| 87 | {{ SHARED_OPENSTACK.MACRO_INSTALL_HORIZON() }} |
| 88 | |
| 89 | # Install compute node |
| 90 | |
| 91 | - description: Apply 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: true |
| 96 | |
| 97 | - description: Re-apply(as in doc) formulas for compute node |
| 98 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply |
| 99 | node_name: {{ HOSTNAME_CFG01 }} |
| 100 | retry: {count: 1, delay: 5} |
| 101 | skip_fail: false |
| 102 | |
| 103 | - description: Check IP on computes |
| 104 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run |
| 105 | 'ip a' |
| 106 | node_name: {{ HOSTNAME_CFG01 }} |
| 107 | retry: {count: 10, delay: 30} |
| 108 | skip_fail: false |
| 109 | |
| 110 | |
| 111 | # Upload cirros image |
| 112 | |
| 113 | - description: Upload cirros image on ctl01 |
| 114 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 115 | 'wget http://images.mirantis.com.s3.amazonaws.com/cirros-x64-20170828.qcow2' |
| 116 | node_name: {{ HOSTNAME_CFG01 }} |
| 117 | retry: {count: 2, delay: 30} |
| 118 | skip_fail: false |
| 119 | |
| 120 | - description: Register image in glance |
| 121 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 122 | '. /root/keystonercv3; glance --timeout 120 image-create --name cirros --visibility public --disk-format qcow2 --container-format bare --progress < /root/cirros-x64-20170828.qcow2' |
| 123 | node_name: {{ HOSTNAME_CFG01 }} |
| 124 | retry: {count: 1, delay: 30} |
| 125 | skip_fail: false |
| 126 | |
| 127 | - description: Create net04_external |
| 128 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 129 | '. /root/keystonercv3; neutron net-create net04_ext --router:external True --provider:physical_network physnet1 --provider:network_type flat' |
| 130 | node_name: {{ HOSTNAME_CFG01 }} |
| 131 | retry: {count: 1, delay: 30} |
| 132 | skip_fail: false |
| 133 | |
| 134 | - description: Create subnet_external |
| 135 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 136 | '. /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' |
| 137 | node_name: {{ HOSTNAME_CFG01 }} |
| 138 | retry: {count: 1, delay: 30} |
| 139 | skip_fail: false |
| 140 | |
| 141 | - description: Create net04 |
| 142 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 143 | '. /root/keystonercv3; neutron net-create net04' |
| 144 | node_name: {{ HOSTNAME_CFG01 }} |
| 145 | retry: {count: 1, delay: 30} |
| 146 | skip_fail: false |
| 147 | |
| 148 | - description: Create subnet_net04 |
| 149 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 150 | '. /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' |
| 151 | node_name: {{ HOSTNAME_CFG01 }} |
| 152 | retry: {count: 1, delay: 30} |
| 153 | skip_fail: false |
| 154 | |
| 155 | - description: Create router |
| 156 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 157 | '. /root/keystonercv3; neutron router-create net04_router01' |
| 158 | node_name: {{ HOSTNAME_CFG01 }} |
| 159 | retry: {count: 1, delay: 30} |
| 160 | skip_fail: false |
| 161 | |
| 162 | - description: Set gateway |
| 163 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 164 | '. /root/keystonercv3; neutron router-gateway-set net04_router01 net04_ext' |
| 165 | node_name: {{ HOSTNAME_CFG01 }} |
| 166 | retry: {count: 1, delay: 30} |
| 167 | skip_fail: false |
| 168 | |
| 169 | - description: Add interface |
| 170 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 171 | '. /root/keystonercv3; neutron router-interface-add net04_router01 net04__subnet' |
| 172 | node_name: {{ HOSTNAME_CFG01 }} |
| 173 | retry: {count: 1, delay: 30} |
| 174 | skip_fail: false |
| 175 | |
| 176 | - description: Allow all tcp |
| 177 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 178 | '. /root/keystonercv3; nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0' |
| 179 | node_name: {{ HOSTNAME_CFG01 }} |
| 180 | retry: {count: 1, delay: 30} |
| 181 | skip_fail: false |
| 182 | |
| 183 | - description: Allow all icmp |
| 184 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 185 | '. /root/keystonercv3; nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0' |
| 186 | node_name: {{ HOSTNAME_CFG01 }} |
| 187 | retry: {count: 1, delay: 30} |
| 188 | skip_fail: false |
| 189 | |
| 190 | - description: sync time |
| 191 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run |
| 192 | 'service ntp stop; ntpd -gq; service ntp start' |
| 193 | node_name: {{ HOSTNAME_CFG01 }} |
| 194 | retry: {count: 1, delay: 30} |
| 195 | skip_fail: false |
| 196 | |
| 197 | # Configure cinder-volume salt-call |
| 198 | - description: Set disks 01 |
| 199 | cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb' |
| 200 | node_name: {{ HOSTNAME_CTL01 }} |
| 201 | retry: {count: 1, delay: 30} |
| 202 | skip_fail: false |
| 203 | |
| 204 | - description: Set disks 02 |
| 205 | cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb' |
| 206 | node_name: {{ HOSTNAME_CTL02 }} |
| 207 | retry: {count: 1, delay: 30} |
| 208 | skip_fail: false |
| 209 | |
| 210 | - description: Set disks 03 |
| 211 | cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb' |
| 212 | node_name: {{ HOSTNAME_CTL03 }} |
| 213 | retry: {count: 1, delay: 30} |
| 214 | skip_fail: false |
| 215 | |
| 216 | - description: Create partitions 01 |
| 217 | cmd: salt-call cmd.run 'pvcreate /dev/vdb1' |
| 218 | node_name: {{ HOSTNAME_CTL01 }} |
| 219 | retry: {count: 1, delay: 30} |
| 220 | skip_fail: false |
| 221 | |
| 222 | - description: Create partitions 02 |
| 223 | cmd: salt-call cmd.run 'pvcreate /dev/vdb1' |
| 224 | node_name: {{ HOSTNAME_CTL02 }} |
| 225 | retry: {count: 1, delay: 30} |
| 226 | skip_fail: false |
| 227 | |
| 228 | - description: Create partitions 03 |
| 229 | cmd: salt-call cmd.run 'pvcreate /dev/vdb1' |
| 230 | node_name: {{ HOSTNAME_CTL03 }} |
| 231 | retry: {count: 1, delay: 30} |
| 232 | skip_fail: false |
| 233 | |
| 234 | - description: create volume_group |
| 235 | cmd: salt "ctl*" cmd.run 'vgcreate cinder-volumes /dev/vdb1' |
| 236 | node_name: {{ HOSTNAME_CFG01 }} |
| 237 | retry: {count: 1, delay: 30} |
| 238 | skip_fail: false |
| 239 | |
| 240 | - description: Install cinder-volume |
| 241 | cmd: salt 'ctl*' cmd.run 'apt-get install cinder-volume -y' |
| 242 | node_name: {{ HOSTNAME_CFG01 }} |
| 243 | retry: {count: 1, delay: 30} |
| 244 | skip_fail: false |
| 245 | |
| 246 | - description: Install crudini |
| 247 | cmd: salt "ctl*" cmd.run 'apt-get install crudini -y' |
| 248 | node_name: {{ HOSTNAME_CFG01 }} |
| 249 | retry: {count: 1, delay: 30} |
| 250 | skip_fail: false |
| 251 | |
| 252 | - description: Temporary WR set enabled backends value 01 |
| 253 | cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm' |
| 254 | node_name: {{ HOSTNAME_CTL01 }} |
| 255 | retry: {count: 1, delay: 30} |
| 256 | skip_fail: false |
| 257 | |
| 258 | - description: Temporary WR set enabled backends value 02 |
| 259 | cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm' |
| 260 | node_name: {{ HOSTNAME_CTL02 }} |
| 261 | retry: {count: 1, delay: 30} |
| 262 | skip_fail: false |
| 263 | |
| 264 | - description: Temporary WR set enabled backends value 03 |
| 265 | cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm' |
| 266 | node_name: {{ HOSTNAME_CTL03 }} |
| 267 | retry: {count: 1, delay: 30} |
| 268 | skip_fail: false |
| 269 | |
| 270 | - description: Restart cinder volume |
| 271 | cmd: | |
| 272 | salt -C 'I@cinder:controller' service.restart cinder-volume; |
| 273 | node_name: {{ HOSTNAME_CFG01 }} |
| 274 | retry: {count: 2, delay: 5} |
| 275 | skip_fail: false |
| 276 | |
| 277 | - description: Install docker.io on gtw |
| 278 | cmd: salt-call cmd.run 'apt-get install docker.io -y' |
| 279 | node_name: {{ HOSTNAME_GTW01 }} |
| 280 | retry: {count: 1, delay: 30} |
| 281 | skip_fail: false |
| 282 | |
| 283 | - description: Enable forward policy |
| 284 | cmd: iptables --policy FORWARD ACCEPT |
| 285 | node_name: {{ HOSTNAME_GTW01 }} |
| 286 | retry: {count: 1, delay: 30} |
| 287 | skip_fail: false |
| 288 | |
| 289 | - description: create rc file on cfg |
| 290 | cmd: scp ctl01:/root/keystonercv3 /root |
| 291 | node_name: {{ HOSTNAME_CFG01 }} |
| 292 | retry: {count: 1, delay: 30} |
| 293 | skip_fail: false |
| 294 | |
| 295 | - description: Copy rc file |
| 296 | cmd: scp /root/keystonercv3 gtw01:/root |
| 297 | node_name: {{ HOSTNAME_CFG01 }} |
| 298 | retry: {count: 1, delay: 30} |
| 299 | skip_fail: false |