Pavel Glazov | 6e9cbb9 | 2018-09-03 12:29:31 +0400 | [diff] [blame] | 1 | {% from 'cookied-mcp-newton-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| 2 | {% from 'cookied-mcp-newton-dvr/underlay.yaml' import HOSTNAME_CTL01 with context %} |
| 3 | {% from 'cookied-mcp-newton-dvr/underlay.yaml' import HOSTNAME_CTL02 with context %} |
| 4 | {% from 'cookied-mcp-newton-dvr/underlay.yaml' import HOSTNAME_CTL03 with context %} |
| 5 | {% from 'cookied-mcp-newton-dvr/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 | |
| 11 | {% import 'shared-openstack.yaml' as SHARED_OPENSTACK with context %} |
| 12 | |
| 13 | # 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 | # 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 | |
sgudz | 62df2fc | 2018-10-09 12:26:19 +0300 | [diff] [blame] | 43 | {{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE() }} |
Pavel Glazov | 6e9cbb9 | 2018-09-03 12:29:31 +0400 | [diff] [blame] | 44 | |
| 45 | {{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }} |
| 46 | |
| 47 | {{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }} |
| 48 | |
| 49 | {{ SHARED_OPENSTACK.MACRO_INSTALL_CINDER() }} |
| 50 | |
| 51 | {{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON() }} |
| 52 | |
| 53 | {{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }} |
| 54 | |
| 55 | # install designate backend |
| 56 | - description: Install powerdns |
| 57 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 58 | -C 'I@powerdns:server' state.sls powerdns.server |
| 59 | node_name: {{ HOSTNAME_CFG01 }} |
| 60 | retry: {count: 1, delay: 5} |
| 61 | skip_fail: false |
| 62 | |
| 63 | {{ SHARED_OPENSTACK.MACRO_INSTALL_DESIGNATE() }} |
| 64 | |
| 65 | {{ SHARED_OPENSTACK.MACRO_INSTALL_HORIZON() }} |
| 66 | |
| 67 | # 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} |
| 79 | skip_fail: false |
| 80 | |
| 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 |
| 87 | |
| 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 |
| 93 | 'wget http://images.mirantis.com.s3.amazonaws.com/cirros-x64-20170828.qcow2' |
| 94 | 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 |
| 100 | '. /root/keystonercv3; glance --timeout 120 image-create --name cirros --visibility public --disk-format qcow2 --container-format bare --progress < /root/cirros-x64-20170828.qcow2' |
| 101 | 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 |
| 107 | '. /root/keystonercv3; neutron net-create net04_ext --router:external True --provider:physical_network physnet1 --provider:network_type flat' |
| 108 | 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 | |
| 140 | - description: Set gateway |
| 141 | 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 | |
| 168 | - 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 | |
Pavel Glazov | 6e9cbb9 | 2018-09-03 12:29:31 +0400 | [diff] [blame] | 175 | - description: Install docker.io on gtw |
| 176 | cmd: salt-call cmd.run 'apt-get install docker.io -y' |
| 177 | node_name: {{ HOSTNAME_GTW01 }} |
| 178 | retry: {count: 1, delay: 30} |
| 179 | skip_fail: false |
| 180 | |
| 181 | - description: Enable forward policy |
| 182 | cmd: iptables --policy FORWARD ACCEPT |
| 183 | node_name: {{ HOSTNAME_GTW01 }} |
| 184 | retry: {count: 1, delay: 30} |
| 185 | skip_fail: false |
| 186 | |
Pavel Glazov | 6e9cbb9 | 2018-09-03 12:29:31 +0400 | [diff] [blame] | 187 | - description: create rc file on cfg |
| 188 | cmd: scp ctl01:/root/keystonercv3 /root |
| 189 | node_name: {{ HOSTNAME_CFG01 }} |
| 190 | retry: {count: 1, delay: 30} |
| 191 | skip_fail: false |
| 192 | |
| 193 | - description: Copy rc file |
| 194 | cmd: scp /root/keystonercv3 gtw01:/root |
| 195 | node_name: {{ HOSTNAME_CFG01 }} |
| 196 | retry: {count: 1, delay: 30} |
| 197 | skip_fail: false |
Pavel Glazov | d0349c8 | 2018-10-18 14:23:13 +0400 | [diff] [blame] | 198 | |
| 199 | - description: WORKAROUND PROD-23354 |
| 200 | cmd: sed -n 's/max_microversion = 2.42/max_microversion = 2.38/;w /var/log/lvm_mcp_newton.conf' /var/log/lvm_mcp.conf |
| 201 | node_name: {{ HOSTNAME_GTW01 }} |
| 202 | retry: {count: 1, delay: 30} |
| 203 | skip_fail: false |