blob: 381b780a238704648aff82361e7c5006107a8967 [file] [log] [blame]
Oleksii Butenko7d9671c2017-11-01 17:27:23 +02001{% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import HOSTNAME_CFG01 with context %}
2{% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import LAB_CONFIG_NAME with context %}
3{% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import DOMAIN_NAME with context %}
4{% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import HOSTNAME_KVM01 with context %}
5{% from 'cookied-bm-mcp-dvr-vxlan/underlay.yaml' import HOSTNAME_KVM02 with context %}
6{% from 'cookied-bm-mcp-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') %}
Oleksii Butenko7c48def2017-10-03 12:41:05 +03009
Oleksii Butenko7d9671c2017-11-01 17:27:23 +020010{% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME','cookied-bm-mcp-dvr-vxlan') %}
Oleksii Butenko7c48def2017-10-03 12:41:05 +030011
12{% import 'shared-salt.yaml' as SHARED with context %}
13
14{{ SHARED.MACRO_INSTALL_SALT_MASTER() }}
15
Oleksii Butenko336e4412018-05-21 14:59:27 +030016{{ SHARED.MACRO_CLONE_RECLASS_MODELS() }}
Oleksii Butenko7c48def2017-10-03 12:41:05 +030017
Vladimir Jigulinf557c562018-07-30 18:30:09 +040018{{ 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" "runtest" "auditd" "logrotate"') }}
Oleksii Butenko7c48def2017-10-03 12:41:05 +030019
20{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
21
22{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
23
Oleksii Butenko336e4412018-05-21 14:59:27 +030024- description: "WR for changing image to proposed"
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030025 cmd: |
26 set -e;
Oleksii Butenko336e4412018-05-21 14:59:27 +030027 apt-get -y install python-virtualenv python-pip build-essential python-dev libssl-dev;
28 [[ -d /root/venv-reclass-tools ]] || virtualenv /root/venv-reclass-tools;
29 . /root/venv-reclass-tools/bin/activate;
30 pip install git+https://github.com/dis-xcom/reclass-tools;
31 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-dvr-vxlan/infra/init.yml;
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030032 node_name: {{ HOSTNAME_CFG01 }}
Oleksii Butenko336e4412018-05-21 14:59:27 +030033 retry: {count: 1, delay: 10}
Dennis Dmitriev8c49ddc2017-10-21 14:31:50 +030034 skip_fail: false
Oleksii Butenko7c48def2017-10-03 12:41:05 +030035
Tatyana Leontovichfa388892018-08-13 13:27:25 +030036
Oleksii Butenko336e4412018-05-21 14:59:27 +030037{{ SHARED.MACRO_GENERATE_INVENTORY() }}
38{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
39
Oleksii Butenko9f2cf512017-12-19 14:03:41 +020040- description: Temporary workaround for removing cinder-volume from CTL nodes
41 cmd: |
42 sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
43 sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
44 node_name: {{ HOSTNAME_CFG01 }}
45 retry: {count: 1, delay: 5}
46 skip_fail: true
47
Tatyana Leontovichfa388892018-08-13 13:27:25 +030048- description: Temporary workaround for removing virtual gtw nodes
49 cmd: |
50 sed -i 's/\-\ system\.salt\.control\.sizes\.ovs\.compact//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
51 sed -i 's/\-\ system\.salt\.control\.placement\.ovs\.compact//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
52 node_name: {{ HOSTNAME_CFG01 }}
53 retry: {count: 1, delay: 5}
54 skip_fail: true
55
56- description: Rerun openssh after env model is generated
57 cmd: |
58 salt-call state.sls openssh
59 node_name: {{ HOSTNAME_CFG01 }}
60 retry: {count: 1, delay: 10}
61 skip_fail: false
62
Oleksii Butenko336e4412018-05-21 14:59:27 +030063{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
64
Oleksii Butenko7c48def2017-10-03 12:41:05 +030065########################################
66# Spin up Control Plane VMs on KVM nodes
67########################################
68
Oleksii Butenko336e4412018-05-21 14:59:27 +030069- description: Hack resolv.conf on nodes for internal services access
70 cmd: |
71 salt --hard-crash --state-output=mixed --state-verbose=False -C '*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;"
72 node_name: {{ HOSTNAME_CFG01 }}
73 retry: {count: 1, delay: 5}
74 skip_fail: false
75
Oleksii Butenko7c48def2017-10-03 12:41:05 +030076- description: Execute 'libvirt' states to create necessary libvirt networks
77 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
78 node_name: {{ HOSTNAME_CFG01 }}
79 retry: {count: 2, delay: 10}
80 skip_fail: false
81
Oleksii Butenko336e4412018-05-21 14:59:27 +030082- description: Temporary WR for correct bridge name according to envoronment templates
83 cmd: |
84 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
85 sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
86 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml;
87 salt '*' saltutil.refresh_pillar;
88 node_name: {{ HOSTNAME_CFG01 }}
89 retry: {count: 1, delay: 10}
90 skip_fail: false
91
Oleksii Butenko7c48def2017-10-03 12:41:05 +030092- description: Create VMs for control plane
93 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
94 node_name: {{ HOSTNAME_CFG01 }}
95 retry: {count: 3, delay: 10}
96 skip_fail: false
97
98- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
99 cmd: |
100 salt-key -l acc| sort > /tmp/current_keys.txt &&
101 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
102 node_name: {{ HOSTNAME_CFG01 }}
103 retry: {count: 20, delay: 30}
104 skip_fail: false
105
106#########################################
107# Configure all running salt minion nodes
108#########################################
109
110- description: Refresh pillars on all minions
111 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
112 node_name: {{ HOSTNAME_CFG01 }}
113 retry: {count: 1, delay: 5}
114 skip_fail: false
115
116- description: Sync all salt resources
117 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
118 node_name: {{ HOSTNAME_CFG01 }}
119 retry: {count: 1, delay: 5}
120 skip_fail: false
121
122- description: Show reclass-salt --top for generated nodes
123 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
124 node_name: {{ HOSTNAME_CFG01 }}
125 retry: {count: 1, delay: 5}
126 skip_fail: false
127
128{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
Tatyana Leontovich4453dd62018-06-26 18:44:31 +0300129
Oleksii Butenko336e4412018-05-21 14:59:27 +0300130- description: Add cpm nodes to /etc/hosts
131 cmd: |
132 salt --hard-crash --state-output=mixed --state-verbose=False -C '*' cmd.run "echo '10.167.4.105 cmp01.cookied-bm-mcp-dvr-vxlan.local cmp01' >> /etc/hosts";
133 salt --hard-crash --state-output=mixed --state-verbose=False -C '*' cmd.run "echo '10.167.4.106 cmp02.cookied-bm-mcp-dvr-vxlan.local cmp02' >> /etc/hosts";
134 node_name: {{ HOSTNAME_CFG01 }}
135 retry: {count: 1, delay: 10}
136 skip_fail: true
137
Tatyana Leontovich4453dd62018-06-26 18:44:31 +0300138{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
139
140{{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}}
Oleksii Butenko336e4412018-05-21 14:59:27 +0300141