Oleksii Butenko | 7d9671c | 2017-11-01 17:27:23 +0200 | [diff] [blame] | 1 | {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| 2 | {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import LAB_CONFIG_NAME with context %} |
| 3 | {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import DOMAIN_NAME with context %} |
| 4 | {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import HOSTNAME_KVM01 with context %} |
| 5 | {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import HOSTNAME_KVM02 with context %} |
| 6 | {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import HOSTNAME_KVM03 with context %} |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 7 | |
| 8 | {% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %} |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 9 | |
Oleksii Butenko | 7d9671c | 2017-11-01 17:27:23 +0200 | [diff] [blame] | 10 | {% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','cookied-bm-mcp-dvr-vxlan') %} |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 11 | |
| 12 | {% import 'shared-salt.yaml' as SHARED with context %} |
| 13 | |
| 14 | {{ SHARED.MACRO_INSTALL_SALT_MASTER() }} |
| 15 | |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 16 | {{ SHARED.MACRO_CLONE_RECLASS_MODELS() }} |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 17 | |
Oleksii Butenko | a2fa061 | 2018-09-20 12:01:44 +0300 | [diff] [blame] | 18 | {{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='\*') }} |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 19 | {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| 20 | |
| 21 | {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
| 22 | |
Oleksii Butenko | 44afc96 | 2018-08-16 13:18:51 +0300 | [diff] [blame] | 23 | - description: "WR for changing VCP images path to internal storage" |
Dennis Dmitriev | 8c49ddc | 2017-10-21 14:31:50 +0300 | [diff] [blame] | 24 | cmd: | |
| 25 | set -e; |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 26 | apt-get -y install python-virtualenv python-pip build-essential python-dev libssl-dev; |
| 27 | [[ -d /root/venv-reclass-tools ]] || virtualenv /root/venv-reclass-tools; |
| 28 | . /root/venv-reclass-tools/bin/activate; |
| 29 | pip install git+https://github.com/dis-xcom/reclass-tools; |
Oleksii Butenko | 44afc96 | 2018-08-16 13:18:51 +0300 | [diff] [blame] | 30 | reclass-tools add-key parameters._param.salt_control_xenial_image 'https://apt.mcp.mirantis.net/images/ubuntu-16-04-x64-mcp{{ SHARED.REPOSITORY_SUITE }}.qcow2' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
Dennis Dmitriev | 8c49ddc | 2017-10-21 14:31:50 +0300 | [diff] [blame] | 31 | node_name: {{ HOSTNAME_CFG01 }} |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 32 | retry: {count: 1, delay: 10} |
Dennis Dmitriev | 8c49ddc | 2017-10-21 14:31:50 +0300 | [diff] [blame] | 33 | skip_fail: false |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 34 | |
Tatyana Leontovich | fa38889 | 2018-08-13 13:27:25 +0300 | [diff] [blame] | 35 | |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 36 | {{ SHARED.MACRO_GENERATE_INVENTORY() }} |
| 37 | {{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }} |
| 38 | |
Oleksii Butenko | 9f2cf51 | 2017-12-19 14:03:41 +0200 | [diff] [blame] | 39 | - description: Temporary workaround for removing cinder-volume from CTL nodes |
| 40 | cmd: | |
| 41 | sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| 42 | sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| 43 | node_name: {{ HOSTNAME_CFG01 }} |
| 44 | retry: {count: 1, delay: 5} |
| 45 | skip_fail: true |
| 46 | |
Tatyana Leontovich | fa38889 | 2018-08-13 13:27:25 +0300 | [diff] [blame] | 47 | - description: Temporary workaround for removing virtual gtw nodes |
| 48 | cmd: | |
| 49 | sed -i 's/\-\ system\.salt\.control\.sizes\.ovs\.compact//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 50 | sed -i 's/\-\ system\.salt\.control\.placement\.ovs\.compact//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 51 | node_name: {{ HOSTNAME_CFG01 }} |
| 52 | retry: {count: 1, delay: 5} |
| 53 | skip_fail: true |
| 54 | |
| 55 | - description: Rerun openssh after env model is generated |
| 56 | cmd: | |
| 57 | salt-call state.sls openssh |
| 58 | node_name: {{ HOSTNAME_CFG01 }} |
| 59 | retry: {count: 1, delay: 10} |
| 60 | skip_fail: false |
| 61 | |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 62 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 63 | |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 64 | ######################################## |
| 65 | # Spin up Control Plane VMs on KVM nodes |
| 66 | ######################################## |
| 67 | |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 68 | - description: Hack resolv.conf on nodes for internal services access |
| 69 | cmd: | |
| 70 | salt --hard-crash --state-output=mixed --state-verbose=False -C '*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;" |
| 71 | node_name: {{ HOSTNAME_CFG01 }} |
| 72 | retry: {count: 1, delay: 5} |
| 73 | skip_fail: false |
| 74 | |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 75 | - description: Execute 'libvirt' states to create necessary libvirt networks |
| 76 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt |
| 77 | node_name: {{ HOSTNAME_CFG01 }} |
| 78 | retry: {count: 2, delay: 10} |
| 79 | skip_fail: false |
| 80 | |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 81 | - description: Temporary WR for correct bridge name according to envoronment templates |
| 82 | cmd: | |
| 83 | sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 84 | sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 85 | sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml; |
| 86 | salt '*' saltutil.refresh_pillar; |
| 87 | node_name: {{ HOSTNAME_CFG01 }} |
| 88 | retry: {count: 1, delay: 10} |
| 89 | skip_fail: false |
| 90 | |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 91 | - description: Create VMs for control plane |
| 92 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control |
| 93 | node_name: {{ HOSTNAME_CFG01 }} |
| 94 | retry: {count: 3, delay: 10} |
| 95 | skip_fail: false |
| 96 | |
| 97 | - description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)' |
| 98 | cmd: | |
| 99 | salt-key -l acc| sort > /tmp/current_keys.txt && |
| 100 | salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt |
| 101 | node_name: {{ HOSTNAME_CFG01 }} |
| 102 | retry: {count: 20, delay: 30} |
| 103 | skip_fail: false |
| 104 | |
| 105 | ######################################### |
| 106 | # Configure all running salt minion nodes |
| 107 | ######################################### |
| 108 | |
| 109 | - description: Refresh pillars on all minions |
| 110 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 111 | node_name: {{ HOSTNAME_CFG01 }} |
| 112 | retry: {count: 1, delay: 5} |
| 113 | skip_fail: false |
| 114 | |
| 115 | - description: Sync all salt resources |
| 116 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| 117 | node_name: {{ HOSTNAME_CFG01 }} |
| 118 | retry: {count: 1, delay: 5} |
| 119 | skip_fail: false |
| 120 | |
| 121 | - description: Show reclass-salt --top for generated nodes |
| 122 | cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| 123 | node_name: {{ HOSTNAME_CFG01 }} |
| 124 | retry: {count: 1, delay: 5} |
| 125 | skip_fail: false |
| 126 | |
| 127 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
Tatyana Leontovich | 4453dd6 | 2018-06-26 18:44:31 +0300 | [diff] [blame] | 128 | |
| 129 | {{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}} |
| 130 | |
| 131 | {{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}} |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 132 | |