Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 1 | {% from 'cookied-bm-mcp-ocata-dvr-vxlan/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| 2 | {% from 'cookied-bm-mcp-ocata-dvr-vxlan/underlay.yaml' import LAB_CONFIG_NAME with context %} |
| 3 | {% from 'cookied-bm-mcp-ocata-dvr-vxlan/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','cookied-bm-mcp-ocata-dvr-vxlan') %} |
| 10 | # Path to the context files used to render Cluster and Environment models |
| 11 | {%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-openstack_ovs_dvr_vxlan.yaml' %} |
| 12 | {%- set ENVIRONMENT_CONTEXT_NAMES = ['salt-context-vcp-environment.yaml', 'salt-context-lab03-environment.yaml'] %} |
| 13 | |
| 14 | {%- set CONTROL_VLAN = os_env('CONTROL_VLAN', '2416') %} |
| 15 | {%- set TENANT_VLAN = os_env('TENANT_VLAN', '2417') %} |
| 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 | |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 25 | |
| 26 | - description: "Workaround for PROD-15405: remove OpenStack telemetry nodes from the cluster" |
| 27 | cmd: | |
| 28 | set -e; |
| 29 | sed -i '/system.salt.control.cluster.openstack_telemetry_cluster/d' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 30 | sed -i '/system.reclass.storage.system.openstack_telemetry_cluster/d' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 31 | reclass-tools del-key parameters.reclass.storage.node.openstack_telemetry_node01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 32 | reclass-tools del-key parameters.reclass.storage.node.openstack_telemetry_node02 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 33 | reclass-tools del-key parameters.reclass.storage.node.openstack_telemetry_node03 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 34 | reclass-tools del-key parameters.salt.control.cluster.internal.node.mdb01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 35 | reclass-tools del-key parameters.salt.control.cluster.internal.node.mdb02 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 36 | reclass-tools del-key parameters.salt.control.cluster.internal.node.mdb03 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml; |
| 37 | |
| 38 | node_name: {{ HOSTNAME_CFG01 }} |
| 39 | retry: {count: 1, delay: 10} |
| 40 | skip_fail: false |
| 41 | |
| 42 | - description: "Workaround for rack01 compute generator" |
| 43 | cmd: | |
| 44 | set -e; |
| 45 | # Remove rack01 key |
| 46 | reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 47 | |
| 48 | # Add openstack_compute_node definition from system |
| 49 | reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge; |
| 50 | |
| 51 | # Set ipaddresses for our nodes |
| 52 | reclass-tools add-key parameters._param.openstack_compute_node01_control_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.101 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 53 | reclass-tools add-key parameters._param.openstack_compute_node02_control_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.102 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 54 | reclass-tools add-key parameters._param.openstack_compute_node01_tenant_address {{ SHARED.IPV4_NET_TENANT_PREFIX }}.101 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 55 | reclass-tools add-key parameters._param.openstack_compute_node02_tenant_address {{ SHARED.IPV4_NET_TENANT_PREFIX }}.102 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml; |
| 56 | node_name: {{ HOSTNAME_CFG01 }} |
| 57 | retry: {count: 1, delay: 10} |
| 58 | skip_fail: false |
| 59 | |
| 60 | {{ 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"') }} |
| 61 | |
| 62 | {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }} |
| 63 | |
| 64 | {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }} |
| 65 | |
Dennis Dmitriev | 35d2b8b | 2017-10-21 18:41:39 +0300 | [diff] [blame] | 66 | {{ SHARED.MACRO_GENERATE_INVENTORY() }} |
| 67 | |
| 68 | {{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }} |
| 69 | |
| 70 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |
| 71 | |
Dennis Dmitriev | 8c49ddc | 2017-10-21 14:31:50 +0300 | [diff] [blame] | 72 | - description: "Lab03 workaround: Control network access from cfg01 node using sshuttle via kvm01" |
| 73 | cmd: | |
| 74 | set -e; |
Dennis Dmitriev | e575e98 | 2017-10-21 21:50:45 +0300 | [diff] [blame] | 75 | set -x; |
| 76 | KVM01_DEPLOY_ADDRESS=$(salt-call --out=newline_values_only pillar.get _param:infra_kvm_node01_deploy_address); |
| 77 | apt-get install -y sshuttle; |
Dennis Dmitriev | 38a5f62 | 2017-10-23 16:07:28 +0300 | [diff] [blame^] | 78 | sshuttle -r ${KVM01_DEPLOY_ADDRESS} {{ SHARED.IPV4_NET_CONTROL }} -D >/dev/null; |
Dennis Dmitriev | 8c49ddc | 2017-10-21 14:31:50 +0300 | [diff] [blame] | 79 | node_name: {{ HOSTNAME_CFG01 }} |
| 80 | retry: {count: 1, delay: 5} |
| 81 | skip_fail: false |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 82 | |
Oleksii Butenko | 7c48def | 2017-10-03 12:41:05 +0300 | [diff] [blame] | 83 | ######################################## |
| 84 | # Spin up Control Plane VMs on KVM nodes |
| 85 | ######################################## |
| 86 | |
| 87 | - description: Execute 'libvirt' states to create necessary libvirt networks |
| 88 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt |
| 89 | node_name: {{ HOSTNAME_CFG01 }} |
| 90 | retry: {count: 2, delay: 10} |
| 91 | skip_fail: false |
| 92 | |
| 93 | - description: Create VMs for control plane |
| 94 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control |
| 95 | node_name: {{ HOSTNAME_CFG01 }} |
| 96 | retry: {count: 3, delay: 10} |
| 97 | skip_fail: false |
| 98 | |
| 99 | - description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)' |
| 100 | cmd: | |
| 101 | salt-key -l acc| sort > /tmp/current_keys.txt && |
| 102 | salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt |
| 103 | node_name: {{ HOSTNAME_CFG01 }} |
| 104 | retry: {count: 20, delay: 30} |
| 105 | skip_fail: false |
| 106 | |
| 107 | ######################################### |
| 108 | # Configure all running salt minion nodes |
| 109 | ######################################### |
| 110 | |
| 111 | - description: Refresh pillars on all minions |
| 112 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 113 | node_name: {{ HOSTNAME_CFG01 }} |
| 114 | retry: {count: 1, delay: 5} |
| 115 | skip_fail: false |
| 116 | |
| 117 | - description: Sync all salt resources |
| 118 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5 |
| 119 | node_name: {{ HOSTNAME_CFG01 }} |
| 120 | retry: {count: 1, delay: 5} |
| 121 | skip_fail: false |
| 122 | |
| 123 | - description: Show reclass-salt --top for generated nodes |
| 124 | cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/ |
| 125 | node_name: {{ HOSTNAME_CFG01 }} |
| 126 | retry: {count: 1, delay: 5} |
| 127 | skip_fail: false |
| 128 | |
| 129 | {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }} |