blob: 599c6a8f5df5ed68e8532757867d762ec3b201cd [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
Oleksii Butenko336e4412018-05-21 14:59:27 +030036{{ SHARED.MACRO_GENERATE_INVENTORY() }}
37{{ SHARED.MACRO_NETWORKING_WORKAROUNDS() }}
38
Oleksii Butenko9f2cf512017-12-19 14:03:41 +020039- description: Temporary workaround for removing cinder-volume from CTL nodes
40 cmd: |
41 sed -i 's/\-\ system\.cinder\.volume\.single//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
42 sed -i 's/\-\ system\.cinder\.volume\.notification\.messagingv2//g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml;
43 node_name: {{ HOSTNAME_CFG01 }}
44 retry: {count: 1, delay: 5}
45 skip_fail: true
46
Oleksii Butenko336e4412018-05-21 14:59:27 +030047{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
48
Oleksii Butenko7c48def2017-10-03 12:41:05 +030049########################################
50# Spin up Control Plane VMs on KVM nodes
51########################################
52
Oleksii Butenko336e4412018-05-21 14:59:27 +030053- description: Hack resolv.conf on nodes for internal services access
54 cmd: |
55 salt --hard-crash --state-output=mixed --state-verbose=False -C '*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;"
56 node_name: {{ HOSTNAME_CFG01 }}
57 retry: {count: 1, delay: 5}
58 skip_fail: false
59
Oleksii Butenko7c48def2017-10-03 12:41:05 +030060- description: Execute 'libvirt' states to create necessary libvirt networks
61 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls libvirt
62 node_name: {{ HOSTNAME_CFG01 }}
63 retry: {count: 2, delay: 10}
64 skip_fail: false
65
Oleksii Butenko336e4412018-05-21 14:59:27 +030066- description: Temporary WR for correct bridge name according to envoronment templates
67 cmd: |
68 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
69 sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
70 sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml;
71 salt '*' saltutil.refresh_pillar;
72 node_name: {{ HOSTNAME_CFG01 }}
73 retry: {count: 1, delay: 10}
74 skip_fail: false
75
Oleksii Butenko7c48def2017-10-03 12:41:05 +030076- description: Create VMs for control plane
77 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'kvm*' state.sls salt.control
78 node_name: {{ HOSTNAME_CFG01 }}
79 retry: {count: 3, delay: 10}
80 skip_fail: false
81
82- description: '*Workaround* for waiting the control-plane VMs in the salt-key (instead of sleep)'
83 cmd: |
84 salt-key -l acc| sort > /tmp/current_keys.txt &&
85 salt 'kvm*' cmd.run 'virsh list --name' | grep -v 'kvm'|sort|xargs -I {} fgrep {} /tmp/current_keys.txt
86 node_name: {{ HOSTNAME_CFG01 }}
87 retry: {count: 20, delay: 30}
88 skip_fail: false
89
90#########################################
91# Configure all running salt minion nodes
92#########################################
93
94- description: Refresh pillars on all minions
95 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
96 node_name: {{ HOSTNAME_CFG01 }}
97 retry: {count: 1, delay: 5}
98 skip_fail: false
99
100- description: Sync all salt resources
101 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
102 node_name: {{ HOSTNAME_CFG01 }}
103 retry: {count: 1, delay: 5}
104 skip_fail: false
105
106- description: Show reclass-salt --top for generated nodes
107 cmd: reclass-salt --top -u /srv/salt/reclass/nodes/_generated/
108 node_name: {{ HOSTNAME_CFG01 }}
109 retry: {count: 1, delay: 5}
110 skip_fail: false
111
112{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
Tatyana Leontovich4453dd62018-06-26 18:44:31 +0300113
Oleksii Butenko336e4412018-05-21 14:59:27 +0300114- description: Add cpm nodes to /etc/hosts
115 cmd: |
116 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";
117 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";
118 node_name: {{ HOSTNAME_CFG01 }}
119 retry: {count: 1, delay: 10}
120 skip_fail: true
121
Tatyana Leontovich4453dd62018-06-26 18:44:31 +0300122{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
123
124{{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}}
Oleksii Butenko336e4412018-05-21 14:59:27 +0300125