blob: b404c933238734dcdd3144600a713026eb8858e2 [file] [log] [blame]
Dennis Dmitrievab83ea42017-05-12 16:52:45 +03001{% from 'virtual-mcp10-ovs/map.jinja' import HOSTNAME_CFG01 with context %}
Tatyana Leontovich055b5062017-04-03 13:17:25 +03002
Sergii Golovatiuk50f91892017-08-04 18:11:06 +02003{% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %}
4# Other salt model repository parameters see in shared-salt.yaml
Tatyana Leontovich055b5062017-04-03 13:17:25 +03005
Sergii Golovatiuk50f91892017-08-04 18:11:06 +02006{% import 'shared-salt.yaml' as SHARED with context %}
7
8# Install salt to the config node
Tatyana Leontovich055b5062017-04-03 13:17:25 +03009
Tatyana Leontovich5fd6ed62017-04-04 15:08:29 +030010- description: Configure repository on the cfg01 node
11 cmd:
Tatyana Leontovich3c6aa452017-04-25 15:04:40 +030012 echo "nameserver 172.18.208.44" >> /etc/resolv.conf;
13 echo "nameserver 8.8.8.8" >> /etc/resolv.conf;
Tatyana Leontovich5fd6ed62017-04-04 15:08:29 +030014 which wget >/dev/null || (apt-get update; apt-get install -y wget);
obutenko89aedf82017-08-04 12:50:37 +030015 echo "deb [arch=amd64] http://apt.mirantis.com/xenial nightly salt extra" > /etc/apt/sources.list.d/mcp_salt.list;
16 wget -O - http://apt.mirantis.com/public.gpg | apt-key add -;
Tatyana Leontovich055b5062017-04-03 13:17:25 +030017 echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main" > /etc/apt/sources.list.d/saltstack.list;
18 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 +030019 node_name: {{ HOSTNAME_CFG01 }}
20 retry: {count: 1, delay: 1}
21 skip_fail: false
22
Tatyana Leontovich055b5062017-04-03 13:17:25 +030023- description: Update packages on cfg01
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030024 cmd: apt-get clean; apt-get update
Tatyana Leontovich055b5062017-04-03 13:17:25 +030025 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030026 retry: {count: 1, delay: 1}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030027 skip_fail: false
28
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030029- description: Install common packages on cfg01
30 cmd: apt-get install -y python-pip wget curl tmux byobu iputils-ping traceroute htop tree
31 node_name: {{ HOSTNAME_CFG01 }}
32 retry: {count: 1, delay: 1}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030033 skip_fail: false
34
Dennis Dmitriev492813e2017-08-09 15:08:58 +030035{{ SHARED.MACRO_INSTALL_SALT_MASTER() }}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030036
Dennis Dmitriev492813e2017-08-09 15:08:58 +030037{{ SHARED.MACRO_CLONE_RECLASS_MODELS() }}
Tatyana Leontovich30a9db12017-04-06 14:28:39 +030038
Dennis Dmitriev492813e2017-08-09 15:08:58 +030039{{ 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 +030040
41- description: Configure salt-minion on cfg01
42 cmd: |
43 [ ! -d /etc/salt/minion.d ] && mkdir -p /etc/salt/minion.d;
44 cat << "EOF" >> /etc/salt/minion.d/minion.conf
45 id: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich5fd6ed62017-04-04 15:08:29 +030046 master: 127.0.0.1
Tatyana Leontovich055b5062017-04-03 13:17:25 +030047 EOF
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030048 apt-get install -y salt-minion;
Tatyana Leontovich055b5062017-04-03 13:17:25 +030049 node_name: {{ HOSTNAME_CFG01 }}
50 retry: {count: 1, delay: 1}
51 skip_fail: false
52
Tatyana Leontovich14f6a1a2017-04-04 17:30:58 +030053
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030054- description: Restart services
55 cmd: |
56 systemctl restart salt-master;
57 systemctl restart salt-minion;
58 echo "Showing system info and metadata ...";
59 salt-call --no-color grains.items;
60 salt-call --no-color pillar.data;
Tatyana Leontovich055b5062017-04-03 13:17:25 +030061 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich81128412017-04-05 18:46:29 +030062 retry: {count: 1, delay: 5}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030063 skip_fail: false
64
Dennis Dmitriev492813e2017-08-09 15:08:58 +030065{{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
Tatyana Leontovich2dde4aa2017-04-04 13:06:10 +030066
Dennis Dmitriev492813e2017-08-09 15:08:58 +030067{{ SHARED.MACRO_GENERATE_INVENTORY() }}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030068
Dennis Dmitriev492813e2017-08-09 15:08:58 +030069{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
Tatyana Leontovich055b5062017-04-03 13:17:25 +030070
Tatyana Leontovich4d0d8942017-04-06 19:10:56 +030071- description: Hack gtw node
72 cmd: salt 'gtw*' cmd.run "ip addr del 172.16.10.110/24 dev ens4; ip addr flush dev ens4";
73 node_name: {{ HOSTNAME_CFG01 }}
74 retry: {count: 1, delay: 10}
75 skip_fail: false
76
77- description: Hack cmp01 node
78 cmd: salt 'cmp01*' cmd.run "ip addr del 172.16.10.105/24 dev ens4; ip addr flush dev ens4";
79 node_name: {{ HOSTNAME_CFG01 }}
80 retry: {count: 1, delay: 10}
81 skip_fail: false
82
83- description: Hack cmp02 node
84 cmd: salt 'cmp02*' cmd.run "ip addr del 172.16.10.106/24 dev ens4; ip addr flush dev ens4";
85 node_name: {{ HOSTNAME_CFG01 }}
86 retry: {count: 1, delay: 10}
87 skip_fail: false
88