blob: e592270e629e4be37e9d27c54022996dd52eb821 [file] [log] [blame]
Oleksii Butenko7c48def2017-10-03 12:41:05 +03001{% 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 %}
Oleksii Butenkobb46b0b2017-10-24 11:11:48 +03004{% from 'cookied-bm-mcp-ocata-dvr-vxlan/underlay.yaml' import HOSTNAME_KVM01 with context %}
5{% from 'cookied-bm-mcp-ocata-dvr-vxlan/underlay.yaml' import HOSTNAME_KVM02 with context %}
6{% from 'cookied-bm-mcp-ocata-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
12{% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','cookied-bm-mcp-ocata-dvr-vxlan') %}
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
26{{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
27
Oleksii Butenko7c48def2017-10-03 12:41:05 +030028
Oleksii Butenkobb46b0b2017-10-24 11:11:48 +030029#- description: "Workaround for PROD-15405: remove OpenStack telemetry nodes from the cluster"
30# cmd: |
31# set -e;
32# sed -i '/system.salt.control.cluster.openstack_telemetry_cluster/d' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
33# sed -i '/system.reclass.storage.system.openstack_telemetry_cluster/d' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml;
34# reclass-tools del-key parameters.reclass.storage.node.openstack_telemetry_node01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml;
35# reclass-tools del-key parameters.reclass.storage.node.openstack_telemetry_node02 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml;
36# reclass-tools del-key parameters.reclass.storage.node.openstack_telemetry_node03 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml;
37# reclass-tools del-key parameters.salt.control.cluster.internal.node.mdb01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
38# reclass-tools del-key parameters.salt.control.cluster.internal.node.mdb02 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
39# reclass-tools del-key parameters.salt.control.cluster.internal.node.mdb03 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
40#
41# node_name: {{ HOSTNAME_CFG01 }}
42# retry: {count: 1, delay: 10}
43# skip_fail: false
Oleksii Butenko7c48def2017-10-03 12:41:05 +030044
45- description: "Workaround for rack01 compute generator"
46 cmd: |
47 set -e;
48 # Remove rack01 key
49 reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml;
50
51 # Add openstack_compute_node definition from system
52 reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge;
53
54 # Set ipaddresses for our nodes
Oleksii Butenkobb46b0b2017-10-24 11:11:48 +030055 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;
56 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;
57 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;
58 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 +030059 node_name: {{ HOSTNAME_CFG01 }}
60 retry: {count: 1, delay: 10}
61 skip_fail: false
62
63{{ 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"') }}
64
65{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
66
67{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
68
Dennis Dmitriev35d2b8b2017-10-21 18:41:39 +030069{{ SHARED.MACRO_GENERATE_INVENTORY() }}
70
71{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
72
73{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
74
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030075- description: "Lab03 workaround: Control network access from cfg01 node using sshuttle via kvm01"
76 cmd: |
77 set -e;
Dennis Dmitrieve575e982017-10-21 21:50:45 +030078 set -x;
79 KVM01_DEPLOY_ADDRESS=$(salt-call --out=newline_values_only pillar.get _param:infra_kvm_node01_deploy_address);
80 apt-get install -y sshuttle;
Dennis Dmitriev38a5f622017-10-23 16:07:28 +030081 sshuttle -r ${KVM01_DEPLOY_ADDRESS} {{ SHARED.IPV4_NET_CONTROL }} -D >/dev/null;
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030082 node_name: {{ HOSTNAME_CFG01 }}
83 retry: {count: 1, delay: 5}
84 skip_fail: false
Oleksii Butenko7c48def2017-10-03 12:41:05 +030085
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() }}