Oleksii Butenko | f65a004 | 2018-06-27 13:38:43 +0300 | [diff] [blame] | 1 | {% from 'cookied-bm-dpdk-pipeline/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| 2 | {% from 'cookied-bm-dpdk-pipeline/underlay.yaml' import HOSTNAME_CMP01 with context %} |
| 3 | {% from 'cookied-bm-dpdk-pipeline/underlay.yaml' import HOSTNAME_CMP02 with context %} |
| 4 | {% from 'cookied-bm-dpdk-pipeline/underlay.yaml' import HOSTNAME_GTW01 with context %} |
| 5 | {% from 'cookied-bm-dpdk-pipeline/underlay.yaml' import LAB_CONFIG_NAME with context %} |
| 6 | {% from 'cookied-bm-dpdk-pipeline/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" "runtest" "maas" "jenkins" "glusterfs" "backupninja" "auditd"') }} |
| 18 | |
| 19 | {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| 20 | |
| 21 | {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
| 22 | |
| 23 | {{ SHARED.MACRO_GENERATE_INVENTORY() }} |
| 24 | {{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }} |
| 25 | 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 Butenko | f65a004 | 2018-06-27 13:38:43 +0300 | [diff] [blame] | 46 | - description: WR for correct acces to git repo from jenkins on cfg01 node |
| 47 | cmd: | |
| 48 | 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 | |
| 53 | node_name: {{ HOSTNAME_CFG01 }} |
| 54 | retry: {count: 1, delay: 10} |
| 55 | skip_fail: false |
| 56 | |
| 57 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 58 | |
| 59 | ######################################### |
| 60 | # Configure all running salt minion nodes |
| 61 | ######################################### |
| 62 | |
| 63 | - description: Refresh pillars on all minions |
| 64 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 65 | node_name: {{ HOSTNAME_CFG01 }} |
| 66 | retry: {count: 1, delay: 5} |
| 67 | skip_fail: false |
| 68 | |
| 69 | - description: Sync all salt resources |
| 70 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| 71 | node_name: {{ HOSTNAME_CFG01 }} |
| 72 | retry: {count: 1, delay: 5} |
| 73 | skip_fail: false |
| 74 | |
| 75 | - description: Show reclass-salt --top for generated nodes |
| 76 | cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| 77 | node_name: {{ HOSTNAME_CFG01 }} |
| 78 | retry: {count: 1, delay: 5} |
| 79 | skip_fail: false |
| 80 | |
| 81 | - description: Add cpm nodes to /etc/hosts |
| 82 | cmd: | |
| 83 | salt --hard-crash --state-output=mixed --state-verbose=False -C '*' cmd.run "echo '10.167.11.105 cmp01.cookied-bm-dpdk-pipeline.local cmp01' >> /etc/hosts"; |
| 84 | salt --hard-crash --state-output=mixed --state-verbose=False -C '*' cmd.run "echo '10.167.11.106 cmp02.cookied-bm-dpdk-pipeline.local cmp02' >> /etc/hosts"; |
| 85 | node_name: {{ HOSTNAME_CFG01 }} |
| 86 | retry: {count: 1, delay: 10} |
| 87 | skip_fail: true |
| 88 | |
| 89 | {{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}} |
| 90 | {{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}} |
| 91 | |
| 92 | - description: Temporary WR |
| 93 | cmd: | |
| 94 | ssh-keyscan cfg01 > /var/lib/jenkins/.ssh/known_hosts || true; |
| 95 | node_name: {{ HOSTNAME_CFG01 }} |
| 96 | retry: {count: 1, delay: 10} |
| 97 | skip_fail: true |
| 98 | |
| 99 | - description: Enable Jenkins |
| 100 | cmd: | |
| 101 | systemctl enable jenkins || true; |
| 102 | systemctl restart jenkins || true; |
| 103 | sleep 5; |
| 104 | node_name: {{ HOSTNAME_CFG01 }} |
| 105 | retry: {count: 1, delay: 10} |
| 106 | skip_fail: true |
| 107 | |
| 108 | - description: run jenkins.client |
| 109 | cmd: | |
| 110 | salt-call state.sls jenkins.client |
| 111 | node_name: {{ HOSTNAME_CFG01 }} |
| 112 | retry: {count: 1, delay: 10} |
| 113 | skip_fail: false |
| 114 | |
| 115 | - description: "Give each node root access with key from cfg01" |
| 116 | cmd: | |
| 117 | set -e; |
| 118 | set -x; |
| 119 | key=$(ssh-keygen -y -f /root/.ssh/id_rsa); |
| 120 | salt '*' cmd.run "echo $key >> /root/.ssh/authorized_keys"; |
| 121 | salt '*' cmd.run "service sshd restart" |
| 122 | node_name: {{ HOSTNAME_CFG01 }} |
| 123 | retry: {count: 1, delay: 5} |
| 124 | skip_fail: true |
| 125 | |
| 126 | - description: temp WR |
| 127 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run |
| 128 | 'ifdown br-prv; ifup br-prv' |
| 129 | node_name: {{ HOSTNAME_CFG01 }} |
| 130 | retry: {count: 1, delay: 30} |
| 131 | skip_fail: false |
| 132 | |
| 133 | - description: Create net04_external |
| 134 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 135 | '. /root/keystonercv3; neutron net-create net04_ext --router:external True --provider:physical_network physnet1 --provider:network_type flat' |
| 136 | node_name: {{ HOSTNAME_CFG01 }} |
| 137 | retry: {count: 1, delay: 30} |
| 138 | skip_fail: false |
| 139 | |
| 140 | - description: Create subnet_external |
| 141 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 142 | '. /root/keystonercv3; neutron subnet-create net04_ext 172.17.42.128/26 --name net04_ext__subnet --disable-dhcp --allocation-pool start=172.17.42.130,end=172.17.42.180 --gateway 172.17.42.129' |
| 143 | node_name: {{ HOSTNAME_CFG01 }} |
| 144 | retry: {count: 1, delay: 30} |
| 145 | skip_fail: false |
| 146 | |
| 147 | - description: Create net04 |
| 148 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 149 | '. /root/keystonercv3; neutron net-create net04 --provider:network_type vxlan' |
| 150 | node_name: {{ HOSTNAME_CFG01 }} |
| 151 | retry: {count: 1, delay: 30} |
| 152 | skip_fail: false |
| 153 | |
| 154 | - description: Create subnet_net04 |
| 155 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 156 | '. /root/keystonercv3; neutron subnet-create net04 192.168.1.0/24 --name net04__subnet --allocation-pool start=192.168.1.150,end=192.168.1.240' |
| 157 | node_name: {{ HOSTNAME_CFG01 }} |
| 158 | retry: {count: 1, delay: 30} |
| 159 | skip_fail: false |
| 160 | |
| 161 | - description: Create router |
| 162 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 163 | '. /root/keystonercv3; neutron router-create net04_router01 --ha False' |
| 164 | node_name: {{ HOSTNAME_CFG01 }} |
| 165 | retry: {count: 1, delay: 30} |
| 166 | skip_fail: false |
| 167 | |
| 168 | - description: Set geteway |
| 169 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 170 | '. /root/keystonercv3; neutron router-gateway-set net04_router01 net04_ext' |
| 171 | node_name: {{ HOSTNAME_CFG01 }} |
| 172 | retry: {count: 1, delay: 30} |
| 173 | skip_fail: false |
| 174 | |
| 175 | - description: Add interface |
| 176 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| 177 | '. /root/keystonercv3; neutron router-interface-add net04_router01 net04__subnet' |
| 178 | node_name: {{ HOSTNAME_CFG01 }} |
| 179 | retry: {count: 1, delay: 30} |
| 180 | skip_fail: false |
| 181 | |
| 182 | {{ SHARED.INSTALL_DOCKER_ON_GTW() }} |
| 183 | |