blob: 53e5be15707aa205361e2954a08807ab8aa1dd97 [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
17{{ 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"') }}
18
19{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
20
21{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
22
23- description: "WR for changing image to proposed"
24 cmd: |
25 set -e;
26 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;
30 reclass-tools add-key parameters._param.salt_control_xenial_image 'http://ci.mcp.mirantis.net:8085/images/ubuntu-16-04-x64-mcpproposed.qcow2' /srv/salt/reclass/classes/cluster/cookied-bm-mcp-ovs-dpdk/infra/init.yml;
31 reclass-tools add-key parameters._param.salt_control_trusty_image 'http://ci.mcp.mirantis.net:8085/images/ubuntu-14-04-x64-mcpproposed.qcow2' /srv/salt/reclass/classes/cluster/cookied-bm-mcp-ovs-dpdk/infra/init.yml;
32 node_name: {{ HOSTNAME_CFG01 }}
33 retry: {count: 1, delay: 10}
34 skip_fail: false
35
36{{ 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
50- description: WR for mounting 1G hugepages before linux.state
51 cmd: |
52 salt 'cmp*' state.sls linux.system.hugepages;
53 salt 'cmp*' cmd.run "mount -o mode=775,pagesize=1G -t hugetlbfs Hugetlbfs-kvm /mnt/hugepages_1G";
54 salt 'cmp*' cmd.run "echo 16 | sudo tee /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages";
55 node_name: {{ HOSTNAME_CFG01 }}
56 retry: {count: 1, delay: 10}
57 skip_fail: false
58
Oleksii Butenko1e8d5f72018-05-24 16:24:25 +030059- description: "Workaround for PROD-18834: Pre-install linux-headers package"
60 cmd: salt 'cmp*' cmd.run "apt-get install -y linux-headers-$(uname -r)";
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020061 node_name: {{ HOSTNAME_CFG01 }}
62 retry: {count: 1, delay: 10}
Oleksii Butenko1e8d5f72018-05-24 16:24:25 +030063 skip_fail: false
64
65- description: "Workaround for PROD-17975: Pre-install ovs packages to update alternatives to DPDK"
66 cmd: |
67 set -ex;
68 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' state.sls linux.system.repo
69 salt 'cmp*' cmd.run "apt-get install -y openvswitch-switch openvswitch-switch-dpdk";
70 salt 'cmp*' cmd.run "service openvswitch-switch stop";
71 salt 'cmp*' cmd.run "rm -f /var/lib/openvswitch/*";
72 salt 'cmp*' cmd.run "update-alternatives --remove ovs-vswitchd /usr/lib/openvswitch-switch/ovs-vswitchd";
73 salt 'cmp*' cmd.run "service openvswitch-switch start";
74 node_name: {{ HOSTNAME_CFG01 }}
75 retry: {count: 1, delay: 10}
76 skip_fail: false
77
78{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +020079
80########################################
81# Spin up Control Plane VMs on KVM nodes
82########################################
83
84- description: Execute 'libvirt' states to create necessary libvirt networks
85 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
86 node_name: {{ HOSTNAME_CFG01 }}
87 retry: {count: 2, delay: 10}
88 skip_fail: false
89
90- description: Temporary WR for correct bridge name according to envoronment templates
91 cmd: |
92 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
93 sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
94 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml;
95 salt '*' saltutil.refresh_pillar;
96 node_name: {{ HOSTNAME_CFG01 }}
97 retry: {count: 1, delay: 10}
98 skip_fail: false
99
100- description: Create VMs for control plane
101 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
102 node_name: {{ HOSTNAME_CFG01 }}
103 retry: {count: 3, delay: 10}
104 skip_fail: false
105
106- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
107 cmd: |
108 salt-key -l acc| sort > /tmp/current_keys.txt &&
109 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
110 node_name: {{ HOSTNAME_CFG01 }}
111 retry: {count: 20, delay: 30}
112 skip_fail: false
113
114#########################################
115# Configure all running salt minion nodes
116#########################################
117
118- description: Refresh pillars on all minions
119 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
120 node_name: {{ HOSTNAME_CFG01 }}
121 retry: {count: 1, delay: 5}
122 skip_fail: false
123
124- description: Sync all salt resources
125 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
126 node_name: {{ HOSTNAME_CFG01 }}
127 retry: {count: 1, delay: 5}
128 skip_fail: false
129
130- description: Show reclass-salt --top for generated nodes
131 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
132 node_name: {{ HOSTNAME_CFG01 }}
133 retry: {count: 1, delay: 5}
134 skip_fail: false
135
136{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
137
138- 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
Oleksii Butenko97d348f2018-04-19 12:24:18 +0300146- description: Enable sriov interfaces
Oleksii Butenkoade9c6c2018-03-05 15:16:40 +0200147 cmd: |
148 salt --hard-crash --state-output=mixed --state-verbose=False -C 'cmp*' cmd.run "echo 7 > /sys/class/net/enp5s0f1/device/sriov_numvfs"
149 node_name: {{ HOSTNAME_CFG01 }}
150 retry: {count: 1, delay: 10}
151 skip_fail: true
Oleksii Butenko9d9b0502018-04-25 15:45:07 +0300152
153- description: Temporary WR
154 cmd: |
155 ssh-keygen -y -f /root/.ssh/id_rsa > /root/.ssh/id_rsa.pub;
156 pub_key=`cat /root/.ssh/id_rsa.pub`;
157 salt '*' cmd.run "echo $pub_key >> /root/.ssh/authorized_keys";
158 salt '*' cmd.run "service sshd restart";
159 node_name: {{ HOSTNAME_CFG01 }}
160 retry: {count: 1, delay: 10}
161 skip_fail: true
162