blob: f3e121d5a34772dd11e4837b8876bcbe24894428 [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
sgudz8c888ec2017-10-02 15:29:23 +030066{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
67
sgudzcced67d2017-10-11 15:56:09 +030068- description: (REMOVE asap) Hack CFG of Hash sum mismatch
69 cmd: |
70 rm -rf /var/lib/apt/lists/*;
71 apt-get clean;
72 apt-get update;
73 node_name: {{ HOSTNAME_CFG01 }}
74 retry: {count: 1, delay: 5}
75 skip_fail: true
76
sgudz8c888ec2017-10-02 15:29:23 +030077{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
78
79- description: "Workaround for rack01 compute generator"
80 cmd: |
81 set -e;
82 # Remove rack01 key
Dennis Dmitrievd96ace12018-01-26 14:46:21 +020083 . /root/venv-reclass-tools/bin/activate;
sgudz8c888ec2017-10-02 15:29:23 +030084 reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml;
85 # Add openstack_compute_node definition from system
86 reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge;
87 # Set ipaddresses
sgudzcced67d2017-10-11 15:56:09 +030088# 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;
89# 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 +030090# 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;
91# 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;
92
93 node_name: {{ HOSTNAME_CFG01 }}
94 retry: {count: 1, delay: 10}
95 skip_fail: false
96
97{{ SHARED.MACRO_GENERATE_INVENTORY() }}
98
99{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
100
101
102- description: "Workaround for PROD-14060"
103 cmd: |
104 set -e;
105 # Add tenant and single addresses for computes
sgudzb3f5fe42018-02-06 17:06:53 +0200106 salt-call reclass.cluster_meta_set deploy_address 172.16.49.73 /srv/salt/reclass/nodes/_generated/cmp001.cookied-bm-mcp-ocata-contrail.local.yml
sgudz8c888ec2017-10-02 15:29:23 +0300107 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 +0300108 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 +0300109
110 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
111 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 +0300112 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 +0300113
114 node_name: {{ HOSTNAME_CFG01 }}
115 retry: {count: 1, delay: 10}
116 skip_fail: false
117
sgudzcced67d2017-10-11 15:56:09 +0300118
119- description: Temporary workaround for removing cinder-volume from CTL nodes
sgudz8c888ec2017-10-02 15:29:23 +0300120 cmd: |
sgudzcced67d2017-10-11 15:56:09 +0300121 sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
122 sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
123 node_name: {{ HOSTNAME_CFG01 }}
124 retry: {count: 1, delay: 5}
125 skip_fail: true
126
127- description: Temporary WR (Remove ASAP) for downgrade packages
128 cmd: |
129 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' state.sls linux.system.repo;
130 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get update"
131 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 +0300132 node_name: {{ HOSTNAME_CFG01 }}
133 retry: {count: 1, delay: 10}
sgudzcced67d2017-10-11 15:56:09 +0300134 skip_fail: true
sgudz8c888ec2017-10-02 15:29:23 +0300135
136{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
137
138########################################
139# Spin up Control Plane VMs on KVM nodes
140########################################
141
142- description: Execute 'libvirt' states to create necessary libvirt networks
143 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
144 node_name: {{ HOSTNAME_CFG01 }}
145 retry: {count: 2, delay: 10}
146 skip_fail: false
147
148- description: Create VMs for control plane
149 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
150 node_name: {{ HOSTNAME_CFG01 }}
151 retry: {count: 3, delay: 10}
152 skip_fail: false
153
154- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
155 cmd: |
156 salt-key -l acc| sort > /tmp/current_keys.txt &&
157 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
158 node_name: {{ HOSTNAME_CFG01 }}
159 retry: {count: 20, delay: 30}
160 skip_fail: false
161
162#########################################
163# Configure all running salt minion nodes
164#########################################
165
sgudzcced67d2017-10-11 15:56:09 +0300166- description: Hack resolv.conf on VCP nodes for internal services access
167 cmd: |
168 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;"
169 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;"
170 node_name: {{ HOSTNAME_CFG01 }}
171 retry: {count: 1, delay: 5}
172 skip_fail: false
173
sgudz8c888ec2017-10-02 15:29:23 +0300174- description: Refresh pillars on all minions
175 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
176 node_name: {{ HOSTNAME_CFG01 }}
177 retry: {count: 1, delay: 5}
178 skip_fail: false
179
180- description: Sync all salt resources
181 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
182 node_name: {{ HOSTNAME_CFG01 }}
183 retry: {count: 1, delay: 5}
184 skip_fail: false
185
186- description: Show reclass-salt --top for generated nodes
187 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
188 node_name: {{ HOSTNAME_CFG01 }}
189 retry: {count: 1, delay: 5}
190 skip_fail: false
191
sgudzcced67d2017-10-11 15:56:09 +0300192- description: Temporary WR (Remove ASAP) for downgrade packages
193 cmd: |
194 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' state.sls linux.system.repo;
195 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get update"
196 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get install -y --allow-downgrades vlan";
197 node_name: {{ HOSTNAME_CFG01 }}
198 retry: {count: 1, delay: 10}
199 skip_fail: true
200
sgudz8c888ec2017-10-02 15:29:23 +0300201{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
202
sgudzcced67d2017-10-11 15:56:09 +0300203- description: (REMOVE asap) Hack VCPs of Hash sum mismatch
204 cmd: |
205 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;"
206 node_name: {{ HOSTNAME_CFG01 }}
207 retry: {count: 1, delay: 5}
208 skip_fail: true