blob: cfe11452ebb12ca2adda49b3a2326ca8b3d6ac0b [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
Oleksii Butenkof65a0042018-06-27 13:38:43 +030017{{ 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"') }}
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020018
19{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
20
21{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
22
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020023{{ SHARED.MACRO_GENERATE_INVENTORY() }}
24{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020025 node_name: {{ HOSTNAME_CFG01 }}
26 retry: {count: 1, delay: 10}
27 skip_fail: false
28
29- description: Temporary workaround for removing cinder-volume from CTL nodes
30 cmd: |
31 sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
32 sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
33 node_name: {{ HOSTNAME_CFG01 }}
34 retry: {count: 1, delay: 5}
35 skip_fail: true
36
37- description: WR for mounting 1G hugepages before linux.state
38 cmd: |
39 salt 'cmp*' state.sls linux.system.hugepages;
40 salt 'cmp*' cmd.run "mount -o mode=775,pagesize=1G -t hugetlbfs Hugetlbfs-kvm /mnt/hugepages_1G";
41 salt 'cmp*' cmd.run "echo 16 | sudo tee /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages";
42 node_name: {{ HOSTNAME_CFG01 }}
43 retry: {count: 1, delay: 10}
44 skip_fail: false
45
Oleksii Butenkof65a0042018-06-27 13:38:43 +030046- description: WR for correct acces to git repo from jenkins on cfg01 node
Oleksii Butenko1e8d5f72018-05-24 16:24:25 +030047 cmd: |
Oleksii Butenkof65a0042018-06-27 13:38:43 +030048 git clone --mirror https://github.com/Mirantis/mk-pipelines.git /home/repo/mk/mk-pipelines/;
49 git clone --mirror https://github.com/Mirantis/pipeline-library.git /home/repo/mcp-ci/pipeline-library/;
50 chown -R git:www-data /home/repo/mk/mk-pipelines/*;
51 chown -R git:www-data /home/repo/mcp-ci/pipeline-library/*;
52
Oleksii Butenko1e8d5f72018-05-24 16:24:25 +030053 node_name: {{ HOSTNAME_CFG01 }}
54 retry: {count: 1, delay: 10}
55 skip_fail: false
56
57{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020058
59########################################
60# Spin up Control Plane VMs on KVM nodes
61########################################
62
63- description: Execute 'libvirt' states to create necessary libvirt networks
64 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
65 node_name: {{ HOSTNAME_CFG01 }}
66 retry: {count: 2, delay: 10}
67 skip_fail: false
68
69- description: Temporary WR for correct bridge name according to envoronment templates
70 cmd: |
71 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
72 sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
73 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml;
74 salt '*' saltutil.refresh_pillar;
75 node_name: {{ HOSTNAME_CFG01 }}
76 retry: {count: 1, delay: 10}
77 skip_fail: false
78
79- description: Create VMs for control plane
80 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
81 node_name: {{ HOSTNAME_CFG01 }}
82 retry: {count: 3, delay: 10}
83 skip_fail: false
84
85- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
86 cmd: |
87 salt-key -l acc| sort > /tmp/current_keys.txt &&
88 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
89 node_name: {{ HOSTNAME_CFG01 }}
90 retry: {count: 20, delay: 30}
91 skip_fail: false
92
93#########################################
94# Configure all running salt minion nodes
95#########################################
96
97- description: Refresh pillars on all minions
98 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
99 node_name: {{ HOSTNAME_CFG01 }}
100 retry: {count: 1, delay: 5}
101 skip_fail: false
102
103- description: Sync all salt resources
104 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 1, delay: 5}
107 skip_fail: false
108
109- description: Show reclass-salt --top for generated nodes
110 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
111 node_name: {{ HOSTNAME_CFG01 }}
112 retry: {count: 1, delay: 5}
113 skip_fail: false
114
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +0200115- description: Add cpm nodes to /etc/hosts
116 cmd: |
117 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";
118 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";
119 node_name: {{ HOSTNAME_CFG01 }}
120 retry: {count: 1, delay: 10}
121 skip_fail: true
122
Tatyana Leontovich4453dd62018-06-26 18:44:31 +0300123{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
Tatyana Leontovich4453dd62018-06-26 18:44:31 +0300124{{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}}
Oleksii Butenkof65a0042018-06-27 13:38:43 +0300125
126- description: "Give each node root access with key from cfg01"
127 cmd: |
128 set -e;
129 set -x;
130 key=$(ssh-keygen -y -f /root/.ssh/id_rsa);
131 salt '*' cmd.run "echo $key >> /root/.ssh/authorized_keys";
132 salt '*' cmd.run "service sshd restart"
133 node_name: {{ HOSTNAME_CFG01 }}
134 retry: {count: 1, delay: 5}
135 skip_fail: true