Oleksii Butenko | ade9c6c | 2018-03-05 15:16:40 +0200 | [diff] [blame] | 1 | {% 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() }} |
| 38 | |
| 39 | - description: "Workaround for PROD-14060" |
| 40 | cmd: | |
| 41 | set -e; |
| 42 | # Add tenant and single addresses for computes |
| 43 | salt-call reclass.cluster_meta_set tenant_address 10.167.12.105 /srv/salt/reclass/nodes/_generated/cmp01.cookied-bm-mcp-ovs-dpdk.local.yml |
| 44 | salt-call reclass.cluster_meta_set tenant_address 10.167.12.106 /srv/salt/reclass/nodes/_generated/cmp02.cookied-bm-mcp-ovs-dpdk.local.yml |
| 45 | |
| 46 | node_name: {{ HOSTNAME_CFG01 }} |
| 47 | retry: {count: 1, delay: 10} |
| 48 | skip_fail: false |
| 49 | |
| 50 | - description: Temporary workaround for removing cinder-volume from CTL nodes |
| 51 | cmd: | |
| 52 | sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| 53 | sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| 54 | node_name: {{ HOSTNAME_CFG01 }} |
| 55 | retry: {count: 1, delay: 5} |
| 56 | skip_fail: true |
| 57 | |
| 58 | - description: WR for mounting 1G hugepages before linux.state |
| 59 | cmd: | |
| 60 | salt 'cmp*' state.sls linux.system.hugepages; |
| 61 | salt 'cmp*' cmd.run "mount -o mode=775,pagesize=1G -t hugetlbfs Hugetlbfs-kvm /mnt/hugepages_1G"; |
| 62 | salt 'cmp*' cmd.run "echo 16 | sudo tee /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages"; |
| 63 | node_name: {{ HOSTNAME_CFG01 }} |
| 64 | retry: {count: 1, delay: 10} |
| 65 | skip_fail: false |
| 66 | |
| 67 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 68 | |
| 69 | - description: Temporary WR for PROD-### |
| 70 | cmd: | |
| 71 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'cmp*' cmd.run "update-alternatives --remove ovs-vswitchd /usr/lib/openvswitch-switch/ovs-vswitchd"; |
| 72 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'cmp*' cmd.run "service openvswitch-switch restart" |
| 73 | node_name: {{ HOSTNAME_CFG01 }} |
| 74 | retry: {count: 1, delay: 10} |
| 75 | skip_fail: true |
| 76 | |
| 77 | ######################################## |
| 78 | # Spin up Control Plane VMs on KVM nodes |
| 79 | ######################################## |
| 80 | |
| 81 | - description: Execute 'libvirt' states to create necessary libvirt networks |
| 82 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt |
| 83 | node_name: {{ HOSTNAME_CFG01 }} |
| 84 | retry: {count: 2, delay: 10} |
| 85 | skip_fail: false |
| 86 | |
| 87 | - description: Temporary WR for correct bridge name according to envoronment templates |
| 88 | cmd: | |
| 89 | sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 90 | sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 91 | sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml; |
| 92 | salt '*' saltutil.refresh_pillar; |
| 93 | node_name: {{ HOSTNAME_CFG01 }} |
| 94 | retry: {count: 1, delay: 10} |
| 95 | skip_fail: false |
| 96 | |
| 97 | - description: Create VMs for control plane |
| 98 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control |
| 99 | node_name: {{ HOSTNAME_CFG01 }} |
| 100 | retry: {count: 3, delay: 10} |
| 101 | skip_fail: false |
| 102 | |
| 103 | - description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)' |
| 104 | cmd: | |
| 105 | salt-key -l acc| sort > /tmp/current_keys.txt && |
| 106 | salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt |
| 107 | node_name: {{ HOSTNAME_CFG01 }} |
| 108 | retry: {count: 20, delay: 30} |
| 109 | skip_fail: false |
| 110 | |
| 111 | ######################################### |
| 112 | # Configure all running salt minion nodes |
| 113 | ######################################### |
| 114 | |
| 115 | - description: Refresh pillars on all minions |
| 116 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 117 | node_name: {{ HOSTNAME_CFG01 }} |
| 118 | retry: {count: 1, delay: 5} |
| 119 | skip_fail: false |
| 120 | |
| 121 | - description: Sync all salt resources |
| 122 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| 123 | node_name: {{ HOSTNAME_CFG01 }} |
| 124 | retry: {count: 1, delay: 5} |
| 125 | skip_fail: false |
| 126 | |
| 127 | - description: Show reclass-salt --top for generated nodes |
| 128 | cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| 129 | node_name: {{ HOSTNAME_CFG01 }} |
| 130 | retry: {count: 1, delay: 5} |
| 131 | skip_fail: false |
| 132 | |
| 133 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 134 | |
| 135 | - description: Add cpm nodes to /etc/hosts |
| 136 | cmd: | |
| 137 | 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"; |
| 138 | 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"; |
| 139 | node_name: {{ HOSTNAME_CFG01 }} |
| 140 | retry: {count: 1, delay: 10} |
| 141 | skip_fail: true |
| 142 | |
Oleksii Butenko | 97d348f | 2018-04-19 12:24:18 +0300 | [diff] [blame] | 143 | - description: Enable sriov interfaces |
Oleksii Butenko | ade9c6c | 2018-03-05 15:16:40 +0200 | [diff] [blame] | 144 | cmd: | |
| 145 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'cmp*' cmd.run "echo 7 > /sys/class/net/enp5s0f1/device/sriov_numvfs" |
| 146 | node_name: {{ HOSTNAME_CFG01 }} |
| 147 | retry: {count: 1, delay: 10} |
| 148 | skip_fail: true |
Oleksii Butenko | 9d9b050 | 2018-04-25 15:45:07 +0300 | [diff] [blame] | 149 | |
| 150 | - description: Temporary WR |
| 151 | cmd: | |
| 152 | ssh-keygen -y -f /root/.ssh/id_rsa > /root/.ssh/id_rsa.pub; |
| 153 | pub_key=`cat /root/.ssh/id_rsa.pub`; |
| 154 | salt '*' cmd.run "echo $pub_key >> /root/.ssh/authorized_keys"; |
| 155 | salt '*' cmd.run "service sshd restart"; |
| 156 | node_name: {{ HOSTNAME_CFG01 }} |
| 157 | retry: {count: 1, delay: 10} |
| 158 | skip_fail: true |
| 159 | |