| {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import LAB_CONFIG_NAME with context %} |
| {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import DOMAIN_NAME with context %} |
| {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import HOSTNAME_KVM01 with context %} |
| {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import HOSTNAME_KVM02 with context %} |
| {% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import HOSTNAME_KVM03 with context %} |
| |
| {% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %} |
| |
| {% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','cookied-bm-mcp-dvr-vxlan') %} |
| |
| {% import 'shared-salt.yaml' as SHARED with context %} |
| |
| {{ SHARED.MACRO_INSTALL_SALT_MASTER() }} |
| |
| {{ SHARED.MACRO_CLONE_RECLASS_MODELS() }} |
| |
| {{ 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" "fluentd" "runtest" "auditd" "logrotate"') }} |
| |
| {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| |
| {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
| |
| - description: "WR for changing VCP images path to internal storage" |
| cmd: | |
| set -e; |
| apt-get -y install python-virtualenv python-pip build-essential python-dev libssl-dev; |
| [[ -d /root/venv-reclass-tools ]] || virtualenv /root/venv-reclass-tools; |
| . /root/venv-reclass-tools/bin/activate; |
| pip install git+https://github.com/dis-xcom/reclass-tools; |
| reclass-tools add-key parameters._param.salt_control_xenial_image 'https://apt.mcp.mirantis.net/images/ubuntu-16-04-x64-mcp{{ SHARED.REPOSITORY_SUITE }}.qcow2' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 10} |
| 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/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: true |
| |
| - description: Temporary workaround for removing virtual gtw nodes |
| cmd: | |
| sed -i 's/\-\ system\.salt\.control\.sizes\.ovs\.compact//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| sed -i 's/\-\ system\.salt\.control\.placement\.ovs\.compact//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: true |
| |
| - description: Rerun openssh after env model is generated |
| cmd: | |
| salt-call state.sls openssh |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 10} |
| skip_fail: false |
| |
| {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| |
| ######################################## |
| # Spin up Control Plane VMs on KVM nodes |
| ######################################## |
| |
| - description: Hack resolv.conf on nodes for internal services access |
| cmd: | |
| salt --hard-crash --state-output=mixed --state-verbose=False -C '*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;" |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Execute 'libvirt' states to create necessary libvirt networks |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 2, delay: 10} |
| skip_fail: false |
| |
| - description: Temporary WR for correct bridge name according to envoronment templates |
| cmd: | |
| sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml; |
| salt '*' saltutil.refresh_pillar; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 10} |
| skip_fail: false |
| |
| - description: Create VMs for control plane |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 3, delay: 10} |
| skip_fail: false |
| |
| - description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)' |
| cmd: | |
| salt-key -l acc| sort > /tmp/current_keys.txt && |
| salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 20, delay: 30} |
| skip_fail: false |
| |
| ######################################### |
| # Configure all running salt minion nodes |
| ######################################### |
| |
| - 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_BOOTSTRAP_ALL_MINIONS() }} |
| |
| {{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}} |
| |
| {{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}} |
| |