blob: bcf5dbbb7173d9a0e9e7a79931fab9d63222d327 [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
Dmitry Kalashnik3056fe72018-02-06 11:46:31 +040055{{ 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" "fluentd"') }}
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 Dmitriev257a9382018-02-15 04:00:46 +020061{{ SHARED.ADJUST_SL_OPTS(OVERRIDES_FILENAME='/srv/salt/reclass/classes/environment/' + ENVIRONMENT_MODEL_INVENTORY_NAME + '/overrides.yml') }}
62
Dennis Dmitriev35d2b8b2017-10-21 18:41:39 +030063{{ SHARED.MACRO_GENERATE_INVENTORY() }}
64
65{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
66
67{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
68
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030069- description: "Lab03 workaround: Control network access from cfg01 node using sshuttle via kvm01"
70 cmd: |
71 set -e;
Dennis Dmitrieve575e982017-10-21 21:50:45 +030072 set -x;
73 KVM01_DEPLOY_ADDRESS=$(salt-call --out=newline_values_only pillar.get _param:infra_kvm_node01_deploy_address);
74 apt-get install -y sshuttle;
Dennis Dmitriev38a5f622017-10-23 16:07:28 +030075 sshuttle -r ${KVM01_DEPLOY_ADDRESS} {{ SHARED.IPV4_NET_CONTROL }} -D >/dev/null;
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030076 node_name: {{ HOSTNAME_CFG01 }}
77 retry: {count: 1, delay: 5}
78 skip_fail: false
Oleksii Butenko7c48def2017-10-03 12:41:05 +030079
Oleksii Butenko9f2cf512017-12-19 14:03:41 +020080- description: Temporary workaround for removing cinder-volume from CTL nodes
81 cmd: |
82 sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
83 sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
84 node_name: {{ HOSTNAME_CFG01 }}
85 retry: {count: 1, delay: 5}
86 skip_fail: true
87
Oleksii Butenko7c48def2017-10-03 12:41:05 +030088########################################
89# Spin up Control Plane VMs on KVM nodes
90########################################
91
92- description: Execute 'libvirt' states to create necessary libvirt networks
93 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
94 node_name: {{ HOSTNAME_CFG01 }}
95 retry: {count: 2, delay: 10}
96 skip_fail: false
97
98- description: Create VMs for control plane
99 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
100 node_name: {{ HOSTNAME_CFG01 }}
101 retry: {count: 3, delay: 10}
102 skip_fail: false
103
104- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
105 cmd: |
106 salt-key -l acc| sort > /tmp/current_keys.txt &&
107 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
108 node_name: {{ HOSTNAME_CFG01 }}
109 retry: {count: 20, delay: 30}
110 skip_fail: false
111
112#########################################
113# Configure all running salt minion nodes
114#########################################
115
116- description: Refresh pillars on all minions
117 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
118 node_name: {{ HOSTNAME_CFG01 }}
119 retry: {count: 1, delay: 5}
120 skip_fail: false
121
122- description: Sync all salt resources
123 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
124 node_name: {{ HOSTNAME_CFG01 }}
125 retry: {count: 1, delay: 5}
126 skip_fail: false
127
128- description: Show reclass-salt --top for generated nodes
129 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
130 node_name: {{ HOSTNAME_CFG01 }}
131 retry: {count: 1, delay: 5}
132 skip_fail: false
133
134{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}