sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 1 | {% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| 2 | {% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import LAB_CONFIG_NAME with context %} |
| 3 | {% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import DOMAIN_NAME with context %} |
| 4 | {% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import HOSTNAME_KVM01 with context %} |
| 5 | {% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import HOSTNAME_KVM02 with context %} |
| 6 | {% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import HOSTNAME_KVM03 with context %} |
| 7 | |
| 8 | {% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %} |
| 9 | # Other salt model repository parameters see in shared-salt.yaml |
| 10 | # Name of the context file (without extension, that is fixed .yaml) used to render the Environment model |
| 11 | {% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','physical-cookied-bm-mcp-ocata-contrail-nfv') %} |
| 12 | # Path to the context files used to render Cluster and Environment models |
| 13 | {%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-contrail-dpdk.yaml' %} |
| 14 | {%- set ENVIRONMENT_CONTEXT_NAMES = ['salt-context-environment.yaml','lab04-physical-inventory.yaml'] %} |
| 15 | {%- set CONTROL_VLAN = os_env('CONTROL_VLAN', '2422') %} |
| 16 | {%- set TENANT_VLAN = os_env('TENANT_VLAN', '2423') %} |
| 17 | |
| 18 | {% import 'shared-salt.yaml' as SHARED with context %} |
| 19 | |
| 20 | {{ SHARED.MACRO_INSTALL_SALT_MASTER() }} |
| 21 | |
| 22 | {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }} |
| 23 | |
| 24 | {{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }} |
| 25 | |
Vladimir Jigulin | f557c56 | 2018-07-30 18:30:09 +0400 | [diff] [blame^] | 26 | {{ 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" "auditd" "logrotate"') }} |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 27 | |
| 28 | {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| 29 | |
| 30 | {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
| 31 | |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 32 | - description: "Workaround for rack01 compute generator" |
| 33 | cmd: | |
| 34 | set -e; |
| 35 | # Remove rack01 key |
| 36 | . /root/venv-reclass-tools/bin/activate; |
| 37 | reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 38 | # Add openstack_compute_node definition from system |
| 39 | reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge; |
| 40 | node_name: {{ HOSTNAME_CFG01 }} |
| 41 | retry: {count: 1, delay: 10} |
| 42 | skip_fail: false |
| 43 | |
| 44 | - description: "WR for changing image to proposed" |
| 45 | cmd: | |
| 46 | set -e; |
| 47 | # Add message_queu host for opencontrail |
| 48 | . /root/venv-reclass-tools/bin/activate; |
| 49 | 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/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
| 50 | 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/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
| 51 | node_name: {{ HOSTNAME_CFG01 }} |
| 52 | retry: {count: 1, delay: 10} |
| 53 | skip_fail: false |
| 54 | |
| 55 | {{ SHARED.MACRO_GENERATE_INVENTORY() }} |
| 56 | |
| 57 | - description: "WR for dpdk pci to be in correct quotes" |
| 58 | cmd: | |
| 59 | set -e; |
| 60 | . /root/venv-reclass-tools/bin/activate; |
| 61 | reclass-tools add-key parameters._param.compute_vrouter_dpdk_pci '0000:05:00.0' /srv/salt/reclass/nodes/_generated/cmp001.{{ DOMAIN_NAME }}.yml; |
| 62 | reclass-tools add-key parameters._param.compute_vrouter_dpdk_pci '0000:05:00.0' /srv/salt/reclass/nodes/_generated/cmp002.{{ DOMAIN_NAME }}.yml; |
| 63 | node_name: {{ HOSTNAME_CFG01 }} |
| 64 | retry: {count: 1, delay: 10} |
| 65 | skip_fail: false |
| 66 | |
| 67 | {{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }} |
| 68 | |
| 69 | - description: "Workaround for PROD-14060" |
| 70 | cmd: | |
| 71 | set -e; |
| 72 | # Add tenant and single addresses for computes |
| 73 | salt-call reclass.cluster_meta_set deploy_address 172.16.49.73 /srv/salt/reclass/nodes/_generated/cmp001.{{ DOMAIN_NAME }}.yml |
| 74 | salt-call reclass.cluster_meta_set tenant_address 192.168.0.101 /srv/salt/reclass/nodes/_generated/cmp001.{{ DOMAIN_NAME }}.yml |
| 75 | salt-call reclass.cluster_meta_set single_address 10.167.8.101 /srv/salt/reclass/nodes/_generated/cmp001.{{ DOMAIN_NAME }}.yml |
| 76 | salt-call reclass.cluster_meta_set deploy_address 172.16.49.74 /srv/salt/reclass/nodes/_generated/cmp002.{{ DOMAIN_NAME }}.yml |
| 77 | salt-call reclass.cluster_meta_set tenant_address 192.168.0.102 /srv/salt/reclass/nodes/_generated/cmp002.{{ DOMAIN_NAME }}.yml |
| 78 | salt-call reclass.cluster_meta_set single_address 10.167.8.102 /srv/salt/reclass/nodes/_generated/cmp002.{{ DOMAIN_NAME }}.yml |
| 79 | node_name: {{ HOSTNAME_CFG01 }} |
| 80 | retry: {count: 1, delay: 10} |
| 81 | skip_fail: false |
| 82 | |
| 83 | - description: Temporary workaround for removing cinder-volume from CTL nodes |
| 84 | cmd: | |
| 85 | sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| 86 | sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml; |
| 87 | node_name: {{ HOSTNAME_CFG01 }} |
| 88 | retry: {count: 1, delay: 5} |
| 89 | skip_fail: true |
| 90 | |
| 91 | - description: Temporary WR for correct bridge name according to envoronment templates |
| 92 | cmd: | |
| 93 | sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 94 | sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 95 | node_name: {{ HOSTNAME_CFG01 }} |
| 96 | retry: {count: 1, delay: 10} |
| 97 | skip_fail: false |
| 98 | |
| 99 | - description: "WR for correct opencontrail_compute_iface value. Cookiecutter context doesn't have such parameter" |
| 100 | cmd: | |
| 101 | set -e; |
| 102 | . /root/venv-reclass-tools/bin/activate; |
| 103 | reclass-tools add-key parameters._param.opencontrail_compute_iface 'enp5s0f0' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/opencontrail/init.yml; |
| 104 | node_name: {{ HOSTNAME_CFG01 }} |
| 105 | retry: {count: 1, delay: 10} |
| 106 | skip_fail: false |
| 107 | |
| 108 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 109 | |
| 110 | ######################################## |
| 111 | # Spin up Control Plane VMs on KVM nodes |
| 112 | ######################################## |
| 113 | |
| 114 | - description: Execute 'libvirt' states to create necessary libvirt networks |
| 115 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt |
| 116 | node_name: {{ HOSTNAME_CFG01 }} |
| 117 | retry: {count: 2, delay: 10} |
| 118 | skip_fail: false |
| 119 | |
| 120 | - description: Create VMs for control plane |
| 121 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control |
| 122 | node_name: {{ HOSTNAME_CFG01 }} |
| 123 | retry: {count: 3, delay: 10} |
| 124 | skip_fail: false |
| 125 | |
| 126 | - description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)' |
| 127 | cmd: | |
| 128 | salt-key -l acc| sort > /tmp/current_keys.txt && |
| 129 | salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt |
| 130 | node_name: {{ HOSTNAME_CFG01 }} |
| 131 | retry: {count: 20, delay: 30} |
| 132 | skip_fail: false |
| 133 | |
| 134 | ######################################### |
| 135 | # Configure all running salt minion nodes |
| 136 | ######################################### |
| 137 | |
| 138 | - description: Hack resolv.conf on VCP nodes for internal services access |
| 139 | cmd: | |
| 140 | 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;" |
| 141 | node_name: {{ HOSTNAME_CFG01 }} |
| 142 | retry: {count: 1, delay: 5} |
| 143 | skip_fail: false |
| 144 | |
| 145 | - description: Refresh pillars on all minions |
| 146 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 147 | node_name: {{ HOSTNAME_CFG01 }} |
| 148 | retry: {count: 1, delay: 5} |
| 149 | skip_fail: false |
| 150 | |
| 151 | - description: Sync all salt resources |
| 152 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| 153 | node_name: {{ HOSTNAME_CFG01 }} |
| 154 | retry: {count: 1, delay: 5} |
| 155 | skip_fail: false |
| 156 | |
| 157 | - description: Show reclass-salt --top for generated nodes |
| 158 | cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| 159 | node_name: {{ HOSTNAME_CFG01 }} |
| 160 | retry: {count: 1, delay: 5} |
| 161 | skip_fail: false |
| 162 | |
| 163 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
Tatyana Leontovich | 4453dd6 | 2018-06-26 18:44:31 +0300 | [diff] [blame] | 164 | |
| 165 | {{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}} |
| 166 | |
| 167 | {{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}} |