blob: efa6773be3970cdc1adff72e5627604a000ea0f3 [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
Dennis Dmitrievd96ace12018-01-26 14:46:21 +020094 . /root/venv-reclass-tools/bin/activate;
sgudz8c888ec2017-10-02 15:29:23 +030095 reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml;
96 # Add openstack_compute_node definition from system
97 reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge;
98 # Set ipaddresses
sgudzcced67d2017-10-11 15:56:09 +030099# 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;
100# 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 +0300101# 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;
102# 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;
103
104 node_name: {{ HOSTNAME_CFG01 }}
105 retry: {count: 1, delay: 10}
106 skip_fail: false
107
108{{ SHARED.MACRO_GENERATE_INVENTORY() }}
109
110{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
111
112
113- description: "Workaround for PROD-14060"
114 cmd: |
115 set -e;
116 # Add tenant and single addresses for computes
117 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
118 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 +0300119 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 +0300120
121 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
122 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 +0300123 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 +0300124
125 node_name: {{ HOSTNAME_CFG01 }}
126 retry: {count: 1, delay: 10}
127 skip_fail: false
128
sgudzcced67d2017-10-11 15:56:09 +0300129
130- description: Temporary workaround for removing cinder-volume from CTL nodes
sgudz8c888ec2017-10-02 15:29:23 +0300131 cmd: |
sgudzcced67d2017-10-11 15:56:09 +0300132 sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
133 sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
134 node_name: {{ HOSTNAME_CFG01 }}
135 retry: {count: 1, delay: 5}
136 skip_fail: true
137
138- description: Temporary WR (Remove ASAP) for downgrade packages
139 cmd: |
140 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' state.sls linux.system.repo;
141 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get update"
142 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 +0300143 node_name: {{ HOSTNAME_CFG01 }}
144 retry: {count: 1, delay: 10}
sgudzcced67d2017-10-11 15:56:09 +0300145 skip_fail: true
sgudz8c888ec2017-10-02 15:29:23 +0300146
147{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
148
149########################################
150# Spin up Control Plane VMs on KVM nodes
151########################################
152
153- description: Execute 'libvirt' states to create necessary libvirt networks
154 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
155 node_name: {{ HOSTNAME_CFG01 }}
156 retry: {count: 2, delay: 10}
157 skip_fail: false
158
159- description: Create VMs for control plane
160 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
161 node_name: {{ HOSTNAME_CFG01 }}
162 retry: {count: 3, delay: 10}
163 skip_fail: false
164
165- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
166 cmd: |
167 salt-key -l acc| sort > /tmp/current_keys.txt &&
168 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
169 node_name: {{ HOSTNAME_CFG01 }}
170 retry: {count: 20, delay: 30}
171 skip_fail: false
172
173#########################################
174# Configure all running salt minion nodes
175#########################################
176
sgudzcced67d2017-10-11 15:56:09 +0300177- description: Hack resolv.conf on VCP nodes for internal services access
178 cmd: |
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 172.18.208.44' > /etc/resolv.conf;"
180 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;"
181 node_name: {{ HOSTNAME_CFG01 }}
182 retry: {count: 1, delay: 5}
183 skip_fail: false
184
sgudz8c888ec2017-10-02 15:29:23 +0300185- description: Refresh pillars on all minions
186 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
187 node_name: {{ HOSTNAME_CFG01 }}
188 retry: {count: 1, delay: 5}
189 skip_fail: false
190
191- description: Sync all salt resources
192 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
193 node_name: {{ HOSTNAME_CFG01 }}
194 retry: {count: 1, delay: 5}
195 skip_fail: false
196
197- description: Show reclass-salt --top for generated nodes
198 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
199 node_name: {{ HOSTNAME_CFG01 }}
200 retry: {count: 1, delay: 5}
201 skip_fail: false
202
sgudzcced67d2017-10-11 15:56:09 +0300203- description: Temporary WR (Remove ASAP) for downgrade packages
204 cmd: |
205 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' state.sls linux.system.repo;
206 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get update"
207 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' cmd.run "apt-get install -y --allow-downgrades vlan";
208 node_name: {{ HOSTNAME_CFG01 }}
209 retry: {count: 1, delay: 10}
210 skip_fail: true
211
sgudz8c888ec2017-10-02 15:29:23 +0300212{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
213
sgudzcced67d2017-10-11 15:56:09 +0300214- description: (REMOVE asap) Hack VCPs of Hash sum mismatch
215 cmd: |
216 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;"
217 node_name: {{ HOSTNAME_CFG01 }}
218 retry: {count: 1, delay: 5}
219 skip_fail: true