sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 1 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| 2 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import LAB_CONFIG_NAME with context %} |
| 3 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import DOMAIN_NAME with context %} |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 4 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_KVM01 with context %} |
| 5 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_KVM02 with context %} |
| 6 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_KVM03 with context %} |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 7 | |
| 8 | {% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %} |
| 9 | # Other salt model repository parameters see in shared-salt.yaml |
| 10 | |
| 11 | # Name of the context file (without extension, that is fixed .yaml) used to render the Environment model |
| 12 | {% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','physical-cookied-bm-mcp-ocata-contrail') %} |
| 13 | # Path to the context files used to render Cluster and Environment models |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 14 | {%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-contrail-dpdk.yaml' %} |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 15 | {%- set ENVIRONMENT_CONTEXT_NAMES = ['salt-context-environment.yaml','lab04-physical-inventory.yaml'] %} |
| 16 | {%- set CONTROL_VLAN = os_env('CONTROL_VLAN', '2422') %} |
| 17 | {%- set TENANT_VLAN = os_env('TENANT_VLAN', '2423') %} |
| 18 | |
| 19 | |
| 20 | {% import 'shared-salt.yaml' as SHARED with context %} |
| 21 | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 22 | - description: (REMOVE asap) Hack KVMs of Hash sum mismatch |
| 23 | cmd: | |
| 24 | rm -rf /var/lib/apt/lists/*; |
| 25 | apt-get clean; |
| 26 | apt-get update; |
| 27 | node_name: {{ HOSTNAME_KVM01 }} |
| 28 | retry: {count: 1, delay: 5} |
| 29 | skip_fail: true |
| 30 | |
| 31 | - description: (REMOVE asap) Hack KVMs of Hash sum mismatch |
| 32 | cmd: | |
| 33 | rm -rf /var/lib/apt/lists/*; |
| 34 | apt-get clean; |
| 35 | apt-get update; |
| 36 | node_name: {{ HOSTNAME_KVM02 }} |
| 37 | retry: {count: 1, delay: 5} |
| 38 | skip_fail: true |
| 39 | |
| 40 | - description: (REMOVE asap) Hack KVMs of Hash sum mismatch |
| 41 | cmd: | |
| 42 | rm -rf /var/lib/apt/lists/*; |
| 43 | apt-get clean; |
| 44 | apt-get update; |
| 45 | node_name: {{ HOSTNAME_KVM03 }} |
| 46 | retry: {count: 1, delay: 5} |
| 47 | skip_fail: true |
| 48 | |
| 49 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 50 | {{ SHARED.MACRO_INSTALL_SALT_MASTER() }} |
| 51 | |
| 52 | {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }} |
| 53 | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 54 | - description: Temporary WR for cinder backend defined by default in reclass.system |
| 55 | cmd: | |
| 56 | sed -i 's/backend\:\ {}//g' /srv/salt/reclass/classes/system/cinder/control/cluster.yml; |
| 57 | node_name: {{ HOSTNAME_CFG01 }} |
| 58 | retry: {count: 1, delay: 5} |
| 59 | skip_fail: false |
| 60 | |
| 61 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 62 | {{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }} |
| 63 | |
Dennis Dmitriev | a5978eb | 2018-02-21 10:12:33 +0200 | [diff] [blame^] | 64 | {{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='"linux" "reclass" "salt" "openssh" "ntp" "git" "nginx" "collectd" "sensu" "heka" "sphinx" "keystone" "mysql" "grafana" "haproxy" "rsyslog" "horizon" "prometheus" "telegraf" "elasticsearch" "powerdns" "glusterfs" "xtrabackup" "maas" "backupninja" "jenkins" "fluentd"') }} |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 65 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 66 | {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| 67 | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 68 | - description: (REMOVE asap) Hack CFG of Hash sum mismatch |
| 69 | cmd: | |
| 70 | rm -rf /var/lib/apt/lists/*; |
| 71 | apt-get clean; |
| 72 | apt-get update; |
| 73 | node_name: {{ HOSTNAME_CFG01 }} |
| 74 | retry: {count: 1, delay: 5} |
| 75 | skip_fail: true |
| 76 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 77 | {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
| 78 | |
Dennis Dmitriev | 257a938 | 2018-02-15 04:00:46 +0200 | [diff] [blame] | 79 | {{ SHARED.ADJUST_SL_OPTS(OVERRIDES_FILENAME='/srv/salt/reclass/classes/environment/' + ENVIRONMENT_MODEL_INVENTORY_NAME + '/overrides.yml') }} |
| 80 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 81 | - description: "Workaround for rack01 compute generator" |
| 82 | cmd: | |
| 83 | set -e; |
| 84 | # Remove rack01 key |
Dennis Dmitriev | d96ace1 | 2018-01-26 14:46:21 +0200 | [diff] [blame] | 85 | . /root/venv-reclass-tools/bin/activate; |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 86 | reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 87 | # Add openstack_compute_node definition from system |
| 88 | reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge; |
| 89 | # Set ipaddresses |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 90 | # salt-call reclass.cluster_meta_set openstack_compute_node01_single_address 10.167.8.101 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
| 91 | # salt-call reclass.cluster_meta_set openstack_compute_node02_single_address 10.167.8.102 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 92 | # salt-call reclass.cluster_meta_set openstack_compute_node01_deploy_address 172.16.49.72 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
| 93 | # salt-call reclass.cluster_meta_set openstack_compute_node02_deploy_address 172.16.49.74 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
| 94 | |
| 95 | node_name: {{ HOSTNAME_CFG01 }} |
| 96 | retry: {count: 1, delay: 10} |
| 97 | skip_fail: false |
| 98 | |
| 99 | {{ SHARED.MACRO_GENERATE_INVENTORY() }} |
| 100 | |
| 101 | {{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }} |
| 102 | |
| 103 | |
| 104 | - description: "Workaround for PROD-14060" |
| 105 | cmd: | |
| 106 | set -e; |
| 107 | # Add tenant and single addresses for computes |
sgudz | b3f5fe4 | 2018-02-06 17:06:53 +0200 | [diff] [blame] | 108 | salt-call reclass.cluster_meta_set deploy_address 172.16.49.73 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 109 | salt-call reclass.cluster_meta_set tenant_address 192.168.0.101 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 110 | salt-call reclass.cluster_meta_set single_address 10.167.8.101 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 111 | |
| 112 | salt-call reclass.cluster_meta_set deploy_address 172.16.49.74 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml |
| 113 | salt-call reclass.cluster_meta_set tenant_address 192.168.0.102 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 114 | salt-call reclass.cluster_meta_set single_address 10.167.8.102 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 115 | |
| 116 | node_name: {{ HOSTNAME_CFG01 }} |
| 117 | retry: {count: 1, delay: 10} |
| 118 | skip_fail: false |
| 119 | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 120 | |
| 121 | - description: Temporary workaround for removing cinder-volume from CTL nodes |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 122 | cmd: | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 123 | sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| 124 | sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| 125 | node_name: {{ HOSTNAME_CFG01 }} |
| 126 | retry: {count: 1, delay: 5} |
| 127 | skip_fail: true |
| 128 | |
| 129 | - description: Temporary WR (Remove ASAP) for downgrade packages |
| 130 | cmd: | |
| 131 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' state.sls linux.system.repo; |
| 132 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get update" |
| 133 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get install -y --allow-downgrades vlan"; |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 134 | node_name: {{ HOSTNAME_CFG01 }} |
| 135 | retry: {count: 1, delay: 10} |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 136 | skip_fail: true |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 137 | |
| 138 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 139 | |
| 140 | ######################################## |
| 141 | # Spin up Control Plane VMs on KVM nodes |
| 142 | ######################################## |
| 143 | |
| 144 | - description: Execute 'libvirt' states to create necessary libvirt networks |
| 145 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt |
| 146 | node_name: {{ HOSTNAME_CFG01 }} |
| 147 | retry: {count: 2, delay: 10} |
| 148 | skip_fail: false |
| 149 | |
| 150 | - description: Create VMs for control plane |
| 151 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control |
| 152 | node_name: {{ HOSTNAME_CFG01 }} |
| 153 | retry: {count: 3, delay: 10} |
| 154 | skip_fail: false |
| 155 | |
| 156 | - description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)' |
| 157 | cmd: | |
| 158 | salt-key -l acc| sort > /tmp/current_keys.txt && |
| 159 | salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt |
| 160 | node_name: {{ HOSTNAME_CFG01 }} |
| 161 | retry: {count: 20, delay: 30} |
| 162 | skip_fail: false |
| 163 | |
| 164 | ######################################### |
| 165 | # Configure all running salt minion nodes |
| 166 | ######################################### |
| 167 | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 168 | - description: Hack resolv.conf on VCP nodes for internal services access |
| 169 | cmd: | |
| 170 | salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not kvm* and not cmp* and not gtw* and not cfg*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;" |
| 171 | salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not kvm* and not cmp* and not gtw* and not cfg*' cmd.run "echo 'nameserver 8.8.8.8' >> /etc/resolv.conf;" |
| 172 | node_name: {{ HOSTNAME_CFG01 }} |
| 173 | retry: {count: 1, delay: 5} |
| 174 | skip_fail: false |
| 175 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 176 | - description: Refresh pillars on all minions |
| 177 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 178 | node_name: {{ HOSTNAME_CFG01 }} |
| 179 | retry: {count: 1, delay: 5} |
| 180 | skip_fail: false |
| 181 | |
| 182 | - description: Sync all salt resources |
| 183 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| 184 | node_name: {{ HOSTNAME_CFG01 }} |
| 185 | retry: {count: 1, delay: 5} |
| 186 | skip_fail: false |
| 187 | |
| 188 | - description: Show reclass-salt --top for generated nodes |
| 189 | cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| 190 | node_name: {{ HOSTNAME_CFG01 }} |
| 191 | retry: {count: 1, delay: 5} |
| 192 | skip_fail: false |
| 193 | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 194 | - description: Temporary WR (Remove ASAP) for downgrade packages |
| 195 | cmd: | |
| 196 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' state.sls linux.system.repo; |
| 197 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get update" |
| 198 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get install -y --allow-downgrades vlan"; |
| 199 | node_name: {{ HOSTNAME_CFG01 }} |
| 200 | retry: {count: 1, delay: 10} |
| 201 | skip_fail: true |
| 202 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 203 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 204 | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 205 | - description: (REMOVE asap) Hack VCPs of Hash sum mismatch |
| 206 | cmd: | |
| 207 | salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not kvm* and not cmp* and not gtw* and not cfg*' cmd.run "rm -rf /var/lib/apt/lists/*; apt-get clean; apt-get update -y;" |
| 208 | node_name: {{ HOSTNAME_CFG01 }} |
| 209 | retry: {count: 1, delay: 5} |
| 210 | skip_fail: true |