blob: 340b3c5f87b64c4c4e116855a3e9e803ad4912bc [file] [log] [blame]
sgudz8c888ec2017-10-02 15:29:23 +03001{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
2{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import LAB_CONFIG_NAME with context %}
3{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import DOMAIN_NAME with context %}
sgudzcced67d2017-10-11 15:56:09 +03004{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_KVM01 with context %}
5{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_KVM02 with context %}
6{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_KVM03 with context %}
sgudz8c888ec2017-10-02 15:29:23 +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','physical-cookied-bm-mcp-ocata-contrail') %}
13# Path to the context files used to render Cluster and Environment models
sgudzcced67d2017-10-11 15:56:09 +030014{%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-contrail-dpdk.yaml' %}
sgudz8c888ec2017-10-02 15:29:23 +030015{%- set ENVIRONMENT_CONTEXT_NAMES = ['salt-context-environment.yaml','lab04-physical-inventory.yaml'] %}
16{%- set CONTROL_VLAN = os_env('CONTROL_VLAN', '2422') %}
17{%- set TENANT_VLAN = os_env('TENANT_VLAN', '2423') %}
18
19
20{% import 'shared-salt.yaml' as SHARED with context %}
21
sgudzcced67d2017-10-11 15:56:09 +030022- description: (REMOVE asap) Hack KVMs of Hash sum mismatch
23 cmd: |
24 rm -rf /var/lib/apt/lists/*;
25 apt-get clean;
26 apt-get update;
27 node_name: {{ HOSTNAME_KVM01 }}
28 retry: {count: 1, delay: 5}
29 skip_fail: true
30
31- description: (REMOVE asap) Hack KVMs of Hash sum mismatch
32 cmd: |
33 rm -rf /var/lib/apt/lists/*;
34 apt-get clean;
35 apt-get update;
36 node_name: {{ HOSTNAME_KVM02 }}
37 retry: {count: 1, delay: 5}
38 skip_fail: true
39
40- description: (REMOVE asap) Hack KVMs of Hash sum mismatch
41 cmd: |
42 rm -rf /var/lib/apt/lists/*;
43 apt-get clean;
44 apt-get update;
45 node_name: {{ HOSTNAME_KVM03 }}
46 retry: {count: 1, delay: 5}
47 skip_fail: true
48
49
sgudz8c888ec2017-10-02 15:29:23 +030050{{ SHARED.MACRO_INSTALL_SALT_MASTER() }}
51
52{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }}
53
sgudzcced67d2017-10-11 15:56:09 +030054- description: Temporary WR for cinder backend defined by default in reclass.system
55 cmd: |
56 sed -i 's/backend\:\ {}//g' /srv/salt/reclass/classes/system/cinder/control/cluster.yml;
57 node_name: {{ HOSTNAME_CFG01 }}
58 retry: {count: 1, delay: 5}
59 skip_fail: false
60
61
sgudz8c888ec2017-10-02 15:29:23 +030062{{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
63
Dennis Dmitriev01a51292018-01-18 17:41:17 +020064{{ 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"') }}
sgudz8c888ec2017-10-02 15:29:23 +030065
sgudzcced67d2017-10-11 15:56:09 +030066- description: "Workaround for haproxy without listen"
67 cmd: |
68 set -e;
69 git clone https://gerrit.mcp.mirantis.net/salt-formulas/haproxy;
70 cd haproxy/;
71 git fetch https://gerrit.mcp.mirantis.net/salt-formulas/haproxy refs/changes/39/11339/1 && git checkout FETCH_HEAD;
72 cp haproxy/files/haproxy.cfg /srv/salt/env/prd/haproxy/files/;
73 node_name: {{ HOSTNAME_CFG01 }}
74 retry: {count: 1, delay: 10}
75 skip_fail: true
76
sgudz8c888ec2017-10-02 15:29:23 +030077{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
78
sgudzcced67d2017-10-11 15:56:09 +030079- description: (REMOVE asap) Hack CFG of Hash sum mismatch
80 cmd: |
81 rm -rf /var/lib/apt/lists/*;
82 apt-get clean;
83 apt-get update;
84 node_name: {{ HOSTNAME_CFG01 }}
85 retry: {count: 1, delay: 5}
86 skip_fail: true
87
sgudz8c888ec2017-10-02 15:29:23 +030088{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
89
90- description: "Workaround for rack01 compute generator"
91 cmd: |
92 set -e;
93 # Remove rack01 key
94 reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml;
95 # Add openstack_compute_node definition from system
96 reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge;
97 # Set ipaddresses
sgudzcced67d2017-10-11 15:56:09 +030098# salt-call reclass.cluster_meta_set openstack_compute_node01_single_address 10.167.8.101 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml;
99# salt-call reclass.cluster_meta_set openstack_compute_node02_single_address 10.167.8.102 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml;
sgudz8c888ec2017-10-02 15:29:23 +0300100# salt-call reclass.cluster_meta_set openstack_compute_node01_deploy_address 172.16.49.72 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml;
101# salt-call reclass.cluster_meta_set openstack_compute_node02_deploy_address 172.16.49.74 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml;
102
103 node_name: {{ HOSTNAME_CFG01 }}
104 retry: {count: 1, delay: 10}
105 skip_fail: false
106
107{{ SHARED.MACRO_GENERATE_INVENTORY() }}
108
109{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
110
111
112- description: "Workaround for PROD-14060"
113 cmd: |
114 set -e;
115 # Add tenant and single addresses for computes
116 salt-call reclass.cluster_meta_set deploy_address 172.16.49.72 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml
117 salt-call reclass.cluster_meta_set tenant_address 192.168.0.101 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml
sgudzcced67d2017-10-11 15:56:09 +0300118 salt-call reclass.cluster_meta_set single_address 10.167.8.101 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml
sgudz8c888ec2017-10-02 15:29:23 +0300119
120 salt-call reclass.cluster_meta_set deploy_address 172.16.49.74 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml
121 salt-call reclass.cluster_meta_set tenant_address 192.168.0.102 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml
sgudzcced67d2017-10-11 15:56:09 +0300122 salt-call reclass.cluster_meta_set single_address 10.167.8.102 /srv/salt/reclass/nodes/_generated/cmp002.cookied-bm-mcp-ocata-contrail.local.yml
sgudz8c888ec2017-10-02 15:29:23 +0300123
124 node_name: {{ HOSTNAME_CFG01 }}
125 retry: {count: 1, delay: 10}
126 skip_fail: false
127
sgudzcced67d2017-10-11 15:56:09 +0300128
129- description: Temporary workaround for removing cinder-volume from CTL nodes
sgudz8c888ec2017-10-02 15:29:23 +0300130 cmd: |
sgudzcced67d2017-10-11 15:56:09 +0300131 sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
132 sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
133 node_name: {{ HOSTNAME_CFG01 }}
134 retry: {count: 1, delay: 5}
135 skip_fail: true
136
137- description: Temporary WR (Remove ASAP) for downgrade packages
138 cmd: |
139 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' state.sls linux.system.repo;
140 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get update"
141 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get install -y --allow-downgrades vlan";
sgudz8c888ec2017-10-02 15:29:23 +0300142 node_name: {{ HOSTNAME_CFG01 }}
143 retry: {count: 1, delay: 10}
sgudzcced67d2017-10-11 15:56:09 +0300144 skip_fail: true
sgudz8c888ec2017-10-02 15:29:23 +0300145
146{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
147
148########################################
149# Spin up Control Plane VMs on KVM nodes
150########################################
151
152- description: Execute 'libvirt' states to create necessary libvirt networks
153 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
154 node_name: {{ HOSTNAME_CFG01 }}
155 retry: {count: 2, delay: 10}
156 skip_fail: false
157
158- description: Create VMs for control plane
159 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
160 node_name: {{ HOSTNAME_CFG01 }}
161 retry: {count: 3, delay: 10}
162 skip_fail: false
163
164- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
165 cmd: |
166 salt-key -l acc| sort > /tmp/current_keys.txt &&
167 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
168 node_name: {{ HOSTNAME_CFG01 }}
169 retry: {count: 20, delay: 30}
170 skip_fail: false
171
172#########################################
173# Configure all running salt minion nodes
174#########################################
175
sgudzcced67d2017-10-11 15:56:09 +0300176- description: Hack resolv.conf on VCP nodes for internal services access
177 cmd: |
178 salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not kvm* and not cmp* and not gtw* and not cfg*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;"
179 salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not kvm* and not cmp* and not gtw* and not cfg*' cmd.run "echo 'nameserver 8.8.8.8' >> /etc/resolv.conf;"
180 node_name: {{ HOSTNAME_CFG01 }}
181 retry: {count: 1, delay: 5}
182 skip_fail: false
183
sgudz8c888ec2017-10-02 15:29:23 +0300184- description: Refresh pillars on all minions
185 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
186 node_name: {{ HOSTNAME_CFG01 }}
187 retry: {count: 1, delay: 5}
188 skip_fail: false
189
190- description: Sync all salt resources
191 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
192 node_name: {{ HOSTNAME_CFG01 }}
193 retry: {count: 1, delay: 5}
194 skip_fail: false
195
196- description: Show reclass-salt --top for generated nodes
197 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
198 node_name: {{ HOSTNAME_CFG01 }}
199 retry: {count: 1, delay: 5}
200 skip_fail: false
201
sgudzcced67d2017-10-11 15:56:09 +0300202- description: Temporary WR (Remove ASAP) for downgrade packages
203 cmd: |
204 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' state.sls linux.system.repo;
205 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get update"
206 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get install -y --allow-downgrades vlan";
207 node_name: {{ HOSTNAME_CFG01 }}
208 retry: {count: 1, delay: 10}
209 skip_fail: true
210
sgudz8c888ec2017-10-02 15:29:23 +0300211{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
212
sgudzcced67d2017-10-11 15:56:09 +0300213- description: (REMOVE asap) Hack VCPs of Hash sum mismatch
214 cmd: |
215 salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not kvm* and not cmp* and not gtw* and not cfg*' cmd.run "rm -rf /var/lib/apt/lists/*; apt-get clean; apt-get update -y;"
216 node_name: {{ HOSTNAME_CFG01 }}
217 retry: {count: 1, delay: 5}
218 skip_fail: true