blob: a4e43baacce29cfcc212c4fb1e5d9cc553fc22e2 [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
8{% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-baremetal-lab') %}
9# 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
Vladimir Jigulinf557c562018-07-30 18:30:09 +040030{{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='"linux" "reclass" "salt" "openssh" "ntp" "git" "nginx" "collectd" "sensu" "heka" "sphinx" "keystone" "mysql" "grafana" "haproxy" "rsyslog" "horizon" "prometheus" "telegraf" "elasticsearch" "fluentd" "runtest" "maas" "jenkins" "glusterfs" "backupninja" "auditd" "logrotate"') }}
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020031
32{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
33
34{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
35
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020036{{ SHARED.MACRO_GENERATE_INVENTORY() }}
37{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020038 node_name: {{ HOSTNAME_CFG01 }}
39 retry: {count: 1, delay: 10}
40 skip_fail: false
41
42- description: Temporary workaround for removing cinder-volume from CTL nodes
43 cmd: |
44 sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
45 sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
46 node_name: {{ HOSTNAME_CFG01 }}
47 retry: {count: 1, delay: 5}
48 skip_fail: true
49
Tatyana Leontovichfa388892018-08-13 13:27:25 +030050
51- description: Temporary workaround for removing virtual gtw nodes
52 cmd: |
53 sed -i 's/\-\ system\.salt\.control\.sizes\.ovs\.compact//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
54 sed -i 's/\-\ system\.salt\.control\.placement\.ovs\.compact//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
55 node_name: {{ HOSTNAME_CFG01 }}
56 retry: {count: 1, delay: 5}
57 skip_fail: true
58
59
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020060- description: WR for mounting 1G hugepages before linux.state
61 cmd: |
62 salt 'cmp*' state.sls linux.system.hugepages;
63 salt 'cmp*' cmd.run "mount -o mode=775,pagesize=1G -t hugetlbfs Hugetlbfs-kvm /mnt/hugepages_1G";
64 salt 'cmp*' cmd.run "echo 16 | sudo tee /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages";
65 node_name: {{ HOSTNAME_CFG01 }}
66 retry: {count: 1, delay: 10}
67 skip_fail: false
68
Oleksii Butenkof65a0042018-06-27 13:38:43 +030069- description: WR for correct acces to git repo from jenkins on cfg01 node
Oleksii Butenko1e8d5f72018-05-24 16:24:25 +030070 cmd: |
Oleksii Butenkof65a0042018-06-27 13:38:43 +030071 git clone --mirror https://github.com/Mirantis/mk-pipelines.git /home/repo/mk/mk-pipelines/;
72 git clone --mirror https://github.com/Mirantis/pipeline-library.git /home/repo/mcp-ci/pipeline-library/;
73 chown -R git:www-data /home/repo/mk/mk-pipelines/*;
74 chown -R git:www-data /home/repo/mcp-ci/pipeline-library/*;
75
Oleksii Butenko1e8d5f72018-05-24 16:24:25 +030076 node_name: {{ HOSTNAME_CFG01 }}
77 retry: {count: 1, delay: 10}
78 skip_fail: false
79
80{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020081
82########################################
83# Spin up Control Plane VMs on KVM nodes
84########################################
85
86- description: Execute 'libvirt' states to create necessary libvirt networks
87 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
88 node_name: {{ HOSTNAME_CFG01 }}
89 retry: {count: 2, delay: 10}
90 skip_fail: false
91
92- description: Temporary WR for correct bridge name according to envoronment templates
93 cmd: |
94 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
95 sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
96 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml;
97 salt '*' saltutil.refresh_pillar;
98 node_name: {{ HOSTNAME_CFG01 }}
99 retry: {count: 1, delay: 10}
100 skip_fail: false
101
102- description: Create VMs for control plane
103 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
104 node_name: {{ HOSTNAME_CFG01 }}
105 retry: {count: 3, delay: 10}
106 skip_fail: false
107
108- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
109 cmd: |
110 salt-key -l acc| sort > /tmp/current_keys.txt &&
111 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
112 node_name: {{ HOSTNAME_CFG01 }}
113 retry: {count: 20, delay: 30}
114 skip_fail: false
115
116#########################################
117# Configure all running salt minion nodes
118#########################################
119
120- description: Refresh pillars on all minions
121 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
122 node_name: {{ HOSTNAME_CFG01 }}
123 retry: {count: 1, delay: 5}
124 skip_fail: false
125
126- description: Sync all salt resources
127 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
128 node_name: {{ HOSTNAME_CFG01 }}
129 retry: {count: 1, delay: 5}
130 skip_fail: false
131
132- description: Show reclass-salt --top for generated nodes
133 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
134 node_name: {{ HOSTNAME_CFG01 }}
135 retry: {count: 1, delay: 5}
136 skip_fail: false
137
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +0200138- description: Add cpm nodes to /etc/hosts
139 cmd: |
140 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";
141 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";
142 node_name: {{ HOSTNAME_CFG01 }}
143 retry: {count: 1, delay: 10}
144 skip_fail: true
145
Tatyana Leontovich4453dd62018-06-26 18:44:31 +0300146{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
Tatyana Leontovich4453dd62018-06-26 18:44:31 +0300147{{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}}
Oleksii Butenkof65a0042018-06-27 13:38:43 +0300148
149- description: "Give each node root access with key from cfg01"
150 cmd: |
151 set -e;
152 set -x;
153 key=$(ssh-keygen -y -f /root/.ssh/id_rsa);
154 salt '*' cmd.run "echo $key >> /root/.ssh/authorized_keys";
155 salt '*' cmd.run "service sshd restart"
156 node_name: {{ HOSTNAME_CFG01 }}
157 retry: {count: 1, delay: 5}
158 skip_fail: true