sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame^] | 1 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| 2 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import LAB_CONFIG_NAME with context %} |
| 3 | {% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import DOMAIN_NAME with context %} |
| 4 | |
| 5 | {% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %} |
| 6 | # Other salt model repository parameters see in shared-salt.yaml |
| 7 | |
| 8 | # Name of the context file (without extension, that is fixed .yaml) used to render the Environment model |
| 9 | {% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','physical-cookied-bm-mcp-ocata-contrail') %} |
| 10 | # Path to the context files used to render Cluster and Environment models |
| 11 | {%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-contrail.yaml' %} |
| 12 | {%- set ENVIRONMENT_CONTEXT_NAMES = ['salt-context-environment.yaml','lab04-physical-inventory.yaml'] %} |
| 13 | {%- set CONTROL_VLAN = os_env('CONTROL_VLAN', '2422') %} |
| 14 | {%- set TENANT_VLAN = os_env('TENANT_VLAN', '2423') %} |
| 15 | |
| 16 | |
| 17 | {% import 'shared-salt.yaml' as SHARED with context %} |
| 18 | |
| 19 | {{ SHARED.MACRO_INSTALL_SALT_MASTER() }} |
| 20 | |
| 21 | {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }} |
| 22 | |
| 23 | {{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }} |
| 24 | |
| 25 | {{ 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"') }} |
| 26 | |
| 27 | - description: "Fix salt-formula/salt VCP creation. Delete as fast as possible" |
| 28 | cmd: | |
| 29 | set -e; |
| 30 | mkdir -p /tmp/fix_vcp; |
| 31 | cd /tmp/fix_vcp; |
| 32 | git clone https://gerrit.mcp.mirantis.net/salt-formulas/salt; |
| 33 | cd salt; |
| 34 | git fetch https://gerrit.mcp.mirantis.net/salt-formulas/salt refs/changes/10/11210/1 && git checkout FETCH_HEAD; |
| 35 | cp _modules/virtng.py /usr/share/salt-formulas/env/_modules/; |
| 36 | node_name: {{ HOSTNAME_CFG01 }} |
| 37 | retry: {count: 1, delay: 1} |
| 38 | skip_fail: false |
| 39 | |
| 40 | {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| 41 | |
| 42 | {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
| 43 | |
| 44 | - description: "Workaround for rack01 compute generator" |
| 45 | cmd: | |
| 46 | set -e; |
| 47 | # Remove rack01 key |
| 48 | reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 49 | # Add openstack_compute_node definition from system |
| 50 | reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge; |
| 51 | # Set ipaddresses |
| 52 | # salt-call reclass.cluster_meta_set openstack_compute_node01_single_address 10.167.4.72 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
| 53 | # salt-call reclass.cluster_meta_set openstack_compute_node02_single_address 10.167.4.74 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
| 54 | # salt-call reclass.cluster_meta_set openstack_compute_node01_deploy_address 172.16.49.72 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
| 55 | # salt-call reclass.cluster_meta_set openstack_compute_node02_deploy_address 172.16.49.74 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml; |
| 56 | |
| 57 | node_name: {{ HOSTNAME_CFG01 }} |
| 58 | retry: {count: 1, delay: 10} |
| 59 | skip_fail: false |
| 60 | |
| 61 | {{ SHARED.MACRO_GENERATE_INVENTORY() }} |
| 62 | |
| 63 | {{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }} |
| 64 | |
| 65 | |
| 66 | - description: "Workaround for PROD-14060" |
| 67 | cmd: | |
| 68 | set -e; |
| 69 | # Add tenant and single addresses for computes |
| 70 | salt-call reclass.cluster_meta_set deploy_address 172.16.49.72 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml |
| 71 | salt-call reclass.cluster_meta_set tenant_address 192.168.0.101 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml |
| 72 | salt-call reclass.cluster_meta_set single_address 10.167.4.72 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml |
| 73 | |
| 74 | salt-call reclass.cluster_meta_set deploy_address 172.16.49.74 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml |
| 75 | salt-call reclass.cluster_meta_set tenant_address 192.168.0.102 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml |
| 76 | salt-call reclass.cluster_meta_set single_address 10.167.4.74 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml |
| 77 | |
| 78 | node_name: {{ HOSTNAME_CFG01 }} |
| 79 | retry: {count: 1, delay: 10} |
| 80 | skip_fail: false |
| 81 | |
| 82 | - description: "Workaround for PROD-15087" |
| 83 | cmd: | |
| 84 | set -e; |
| 85 | reclass-tools add-key 'classes' 'system.linux.system.repo.mcp.openstack' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/stacklight/telemetry.yml --merge; |
| 86 | node_name: {{ HOSTNAME_CFG01 }} |
| 87 | retry: {count: 1, delay: 10} |
| 88 | skip_fail: false |
| 89 | |
| 90 | |
| 91 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 92 | |
| 93 | ######################################## |
| 94 | # Spin up Control Plane VMs on KVM nodes |
| 95 | ######################################## |
| 96 | |
| 97 | - description: Execute 'libvirt' states to create necessary libvirt networks |
| 98 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt |
| 99 | node_name: {{ HOSTNAME_CFG01 }} |
| 100 | retry: {count: 2, delay: 10} |
| 101 | skip_fail: false |
| 102 | |
| 103 | - description: Create VMs for control plane |
| 104 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control |
| 105 | node_name: {{ HOSTNAME_CFG01 }} |
| 106 | retry: {count: 3, delay: 10} |
| 107 | skip_fail: false |
| 108 | |
| 109 | - description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)' |
| 110 | cmd: | |
| 111 | salt-key -l acc| sort > /tmp/current_keys.txt && |
| 112 | salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt |
| 113 | node_name: {{ HOSTNAME_CFG01 }} |
| 114 | retry: {count: 20, delay: 30} |
| 115 | skip_fail: false |
| 116 | |
| 117 | ######################################### |
| 118 | # Configure all running salt minion nodes |
| 119 | ######################################### |
| 120 | |
| 121 | - description: Refresh pillars on all minions |
| 122 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 123 | node_name: {{ HOSTNAME_CFG01 }} |
| 124 | retry: {count: 1, delay: 5} |
| 125 | skip_fail: false |
| 126 | |
| 127 | - description: Sync all salt resources |
| 128 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| 129 | node_name: {{ HOSTNAME_CFG01 }} |
| 130 | retry: {count: 1, delay: 5} |
| 131 | skip_fail: false |
| 132 | |
| 133 | - description: Show reclass-salt --top for generated nodes |
| 134 | cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| 135 | node_name: {{ HOSTNAME_CFG01 }} |
| 136 | retry: {count: 1, delay: 5} |
| 137 | skip_fail: false |
| 138 | |
| 139 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 140 | |
| 141 | #- description: Hack gtw node |
| 142 | # cmd: salt 'gtw*' cmd.run "ip addr del {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.110/24 dev ens4; ip addr flush dev ens4"; |
| 143 | # node_name: {{ HOSTNAME_CFG01 }} |
| 144 | # retry: {count: 1, delay: 10} |
| 145 | # skip_fail: false |
| 146 | |
| 147 | #- description: Hack cmp01 node |
| 148 | # cmd: salt 'cmp01*' cmd.run "ip addr del {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.105/24 dev ens4; ip addr flush dev ens4"; |
| 149 | # node_name: {{ HOSTNAME_CFG01 }} |
| 150 | # retry: {count: 1, delay: 10} |
| 151 | # skip_fail: false |
| 152 | |
| 153 | #- description: Hack cmp02 node |
| 154 | # cmd: salt 'cmp02*' cmd.run "ip addr del {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.106/24 dev ens4; ip addr flush dev ens4"; |
| 155 | # node_name: {{ HOSTNAME_CFG01 }} |
| 156 | # retry: {count: 1, delay: 10} |
| 157 | # skip_fail: false |