blob: 25c6087fc0539a28f12693f1943e156c7f1f8d49 [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
sgudz868f0862018-03-16 21:47:18 +020014{%- set CLUSTER_CONTEXT_NAME = 'salt-context-cookiecutter-contrail.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
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
Dennis Dmitrieva5978eb2018-02-21 10:12:33 +020028{{ 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"') }}
sgudz8c888ec2017-10-02 15:29:23 +030029
sgudz8c888ec2017-10-02 15:29:23 +030030{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
31
32{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
33
Dennis Dmitriev257a9382018-02-15 04:00:46 +020034{{ SHARED.ADJUST_SL_OPTS(OVERRIDES_FILENAME='/srv/salt/reclass/classes/environment/' + ENVIRONMENT_MODEL_INVENTORY_NAME + '/overrides.yml') }}
35
sgudz8c888ec2017-10-02 15:29:23 +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;
sgudz8c888ec2017-10-02 15:29:23 +030041 reclass-tools del-key parameters.reclass.storage.node.openstack_compute_rack01 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml;
42 # Add openstack_compute_node definition from system
43 reclass-tools add-key 'classes' 'system.reclass.storage.system.openstack_compute_multi' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/config.yml --merge;
sgudz868f0862018-03-16 21:47:18 +020044 node_name: {{ HOSTNAME_CFG01 }}
45 retry: {count: 1, delay: 10}
46 skip_fail: false
sgudz8c888ec2017-10-02 15:29:23 +030047
sgudz868f0862018-03-16 21:47:18 +020048- description: "WR for changing image to proposed"
49 cmd: |
50 set -e;
51 # Add message_queu host for opencontrail
52 . /root/venv-reclass-tools/bin/activate;
53 reclass-tools add-key parameters._param.salt_control_xenial_image 'http://ci.mcp.mirantis.net:8085/images/ubuntu-16-04-x64-mcpproposed.qcow2' /srv/salt/reclass/classes/cluster/cookied-bm-mcp-ocata-contrail/infra/init.yml;
54 reclass-tools add-key parameters._param.salt_control_trusty_image 'http://ci.mcp.mirantis.net:8085/images/ubuntu-14-04-x64-mcpproposed.qcow2' /srv/salt/reclass/classes/cluster/cookied-bm-mcp-ocata-contrail/infra/init.yml;
sgudz8c888ec2017-10-02 15:29:23 +030055 node_name: {{ HOSTNAME_CFG01 }}
56 retry: {count: 1, delay: 10}
57 skip_fail: false
58
59{{ SHARED.MACRO_GENERATE_INVENTORY() }}
60
61{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
62
63
64- description: "Workaround for PROD-14060"
65 cmd: |
66 set -e;
67 # Add tenant and single addresses for computes
sgudzb3f5fe42018-02-06 17:06:53 +020068 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 +030069 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 +030070 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 +030071
72 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
73 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 +030074 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 +030075
76 node_name: {{ HOSTNAME_CFG01 }}
77 retry: {count: 1, delay: 10}
78 skip_fail: false
79
sgudzcced67d2017-10-11 15:56:09 +030080
81- description: Temporary workaround for removing cinder-volume from CTL nodes
sgudz8c888ec2017-10-02 15:29:23 +030082 cmd: |
sgudzcced67d2017-10-11 15:56:09 +030083 sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
84 sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
85 node_name: {{ HOSTNAME_CFG01 }}
86 retry: {count: 1, delay: 5}
87 skip_fail: true
88
sgudz868f0862018-03-16 21:47:18 +020089- description: Temporary WR for correct bridge name according to envoronment templates
sgudzcced67d2017-10-11 15:56:09 +030090 cmd: |
sgudz868f0862018-03-16 21:47:18 +020091 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
92 sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
sgudz8c888ec2017-10-02 15:29:23 +030093 node_name: {{ HOSTNAME_CFG01 }}
94 retry: {count: 1, delay: 10}
sgudz868f0862018-03-16 21:47:18 +020095 skip_fail: false
96
sgudz8c888ec2017-10-02 15:29:23 +030097{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
98
99########################################
100# Spin up Control Plane VMs on KVM nodes
101########################################
102
103- description: Execute 'libvirt' states to create necessary libvirt networks
104 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 2, delay: 10}
107 skip_fail: false
108
109- description: Create VMs for control plane
110 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
111 node_name: {{ HOSTNAME_CFG01 }}
112 retry: {count: 3, delay: 10}
113 skip_fail: false
114
115- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
116 cmd: |
117 salt-key -l acc| sort > /tmp/current_keys.txt &&
118 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
119 node_name: {{ HOSTNAME_CFG01 }}
120 retry: {count: 20, delay: 30}
121 skip_fail: false
122
123#########################################
124# Configure all running salt minion nodes
125#########################################
126
sgudzcced67d2017-10-11 15:56:09 +0300127- description: Hack resolv.conf on VCP nodes for internal services access
128 cmd: |
129 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;"
sgudzcced67d2017-10-11 15:56:09 +0300130 node_name: {{ HOSTNAME_CFG01 }}
131 retry: {count: 1, delay: 5}
132 skip_fail: false
133
sgudz8c888ec2017-10-02 15:29:23 +0300134- description: Refresh pillars on all minions
135 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
136 node_name: {{ HOSTNAME_CFG01 }}
137 retry: {count: 1, delay: 5}
138 skip_fail: false
139
140- description: Sync all salt resources
141 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
142 node_name: {{ HOSTNAME_CFG01 }}
143 retry: {count: 1, delay: 5}
144 skip_fail: false
145
146- description: Show reclass-salt --top for generated nodes
147 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
148 node_name: {{ HOSTNAME_CFG01 }}
149 retry: {count: 1, delay: 5}
150 skip_fail: false
151
152{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}