blob: 8804721206a6e7096f346fd8ce9c9e79c85d17b1 [file] [log] [blame]
Oleksii Butenko7d9671c2017-11-01 17:27:23 +02001{% 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 Butenko7c48def2017-10-03 12:41:05 +03007
Dennis Dmitriev0f272312018-10-01 13:29:40 +03008{% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.com/salt-models/mcp-virtual-lab') %}
Oleksii Butenko7c48def2017-10-03 12:41:05 +03009
Oleksii Butenko7d9671c2017-11-01 17:27:23 +020010{% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','cookied-bm-mcp-dvr-vxlan') %}
Oleksii Butenko7c48def2017-10-03 12:41:05 +030011
12{% import 'shared-salt.yaml' as SHARED with context %}
13
14{{ SHARED.MACRO_INSTALL_SALT_MASTER() }}
Oleksii Butenko336e4412018-05-21 14:59:27 +030015{{ SHARED.MACRO_CLONE_RECLASS_MODELS() }}
Oleksii Butenkoa2fa0612018-09-20 12:01:44 +030016{{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='\*') }}
Oleksii Butenko7c48def2017-10-03 12:41:05 +030017{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
Oleksii Butenko7c48def2017-10-03 12:41:05 +030018{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
Oleksii Butenko336e4412018-05-21 14:59:27 +030019{{ SHARED.MACRO_GENERATE_INVENTORY() }}
20{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
21
Tatyana Leontovichfa388892018-08-13 13:27:25 +030022- 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 Butenko336e4412018-05-21 14:59:27 +030028{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
29
Oleksii Butenko7c48def2017-10-03 12:41:05 +030030########################################
31# Spin up Control Plane VMs on KVM nodes
32########################################
33
Oleksii Butenko336e4412018-05-21 14:59:27 +030034- 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 Butenko7c48def2017-10-03 12:41:05 +030041- 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 Butenko336e4412018-05-21 14:59:27 +030047- 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 Butenko7c48def2017-10-03 12:41:05 +030057- 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 Leontovich4453dd62018-06-26 18:44:31 +030094
95{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
96
97{{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}}