blob: ce9318e77fbd89833ed055dd2db905ed694a526a [file] [log] [blame]
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +02001{% from 'cookied-bm-mcp-ovs-dpdk/underlay.yaml' import HOSTNAME_CFG01 with context %}
2{% from 'cookied-bm-mcp-ovs-dpdk/underlay.yaml' import HOSTNAME_CMP01 with context %}
3{% from 'cookied-bm-mcp-ovs-dpdk/underlay.yaml' import HOSTNAME_CMP02 with context %}
4{% from 'cookied-bm-mcp-ovs-dpdk/underlay.yaml' import HOSTNAME_GTW01 with context %}
5{% from 'cookied-bm-mcp-ovs-dpdk/underlay.yaml' import LAB_CONFIG_NAME with context %}
6{% from 'cookied-bm-mcp-ovs-dpdk/underlay.yaml' import DOMAIN_NAME with context %}
7
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-baremetal-lab') %}
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +02009# Other salt model repository parameters see in shared-salt.yaml
10
11{% import 'shared-salt.yaml' as SHARED with context %}
12
13{{ SHARED.MACRO_INSTALL_SALT_MASTER() }}
14
15{{ SHARED.MACRO_CLONE_RECLASS_MODELS() }}
16
Dennis Dmitrievd96773d2018-08-13 13:35:31 +030017- description: "Workaround for PROD-22201 (remove after switching to reclass 1.5.x) - Remove linux.network.interface object from the system models and use fixed 'environment' model instead"
18 cmd: |
19 set -e;
20 apt-get -y install python-virtualenv python-pip build-essential python-dev libssl-dev;
21 [[ -d /root/venv-reclass-tools ]] || virtualenv /root/venv-reclass-tools;
22 . /root/venv-reclass-tools/bin/activate;
23 pip install git+https://github.com/dis-xcom/reclass-tools;
24 reclass-tools del-key parameters.linux.network.interface /srv/salt/reclass/classes/system/;
25
26 node_name: {{ HOSTNAME_CFG01 }}
27 retry: {count: 1, delay: 5}
28 skip_fail: false
29
Oleksii Butenkoa2fa0612018-09-20 12:01:44 +030030{{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='\*') }}
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020031{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
32
33{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
34
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020035{{ SHARED.MACRO_GENERATE_INVENTORY() }}
36{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020037 node_name: {{ HOSTNAME_CFG01 }}
38 retry: {count: 1, delay: 10}
39 skip_fail: false
40
41- description: Temporary workaround for removing cinder-volume from CTL nodes
42 cmd: |
43 sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
44 sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
45 node_name: {{ HOSTNAME_CFG01 }}
46 retry: {count: 1, delay: 5}
47 skip_fail: true
48
Tatyana Leontovichfa388892018-08-13 13:27:25 +030049
50- description: Temporary workaround for removing virtual gtw nodes
51 cmd: |
52 sed -i 's/\-\ system\.salt\.control\.sizes\.ovs\.compact//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
53 sed -i 's/\-\ system\.salt\.control\.placement\.ovs\.compact//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
54 node_name: {{ HOSTNAME_CFG01 }}
55 retry: {count: 1, delay: 5}
56 skip_fail: true
57
58
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020059- description: WR for mounting 1G hugepages before linux.state
60 cmd: |
61 salt 'cmp*' state.sls linux.system.hugepages;
62 salt 'cmp*' cmd.run "mount -o mode=775,pagesize=1G -t hugetlbfs Hugetlbfs-kvm /mnt/hugepages_1G";
63 salt 'cmp*' cmd.run "echo 16 | sudo tee /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages";
64 node_name: {{ HOSTNAME_CFG01 }}
65 retry: {count: 1, delay: 10}
66 skip_fail: false
67
Oleksii Butenkof65a0042018-06-27 13:38:43 +030068- description: WR for correct acces to git repo from jenkins on cfg01 node
Oleksii Butenko1e8d5f72018-05-24 16:24:25 +030069 cmd: |
Oleksii Butenkof65a0042018-06-27 13:38:43 +030070 git clone --mirror https://github.com/Mirantis/mk-pipelines.git /home/repo/mk/mk-pipelines/;
71 git clone --mirror https://github.com/Mirantis/pipeline-library.git /home/repo/mcp-ci/pipeline-library/;
72 chown -R git:www-data /home/repo/mk/mk-pipelines/*;
73 chown -R git:www-data /home/repo/mcp-ci/pipeline-library/*;
74
Oleksii Butenko1e8d5f72018-05-24 16:24:25 +030075 node_name: {{ HOSTNAME_CFG01 }}
76 retry: {count: 1, delay: 10}
77 skip_fail: false
78
79{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020080
81########################################
82# Spin up Control Plane VMs on KVM nodes
83########################################
84
85- description: Execute 'libvirt' states to create necessary libvirt networks
86 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
87 node_name: {{ HOSTNAME_CFG01 }}
88 retry: {count: 2, delay: 10}
89 skip_fail: false
90
91- description: Temporary WR for correct bridge name according to envoronment templates
92 cmd: |
93 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
94 sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
95 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml;
96 salt '*' saltutil.refresh_pillar;
97 node_name: {{ HOSTNAME_CFG01 }}
98 retry: {count: 1, delay: 10}
99 skip_fail: false
100
101- description: Create VMs for control plane
102 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
103 node_name: {{ HOSTNAME_CFG01 }}
104 retry: {count: 3, delay: 10}
105 skip_fail: false
106
107- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
108 cmd: |
109 salt-key -l acc| sort > /tmp/current_keys.txt &&
110 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
111 node_name: {{ HOSTNAME_CFG01 }}
112 retry: {count: 20, delay: 30}
113 skip_fail: false
114
115#########################################
116# Configure all running salt minion nodes
117#########################################
118
119- description: Refresh pillars on all minions
120 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
121 node_name: {{ HOSTNAME_CFG01 }}
122 retry: {count: 1, delay: 5}
123 skip_fail: false
124
125- description: Sync all salt resources
126 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
127 node_name: {{ HOSTNAME_CFG01 }}
128 retry: {count: 1, delay: 5}
129 skip_fail: false
130
131- description: Show reclass-salt --top for generated nodes
132 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
133 node_name: {{ HOSTNAME_CFG01 }}
134 retry: {count: 1, delay: 5}
135 skip_fail: false
136
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +0200137- description: Add cpm nodes to /etc/hosts
138 cmd: |
139 salt --hard-crash --state-output=mixed --state-verbose=False -C '*' cmd.run "echo '10.167.11.105 cmp01.cookied-bm-mcp-ovs-dpdk.local cmp01' >> /etc/hosts";
140 salt --hard-crash --state-output=mixed --state-verbose=False -C '*' cmd.run "echo '10.167.11.106 cmp02.cookied-bm-mcp-ovs-dpdk.local cmp02' >> /etc/hosts";
141 node_name: {{ HOSTNAME_CFG01 }}
142 retry: {count: 1, delay: 10}
143 skip_fail: true
144
Tatyana Leontovich4453dd62018-06-26 18:44:31 +0300145{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
Tatyana Leontovich4453dd62018-06-26 18:44:31 +0300146{{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}}
Oleksii Butenkof65a0042018-06-27 13:38:43 +0300147
148- description: "Give each node root access with key from cfg01"
149 cmd: |
150 set -e;
151 set -x;
152 key=$(ssh-keygen -y -f /root/.ssh/id_rsa);
153 salt '*' cmd.run "echo $key >> /root/.ssh/authorized_keys";
154 salt '*' cmd.run "service sshd restart"
155 node_name: {{ HOSTNAME_CFG01 }}
156 retry: {count: 1, delay: 5}
157 skip_fail: true