blob: 2bdd4ae80552e284ce66e6f36e3ba8124f97e648 [file] [log] [blame]
Dennis Dmitrievab83ea42017-05-12 16:52:45 +03001{% from 'virtual-mcp10-dvr/map.jinja' import HOSTNAME_CFG01 with context %}
Dennis Dmitriev5ec4d572017-09-27 00:47:54 +03002{% from 'virtual-mcp10-dvr/map.jinja' import LAB_CONFIG_NAME with context %}
3{% from 'virtual-mcp10-dvr/map.jinja' import DOMAIN_NAME with context %}
Tatyana Leontovich055b5062017-04-03 13:17:25 +03004
Sergii Golovatiuk50f91892017-08-04 18:11:06 +02005{% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %}
6# Other salt model repository parameters see in shared-salt.yaml
Tatyana Leontovich055b5062017-04-03 13:17:25 +03007
Sergii Golovatiuk50f91892017-08-04 18:11:06 +02008{% import 'shared-salt.yaml' as SHARED with context %}
9
10# Install salt to the config node
Tatyana Leontovich055b5062017-04-03 13:17:25 +030011
Tatyana Leontovich5fd6ed62017-04-04 15:08:29 +030012- description: Configure repository on the cfg01 node
13 cmd:
Tatyana Leontovich3c6aa452017-04-25 15:04:40 +030014 echo "nameserver 172.18.208.44" >> /etc/resolv.conf;
15 echo "nameserver 8.8.8.8" >> /etc/resolv.conf;
Tatyana Leontovich5fd6ed62017-04-04 15:08:29 +030016 which wget >/dev/null || (apt-get update; apt-get install -y wget);
obutenko89aedf82017-08-04 12:50:37 +030017 echo "deb [arch=amd64] http://apt.mirantis.com/xenial nightly salt extra" > /etc/apt/sources.list.d/mcp_salt.list;
18 wget -O - http://apt.mirantis.com/public.gpg | apt-key add -;
Tatyana Leontovich055b5062017-04-03 13:17:25 +030019 echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main" > /etc/apt/sources.list.d/saltstack.list;
20 wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub | apt-key add -;
Tatyana Leontovich055b5062017-04-03 13:17:25 +030021 node_name: {{ HOSTNAME_CFG01 }}
22 retry: {count: 1, delay: 1}
23 skip_fail: false
24
Tatyana Leontovich055b5062017-04-03 13:17:25 +030025- description: Update packages on cfg01
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030026 cmd: apt-get clean; apt-get update
Tatyana Leontovich055b5062017-04-03 13:17:25 +030027 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030028 retry: {count: 1, delay: 1}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030029 skip_fail: false
30
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030031- description: Install common packages on cfg01
32 cmd: apt-get install -y python-pip wget curl tmux byobu iputils-ping traceroute htop tree
33 node_name: {{ HOSTNAME_CFG01 }}
34 retry: {count: 1, delay: 1}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030035 skip_fail: false
36
Dennis Dmitriev492813e2017-08-09 15:08:58 +030037{{ SHARED.MACRO_INSTALL_SALT_MASTER() }}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030038
Dennis Dmitriev492813e2017-08-09 15:08:58 +030039{{ SHARED.MACRO_CLONE_RECLASS_MODELS() }}
Tatyana Leontovich30a9db12017-04-06 14:28:39 +030040
Dennis Dmitriev492813e2017-08-09 15:08:58 +030041{{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='"linux" "reclass" "salt" "openssh" "ntp" "git" "nginx" "collectd" "sensu" "heka" "sphinx" "keystone" "mysql" "grafana" "haproxy" "rsyslog" "horizon"') }}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030042
43- description: Configure salt-minion on cfg01
44 cmd: |
45 [ ! -d /etc/salt/minion.d ] && mkdir -p /etc/salt/minion.d;
46 cat << "EOF" >> /etc/salt/minion.d/minion.conf
47 id: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich5fd6ed62017-04-04 15:08:29 +030048 master: 127.0.0.1
Tatyana Leontovich055b5062017-04-03 13:17:25 +030049 EOF
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030050 apt-get install -y salt-minion;
Tatyana Leontovich055b5062017-04-03 13:17:25 +030051 node_name: {{ HOSTNAME_CFG01 }}
52 retry: {count: 1, delay: 1}
53 skip_fail: false
54
Tatyana Leontovich14f6a1a2017-04-04 17:30:58 +030055
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030056- description: Restart services
57 cmd: |
58 systemctl restart salt-master;
59 systemctl restart salt-minion;
60 echo "Showing system info and metadata ...";
61 salt-call --no-color grains.items;
62 salt-call --no-color pillar.data;
Tatyana Leontovich055b5062017-04-03 13:17:25 +030063 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich81128412017-04-05 18:46:29 +030064 retry: {count: 1, delay: 5}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030065 skip_fail: false
66
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030067
Dennis Dmitriev492813e2017-08-09 15:08:58 +030068{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030069
Dennis Dmitriev492813e2017-08-09 15:08:58 +030070{{ SHARED.MACRO_GENERATE_INVENTORY() }}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030071
Dennis Dmitriev492813e2017-08-09 15:08:58 +030072{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030073
Tatyana Leontovich4d0d8942017-04-06 19:10:56 +030074- description: Hack gtw node
75 cmd: salt 'gtw*' cmd.run "ip addr del 172.16.10.110/24 dev ens4; ip addr flush dev ens4";
76 node_name: {{ HOSTNAME_CFG01 }}
77 retry: {count: 1, delay: 10}
78 skip_fail: false
79
80- description: Hack cmp01 node
81 cmd: salt 'cmp01*' cmd.run "ip addr del 172.16.10.105/24 dev ens4; ip addr flush dev ens4";
82 node_name: {{ HOSTNAME_CFG01 }}
83 retry: {count: 1, delay: 10}
84 skip_fail: false
85
86- description: Hack cmp02 node
87 cmd: salt 'cmp02*' cmd.run "ip addr del 172.16.10.106/24 dev ens4; ip addr flush dev ens4";
88 node_name: {{ HOSTNAME_CFG01 }}
89 retry: {count: 1, delay: 10}
90 skip_fail: false
91