blob: 722816c7ddece94a6273a2d55dd87726964a0124 [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
Oleksii Butenko9f2cf512017-12-19 14:03:41 +020026- 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 Butenko7c48def2017-10-03 12:41:05 +030034{{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
35
Oleksii Butenko7c48def2017-10-03 12:41:05 +030036- description: "Workaround for rack01 compute generator"
37 cmd: |
38 set -e;
39 # Remove rack01 key
Dennis Dmitrievd96ace12018-01-26 14:46:21 +020040 . /root/venv-reclass-tools/bin/activate;
Oleksii Butenko7c48def2017-10-03 12:41:05 +030041 reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml;
42
43 # Add openstack_compute_node definition from system
44 reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge;
45
46 # Set ipaddresses for our nodes
Oleksii Butenkobb46b0b2017-10-24 11:11:48 +030047 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;
48 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;
49 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;
50 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 +030051 node_name: {{ HOSTNAME_CFG01 }}
52 retry: {count: 1, delay: 10}
53 skip_fail: false
54
Dennis Dmitriev01a51292018-01-18 17:41:17 +020055{{ 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 Butenko7c48def2017-10-03 12:41:05 +030056
57{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
58
59{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
60
Dennis Dmitriev35d2b8b2017-10-21 18:41:39 +030061{{ SHARED.MACRO_GENERATE_INVENTORY() }}
62
63{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
64
65{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
66
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030067- description: "Lab03 workaround: Control network access from cfg01 node using sshuttle via kvm01"
68 cmd: |
69 set -e;
Dennis Dmitrieve575e982017-10-21 21:50:45 +030070 set -x;
71 KVM01_DEPLOY_ADDRESS=$(salt-call --out=newline_values_only pillar.get _param:infra_kvm_node01_deploy_address);
72 apt-get install -y sshuttle;
Dennis Dmitriev38a5f622017-10-23 16:07:28 +030073 sshuttle -r ${KVM01_DEPLOY_ADDRESS} {{ SHARED.IPV4_NET_CONTROL }} -D >/dev/null;
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030074 node_name: {{ HOSTNAME_CFG01 }}
75 retry: {count: 1, delay: 5}
76 skip_fail: false
Oleksii Butenko7c48def2017-10-03 12:41:05 +030077
Oleksii Butenko9f2cf512017-12-19 14:03:41 +020078- description: Temporary workaround for removing cinder-volume from CTL nodes
79 cmd: |
80 sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
81 sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
82 node_name: {{ HOSTNAME_CFG01 }}
83 retry: {count: 1, delay: 5}
84 skip_fail: true
85
Oleksii Butenko7c48def2017-10-03 12:41:05 +030086########################################
87# Spin up Control Plane VMs on KVM nodes
88########################################
89
90- description: Execute 'libvirt' states to create necessary libvirt networks
91 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
92 node_name: {{ HOSTNAME_CFG01 }}
93 retry: {count: 2, delay: 10}
94 skip_fail: false
95
96- description: Create VMs for control plane
97 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
98 node_name: {{ HOSTNAME_CFG01 }}
99 retry: {count: 3, delay: 10}
100 skip_fail: false
101
102- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
103 cmd: |
104 salt-key -l acc| sort > /tmp/current_keys.txt &&
105 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
106 node_name: {{ HOSTNAME_CFG01 }}
107 retry: {count: 20, delay: 30}
108 skip_fail: false
109
110#########################################
111# Configure all running salt minion nodes
112#########################################
113
114- description: Refresh pillars on all minions
115 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
116 node_name: {{ HOSTNAME_CFG01 }}
117 retry: {count: 1, delay: 5}
118 skip_fail: false
119
120- description: Sync all salt resources
121 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
122 node_name: {{ HOSTNAME_CFG01 }}
123 retry: {count: 1, delay: 5}
124 skip_fail: false
125
126- description: Show reclass-salt --top for generated nodes
127 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
128 node_name: {{ HOSTNAME_CFG01 }}
129 retry: {count: 1, delay: 5}
130 skip_fail: false
131
132{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}