blob: 61805bd50575b79646ce0cf976d3c03faa395302 [file] [log] [blame]
Oleksii Butenko7d9671c2017-11-01 17:27:23 +02001{% 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 Butenko7c48def2017-10-03 12:41:05 +03007
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 Butenko7d9671c2017-11-01 17:27:23 +020012{% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','cookied-bm-mcp-dvr-vxlan') %}
Oleksii Butenko7c48def2017-10-03 12:41:05 +030013# 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
26{{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
27
Oleksii Butenko7c48def2017-10-03 12:41:05 +030028- description: "Workaround for rack01 compute generator"
29 cmd: |
30 set -e;
31 # Remove rack01 key
32 reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml;
33
34 # Add openstack_compute_node definition from system
35 reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge;
36
37 # Set ipaddresses for our nodes
Oleksii Butenkobb46b0b2017-10-24 11:11:48 +030038 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;
39 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;
40 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;
41 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 Butenko7c48def2017-10-03 12:41:05 +030042 node_name: {{ HOSTNAME_CFG01 }}
43 retry: {count: 1, delay: 10}
44 skip_fail: false
45
46{{ 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"') }}
47
48{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
49
50{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
51
Dennis Dmitriev35d2b8b2017-10-21 18:41:39 +030052{{ SHARED.MACRO_GENERATE_INVENTORY() }}
53
54{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
55
56{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
57
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030058- description: "Lab03 workaround: Control network access from cfg01 node using sshuttle via kvm01"
59 cmd: |
60 set -e;
Dennis Dmitrieve575e982017-10-21 21:50:45 +030061 set -x;
62 KVM01_DEPLOY_ADDRESS=$(salt-call --out=newline_values_only pillar.get _param:infra_kvm_node01_deploy_address);
63 apt-get install -y sshuttle;
Dennis Dmitriev38a5f622017-10-23 16:07:28 +030064 sshuttle -r ${KVM01_DEPLOY_ADDRESS} {{ SHARED.IPV4_NET_CONTROL }} -D >/dev/null;
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030065 node_name: {{ HOSTNAME_CFG01 }}
66 retry: {count: 1, delay: 5}
67 skip_fail: false
Oleksii Butenko7c48def2017-10-03 12:41:05 +030068
Oleksii Butenko7c48def2017-10-03 12:41:05 +030069########################################
70# Spin up Control Plane VMs on KVM nodes
71########################################
72
73- description: Execute 'libvirt' states to create necessary libvirt networks
74 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
75 node_name: {{ HOSTNAME_CFG01 }}
76 retry: {count: 2, delay: 10}
77 skip_fail: false
78
79- description: Create VMs for control plane
80 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
81 node_name: {{ HOSTNAME_CFG01 }}
82 retry: {count: 3, delay: 10}
83 skip_fail: false
84
85- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
86 cmd: |
87 salt-key -l acc| sort > /tmp/current_keys.txt &&
88 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
89 node_name: {{ HOSTNAME_CFG01 }}
90 retry: {count: 20, delay: 30}
91 skip_fail: false
92
93#########################################
94# Configure all running salt minion nodes
95#########################################
96
97- description: Refresh pillars on all minions
98 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
99 node_name: {{ HOSTNAME_CFG01 }}
100 retry: {count: 1, delay: 5}
101 skip_fail: false
102
103- description: Sync all salt resources
104 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 1, delay: 5}
107 skip_fail: false
108
109- description: Show reclass-salt --top for generated nodes
110 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
111 node_name: {{ HOSTNAME_CFG01 }}
112 retry: {count: 1, delay: 5}
113 skip_fail: false
114
115{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}