sgudz | f0ff030 | 2018-01-29 18:50:01 +0200 | [diff] [blame^] | 1 | {% from 'cookied-bm-ocata-cicd-pipeline/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| 2 | {% from 'cookied-bm-ocata-cicd-pipeline/underlay.yaml' import DOMAIN_NAME with context %} |
| 3 | |
| 4 | {% set NFV_ENABLED = os_env('NFV_ENABLED','false') %} |
| 5 | |
| 6 | {%- if NFV_ENABLED == 'true' %} |
| 7 | {%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-initial-cicd-nfv.yaml' %} |
| 8 | {%- set ENVIRONMENT_CONTEXT_NAMES = ['salt-context-environment.yaml','lab04-physical-inventory-nfv.yaml'] %} |
| 9 | {% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','physical-ocata-cicd-nfv') %} |
| 10 | {%- else %} |
| 11 | {%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-initial-cicd.yaml' %} |
| 12 | {%- set ENVIRONMENT_CONTEXT_NAMES = ['salt-context-environment.yaml','lab04-physical-inventory.yaml'] %} |
| 13 | {% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','physical-ocata-cicd') %} |
| 14 | {%- endif %} |
| 15 | |
| 16 | {%- set CONTROL_VLAN = os_env('CONTROL_VLAN', '2422') %} |
| 17 | {%- set TENANT_VLAN = os_env('TENANT_VLAN', '2423') %} |
| 18 | |
| 19 | |
| 20 | {% import 'shared-salt.yaml' as SHARED with context %} |
| 21 | |
| 22 | |
| 23 | {{ SHARED.MACRO_INSTALL_SALT_MASTER() }} |
| 24 | |
| 25 | {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }} |
| 26 | |
| 27 | {{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }} |
| 28 | |
| 29 | {{ 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" "powerdns" "glusterfs" "xtrabackup" "maas" "backupninja" "jenkins"') }} |
| 30 | |
| 31 | {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| 32 | |
| 33 | {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
| 34 | |
| 35 | - description: "Workaround for rack01 compute generator" |
| 36 | cmd: | |
| 37 | set -e; |
| 38 | # Remove rack01 key |
| 39 | . /root/venv-reclass-tools/bin/activate; |
| 40 | reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ SHARED.CLUSTER_NAME }}/infra/config.yml; |
| 41 | # Add openstack_compute_node definition from system |
| 42 | reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ SHARED.CLUSTER_NAME }}/infra/config.yml --merge; |
| 43 | |
| 44 | node_name: {{ HOSTNAME_CFG01 }} |
| 45 | retry: {count: 1, delay: 10} |
| 46 | skip_fail: false |
| 47 | |
| 48 | - description: Remove cicd nodes from VCP, because we have baremetal cicd nodes |
| 49 | cmd: | |
| 50 | sed -i 's/\-\ system\.salt\.control\.cluster\.cicd\_control\_cluster//g' /srv/salt/reclass/classes/cluster/{{ SHARED.CLUSTER_NAME }}/infra/kvm.yml; |
| 51 | node_name: {{ HOSTNAME_CFG01 }} |
| 52 | retry: {count: 1, delay: 5} |
| 53 | skip_fail: false |
| 54 | |
| 55 | |
| 56 | - description: "Workaround for PROD-16973" |
| 57 | cmd: | |
| 58 | set -e; |
| 59 | # Remove obsolete logging section key |
| 60 | . /root/venv-reclass-tools/bin/activate; |
| 61 | reclass-tools del-key parameters.nova.controller.logging /srv/salt/reclass/classes/system/nova/control/cluster.yml; |
| 62 | node_name: {{ HOSTNAME_CFG01 }} |
| 63 | retry: {count: 1, delay: 5} |
| 64 | skip_fail: false |
| 65 | |
| 66 | {{ SHARED.MACRO_GENERATE_INVENTORY() }} |
| 67 | |
| 68 | {{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }} |
| 69 | |
| 70 | - description: Temporary workaround for removing cinder-volume from CTL nodes |
| 71 | cmd: | |
| 72 | sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ SHARED.CLUSTER_NAME }}/openstack/control.yml; |
| 73 | sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ SHARED.CLUSTER_NAME }}/openstack/control.yml; |
| 74 | node_name: {{ HOSTNAME_CFG01 }} |
| 75 | retry: {count: 1, delay: 5} |
| 76 | skip_fail: true |
| 77 | |
| 78 | - description: WR for mounting 1G hugepages before linux.state |
| 79 | cmd: | |
| 80 | salt 'cmp*' state.sls linux.system.hugepages; |
| 81 | salt 'cmp*' cmd.run "mount -o mode=775,pagesize=1G -t hugetlbfs Hugetlbfs-kvm /mnt/hugepages_1G"; |
| 82 | salt 'cmp*' cmd.run "echo 16 | sudo tee /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages"; |
| 83 | node_name: {{ HOSTNAME_CFG01 }} |
| 84 | retry: {count: 1, delay: 10} |
| 85 | skip_fail: false |
| 86 | |
| 87 | - description: WR for correct acces to git repo from jenkins on cfg01 node |
| 88 | cmd: | |
| 89 | git clone --mirror https://github.com/Mirantis/mk-pipelines.git /home/repo/mk/mk-pipelines/; |
| 90 | git clone --mirror https://github.com/Mirantis/pipeline-library.git /home/repo/mcp-ci/pipeline-library/; |
| 91 | chown -R git:www-data /home/repo/mk/mk-pipelines/*; |
| 92 | chown -R git:www-data /home/repo/mcp-ci/pipeline-library/*; |
| 93 | |
| 94 | node_name: {{ HOSTNAME_CFG01 }} |
| 95 | retry: {count: 1, delay: 10} |
| 96 | skip_fail: false |
| 97 | |
| 98 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 99 | |
| 100 | ######################################### |
| 101 | # Configure all running salt minion nodes |
| 102 | ######################################### |
| 103 | |
| 104 | - description: Hack resolv.conf on VCP nodes for internal services access |
| 105 | cmd: | |
| 106 | salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not kvm* and not cmp* and not gtw* and not cfg*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;" |
| 107 | node_name: {{ HOSTNAME_CFG01 }} |
| 108 | retry: {count: 1, delay: 5} |
| 109 | skip_fail: false |
| 110 | |
| 111 | - description: Refresh pillars on all minions |
| 112 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 113 | node_name: {{ HOSTNAME_CFG01 }} |
| 114 | retry: {count: 1, delay: 5} |
| 115 | skip_fail: false |
| 116 | |
| 117 | - description: Sync all salt resources |
| 118 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| 119 | node_name: {{ HOSTNAME_CFG01 }} |
| 120 | retry: {count: 1, delay: 5} |
| 121 | skip_fail: false |
| 122 | |
| 123 | - description: Show reclass-salt --top for generated nodes |
| 124 | cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| 125 | node_name: {{ HOSTNAME_CFG01 }} |
| 126 | retry: {count: 1, delay: 5} |
| 127 | skip_fail: false |