| {% from 'cookied-bm-ocata-cicd-pipeline/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| {% from 'cookied-bm-ocata-cicd-pipeline/underlay.yaml' import DOMAIN_NAME with context %} |
| {% from 'cookied-bm-ocata-cicd-pipeline/underlay.yaml' import LAB_CONFIG_NAME with context %} |
| |
| {% set NFV_ENABLED = os_env('NFV_ENABLED','false') %} |
| |
| {%- if NFV_ENABLED == 'true' %} |
| {%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-initial-cicd-nfv.yaml' %} |
| {%- set ENVIRONMENT_CONTEXT_NAMES = ['salt-context-environment.yaml','lab04-physical-inventory-nfv.yaml'] %} |
| {% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','physical-ocata-cicd-nfv') %} |
| {%- else %} |
| {%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-initial-cicd.yaml' %} |
| {%- set ENVIRONMENT_CONTEXT_NAMES = ['salt-context-environment.yaml','lab04-physical-inventory.yaml'] %} |
| {% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','physical-ocata-cicd') %} |
| {%- endif %} |
| |
| {%- set CONTROL_VLAN = os_env('CONTROL_VLAN', '2422') %} |
| {%- set TENANT_VLAN = os_env('TENANT_VLAN', '2423') %} |
| |
| |
| {% import 'shared-salt.yaml' as SHARED with context %} |
| |
| |
| {{ SHARED.MACRO_INSTALL_SALT_MASTER() }} |
| |
| {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }} |
| |
| {{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }} |
| |
| {{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='\*') }} |
| - description: 'Workaround for typo in salt.minion.service (https://gerrit.mcp.mirantis.net/#/c/14806/)' |
| cmd: | |
| git clone https://gerrit.mcp.mirantis.net/salt-formulas/salt /tmp/salt-formula-salt; |
| pushd /tmp/salt-formula-salt; |
| git fetch https://gerrit.mcp.mirantis.net/salt-formulas/salt refs/changes/06/14806/1 && git checkout FETCH_HEAD; |
| popd; |
| cp /tmp/salt-formula-salt/salt/minion/service.sls /usr/share/salt-formulas/env/salt/minion/service.sls; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| |
| {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
| |
| - description: "Workaround for rack01 compute generator" |
| cmd: | |
| set -e; |
| # Remove rack01 key |
| . /root/venv-reclass-tools/bin/activate; |
| reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ SHARED.CLUSTER_NAME }}/infra/config.yml; |
| # Add openstack_compute_node definition from system |
| reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ SHARED.CLUSTER_NAME }}/infra/config.yml --merge; |
| |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 10} |
| skip_fail: false |
| |
| - description: "Workaround for PROD-16973" |
| cmd: | |
| set -e; |
| # Remove obsolete logging section key |
| . /root/venv-reclass-tools/bin/activate; |
| reclass-tools del-key parameters.nova.controller.logging /srv/salt/reclass/classes/system/nova/control/cluster.yml; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| {{ SHARED.MACRO_GENERATE_INVENTORY() }} |
| |
| {{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }} |
| |
| - description: Temporary workaround for removing cinder-volume from CTL nodes |
| cmd: | |
| sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ SHARED.CLUSTER_NAME }}/openstack/control.yml; |
| sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ SHARED.CLUSTER_NAME }}/openstack/control.yml; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: true |
| |
| - description: WR for mounting 1G hugepages before linux.state |
| cmd: | |
| salt 'cmp*' state.sls linux.system.hugepages; |
| salt 'cmp*' cmd.run "mount -o mode=775,pagesize=1G -t hugetlbfs Hugetlbfs-kvm /mnt/hugepages_1G"; |
| salt 'cmp*' cmd.run "echo 16 | sudo tee /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages"; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 10} |
| skip_fail: false |
| |
| - description: WR for correct acces to git repo from jenkins on cfg01 node |
| cmd: | |
| git clone --mirror https://github.com/Mirantis/mk-pipelines.git /home/repo/mk/mk-pipelines/; |
| git clone --mirror https://github.com/Mirantis/pipeline-library.git /home/repo/mcp-ci/pipeline-library/; |
| chown -R git:www-data /home/repo/mk/mk-pipelines/*; |
| chown -R git:www-data /home/repo/mcp-ci/pipeline-library/*; |
| |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 10} |
| skip_fail: false |
| |
| {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| |
| ######################################### |
| # Configure all running salt minion nodes |
| ######################################### |
| |
| - description: Hack resolv.conf on VCP nodes for internal services access |
| cmd: | |
| 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;" |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Refresh pillars on all minions |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Sync all salt resources |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Show reclass-salt --top for generated nodes |
| cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| {{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}} |
| |
| {{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}} |