blob: dea085e7c5c0049e1b445cb2109425b2cabd2d3d [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
8{% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/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() }}
15
Oleksii Butenko336e4412018-05-21 14:59:27 +030016{{ SHARED.MACRO_CLONE_RECLASS_MODELS() }}
Oleksii Butenko7c48def2017-10-03 12:41:05 +030017
Oleksii Butenkoa2fa0612018-09-20 12:01:44 +030018{{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='\*') }}
Oleksii Butenko7c48def2017-10-03 12:41:05 +030019{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
20
21{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
22
Oleksii Butenko44afc962018-08-16 13:18:51 +030023- description: "WR for changing VCP images path to internal storage"
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030024 cmd: |
25 set -e;
Oleksii Butenko336e4412018-05-21 14:59:27 +030026 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 Butenko44afc962018-08-16 13:18:51 +030030 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 Dmitriev8c49ddc2017-10-21 14:31:50 +030031 node_name: {{ HOSTNAME_CFG01 }}
Oleksii Butenko336e4412018-05-21 14:59:27 +030032 retry: {count: 1, delay: 10}
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030033 skip_fail: false
Oleksii Butenko7c48def2017-10-03 12:41:05 +030034
Tatyana Leontovichfa388892018-08-13 13:27:25 +030035
Oleksii Butenko336e4412018-05-21 14:59:27 +030036{{ SHARED.MACRO_GENERATE_INVENTORY() }}
37{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
38
Oleksii Butenko9f2cf512017-12-19 14:03:41 +020039- 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 Leontovichfa388892018-08-13 13:27:25 +030047- 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 Butenko336e4412018-05-21 14:59:27 +030062{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
63
Oleksii Butenko7c48def2017-10-03 12:41:05 +030064########################################
65# Spin up Control Plane VMs on KVM nodes
66########################################
67
Oleksii Butenko336e4412018-05-21 14:59:27 +030068- 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 Butenko7c48def2017-10-03 12:41:05 +030075- 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 Butenko336e4412018-05-21 14:59:27 +030081- 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 Butenko7c48def2017-10-03 12:41:05 +030091- 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 Leontovich4453dd62018-06-26 18:44:31 +0300128
129{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
130
131{{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}}
Oleksii Butenko336e4412018-05-21 14:59:27 +0300132