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 | |
Dennis Dmitriev | 0f27231 | 2018-10-01 13:29:40 +0300 | [diff] [blame] | 8 | {% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.com/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() }} |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 15 | {{ SHARED.MACRO_CLONE_RECLASS_MODELS() }} |
Oleksii Butenko | a2fa061 | 2018-09-20 12:01:44 +0300 | [diff] [blame] | 16 | {{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='\*') }} |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 17 | {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 18 | {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 19 | {{ SHARED.MACRO_GENERATE_INVENTORY() }} |
| 20 | {{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }} |
| 21 | |
Tatyana Leontovich | fa38889 | 2018-08-13 13:27:25 +0300 | [diff] [blame] | 22 | - description: Rerun openssh after env model is generated |
| 23 | cmd: | |
| 24 | salt-call state.sls openssh |
| 25 | node_name: {{ HOSTNAME_CFG01 }} |
| 26 | retry: {count: 1, delay: 10} |
| 27 | skip_fail: false |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 28 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 29 | |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 30 | ######################################## |
| 31 | # Spin up Control Plane VMs on KVM nodes |
| 32 | ######################################## |
| 33 | |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 34 | - description: Hack resolv.conf on nodes for internal services access |
| 35 | cmd: | |
| 36 | salt --hard-crash --state-output=mixed --state-verbose=False -C '*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;" |
| 37 | node_name: {{ HOSTNAME_CFG01 }} |
| 38 | retry: {count: 1, delay: 5} |
| 39 | skip_fail: false |
| 40 | |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 41 | - description: Execute 'libvirt' states to create necessary libvirt networks |
| 42 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt |
| 43 | node_name: {{ HOSTNAME_CFG01 }} |
| 44 | retry: {count: 2, delay: 10} |
| 45 | skip_fail: false |
| 46 | |
Oleksii Butenko | 336e441 | 2018-05-21 14:59:27 +0300 | [diff] [blame] | 47 | - description: Temporary WR for correct bridge name according to envoronment templates |
| 48 | cmd: | |
| 49 | sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 50 | sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 51 | sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml; |
| 52 | salt '*' saltutil.refresh_pillar; |
| 53 | node_name: {{ HOSTNAME_CFG01 }} |
| 54 | retry: {count: 1, delay: 10} |
| 55 | skip_fail: false |
| 56 | |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 57 | - description: Create VMs for control plane |
| 58 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control |
| 59 | node_name: {{ HOSTNAME_CFG01 }} |
| 60 | retry: {count: 3, delay: 10} |
| 61 | skip_fail: false |
| 62 | |
| 63 | - description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)' |
| 64 | cmd: | |
| 65 | salt-key -l acc| sort > /tmp/current_keys.txt && |
| 66 | salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt |
| 67 | node_name: {{ HOSTNAME_CFG01 }} |
| 68 | retry: {count: 20, delay: 30} |
| 69 | skip_fail: false |
| 70 | |
| 71 | ######################################### |
| 72 | # Configure all running salt minion nodes |
| 73 | ######################################### |
| 74 | |
| 75 | - description: Refresh pillars on all minions |
| 76 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 77 | node_name: {{ HOSTNAME_CFG01 }} |
| 78 | retry: {count: 1, delay: 5} |
| 79 | skip_fail: false |
| 80 | |
| 81 | - description: Sync all salt resources |
| 82 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| 83 | node_name: {{ HOSTNAME_CFG01 }} |
| 84 | retry: {count: 1, delay: 5} |
| 85 | skip_fail: false |
| 86 | |
| 87 | - description: Show reclass-salt --top for generated nodes |
| 88 | cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| 89 | node_name: {{ HOSTNAME_CFG01 }} |
| 90 | retry: {count: 1, delay: 5} |
| 91 | skip_fail: false |
| 92 | |
| 93 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
Tatyana Leontovich | 4453dd6 | 2018-06-26 18:44:31 +0300 | [diff] [blame] | 94 | |
| 95 | {{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}} |
| 96 | |
| 97 | {{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}} |