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 | |
sgudz | 8c888ec | 2017-10-02 15:29:23 +0300 | [diff] [blame] | 27 | {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| 28 | |
| 29 | {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
| 30 | |
| 31 | - description: "Workaround for rack01 compute generator" |
| 32 | cmd: | |
| 33 | set -e; |
| 34 | # Remove rack01 key |
| 35 | reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 36 | # Add openstack_compute_node definition from system |
| 37 | reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge; |
| 38 | # Set ipaddresses |
| 39 | # 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; |
| 40 | # 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; |
| 41 | # 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; |
| 42 | # 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; |
| 43 | |
| 44 | node_name: {{ HOSTNAME_CFG01 }} |
| 45 | retry: {count: 1, delay: 10} |
| 46 | skip_fail: false |
| 47 | |
| 48 | {{ SHARED.MACRO_GENERATE_INVENTORY() }} |
| 49 | |
| 50 | {{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }} |
| 51 | |
| 52 | |
| 53 | - description: "Workaround for PROD-14060" |
| 54 | cmd: | |
| 55 | set -e; |
| 56 | # Add tenant and single addresses for computes |
| 57 | 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 |
| 58 | 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 |
| 59 | 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 |
| 60 | |
| 61 | 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 |
| 62 | 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 |
| 63 | 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 |
| 64 | |
| 65 | node_name: {{ HOSTNAME_CFG01 }} |
| 66 | retry: {count: 1, delay: 10} |
| 67 | skip_fail: false |
| 68 | |
| 69 | - description: "Workaround for PROD-15087" |
| 70 | cmd: | |
| 71 | set -e; |
| 72 | reclass-tools add-key 'classes' 'system.linux.system.repo.mcp.openstack' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/stacklight/telemetry.yml --merge; |
| 73 | node_name: {{ HOSTNAME_CFG01 }} |
| 74 | retry: {count: 1, delay: 10} |
| 75 | skip_fail: false |
| 76 | |
| 77 | |
| 78 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 79 | |
| 80 | ######################################## |
| 81 | # Spin up Control Plane VMs on KVM nodes |
| 82 | ######################################## |
| 83 | |
| 84 | - description: Execute 'libvirt' states to create necessary libvirt networks |
| 85 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt |
| 86 | node_name: {{ HOSTNAME_CFG01 }} |
| 87 | retry: {count: 2, delay: 10} |
| 88 | skip_fail: false |
| 89 | |
| 90 | - description: Create VMs for control plane |
| 91 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control |
| 92 | node_name: {{ HOSTNAME_CFG01 }} |
| 93 | retry: {count: 3, delay: 10} |
| 94 | skip_fail: false |
| 95 | |
| 96 | - description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)' |
| 97 | cmd: | |
| 98 | salt-key -l acc| sort > /tmp/current_keys.txt && |
| 99 | salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt |
| 100 | node_name: {{ HOSTNAME_CFG01 }} |
| 101 | retry: {count: 20, delay: 30} |
| 102 | skip_fail: false |
| 103 | |
| 104 | ######################################### |
| 105 | # Configure all running salt minion nodes |
| 106 | ######################################### |
| 107 | |
| 108 | - description: Refresh pillars on all minions |
| 109 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 110 | node_name: {{ HOSTNAME_CFG01 }} |
| 111 | retry: {count: 1, delay: 5} |
| 112 | skip_fail: false |
| 113 | |
| 114 | - description: Sync all salt resources |
| 115 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| 116 | node_name: {{ HOSTNAME_CFG01 }} |
| 117 | retry: {count: 1, delay: 5} |
| 118 | skip_fail: false |
| 119 | |
| 120 | - description: Show reclass-salt --top for generated nodes |
| 121 | cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| 122 | node_name: {{ HOSTNAME_CFG01 }} |
| 123 | retry: {count: 1, delay: 5} |
| 124 | skip_fail: false |
| 125 | |
| 126 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 127 | |
| 128 | #- description: Hack gtw node |
| 129 | # cmd: salt 'gtw*' cmd.run "ip addr del {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.110/24 dev ens4; ip addr flush dev ens4"; |
| 130 | # node_name: {{ HOSTNAME_CFG01 }} |
| 131 | # retry: {count: 1, delay: 10} |
| 132 | # skip_fail: false |
| 133 | |
| 134 | #- description: Hack cmp01 node |
| 135 | # cmd: salt 'cmp01*' cmd.run "ip addr del {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.105/24 dev ens4; ip addr flush dev ens4"; |
| 136 | # node_name: {{ HOSTNAME_CFG01 }} |
| 137 | # retry: {count: 1, delay: 10} |
| 138 | # skip_fail: false |
| 139 | |
| 140 | #- description: Hack cmp02 node |
| 141 | # cmd: salt 'cmp02*' cmd.run "ip addr del {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.106/24 dev ens4; ip addr flush dev ens4"; |
| 142 | # node_name: {{ HOSTNAME_CFG01 }} |
| 143 | # retry: {count: 1, delay: 10} |
| 144 | # skip_fail: false |