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