blob: b2292d2d84c040e24e3555a106b438416df9a14a [file] [log] [blame]
Ales Komarek1b373112017-08-08 08:48:56 +02001==============
2Deploy scripts
3==============
4
5This ``deploy/scripts`` serve as shared common place to link any deployment tools.
6
7
8**bootstrap-salt.sh**
9**bootstrap-salt.ps1**
10
11Salt bootstrap scripts. Local copy of upstream `https://bootstrap.saltstack.com/`_.
12
Petr Michalecc7dabcf2017-08-30 16:30:13 +020013**bootstrap.sh**
Ales Komarek1b373112017-08-08 08:48:56 +020014
Petr Michalecc7dabcf2017-08-30 16:30:13 +020015Script with function library to
16* install and configure *salt master* and *minions*
17* bootstrap *salt master* with *salt-formulas* common prerequisites in mind
18* validate reclass the model / pillar for all nodes
Ales Komarek1b373112017-08-08 08:48:56 +020019
Petr Michalecc7dabcf2017-08-30 16:30:13 +020020TL;DR:
Ales Komarek1b373112017-08-08 08:48:56 +020021
Petr Michalecd0cebae2017-08-31 12:40:42 +020022Bootstrap salt-minion:
23
24.. code-block:: bash
25
26 export HTTPS_PROXY="http://proxy.your.corp:8080"; export HTTP_PROXY=$HTTPS_PROXY
27
28 export MASTER_HOSTNAME=cfg01.infra.ci.local || export MASTER_IP=10.0.0.10
29 export MINION_ID=$(hostname -f) || export HOSTNAME=prx01 DOMAIN=infra.ci.local
30 source <(curl -qL https://raw.githubusercontent.com/salt-formulas/salt-formulas-scripts/master/bootstrap.sh)
31 install_salt_minion_pkg
32
33
34Bootstrap salt-master:
35
Ales Komarek1b373112017-08-08 08:48:56 +020036.. code-block:: bash
37
38 cd /srv/salt/scripts
Petr Michalecd0cebae2017-08-31 12:40:42 +020039 HOSTNAME=cfg01 DOMAIN=infra.ci.local ./bootstrap.sh
Ales Komarek1b373112017-08-08 08:48:56 +020040
41.. note:
Petr Michalec4c981822017-08-30 16:47:08 +020042 Creates /srv/salt/scripts/.salt-master-setup.sh.passed if succesfully passed the "setup script"
43 with the aim to avoid subsequent setup.
Ales Komarek1b373112017-08-08 08:48:56 +020044
45
Petr Michalecc7dabcf2017-08-30 16:30:13 +020046**salt-master-setup.sh** (DEPRECATED, use bootstrap.sh instead)
47
48Script to install and configure salt *minion* but mostly *salt master* with *salt-formulas* common prerequisites in mind.
49Configuration driven by environment variables, see source for more details...
50
51
52**salt-master-init.sh** (DEPRECATED, use bootstrap.sh instead)
53
54Script to bootstrap *salt master* and verify the model. To install salt master uses ``salt-master-setup.sh``.
55Configuration driven by environment variables.
56
57
Ales Komarek1b373112017-08-08 08:48:56 +020058**formula-fetch.sh**
59
60Script to install formulas with dependencies.
61
62
63**salt-state-apply-trend.sh**
64
65Simple script to invoking highstate on whole infrastructure with ``test=true``. Json output is aggregated with `jq`
66(Failed/Success/Changes/Errors) and compared with previous run.
67
68
69Bootstrap the Salt Master node
70==============================
71(expects salt-formulas reclass model repo)
72
73.. code-block:: bash
74
Petr Michalec4a11f9d2017-08-08 14:15:56 +020075 git clone https://github.com/salt-formulas/salt-formulas-scripts /srv/salt/scripts
Ales Komarek1b373112017-08-08 08:48:56 +020076
77 git clone <model-repository> /srv/salt/reclass
Petr Michalecc7dabcf2017-08-30 16:30:13 +020078 cd /srv/salt/reclass
Ales Komarek1b373112017-08-08 08:48:56 +020079 git submodule update --init --recursive
Petr Michalecc7dabcf2017-08-30 16:30:13 +020080
81 # OR (if system level is not add yet)
Ales Komarek1b373112017-08-08 08:48:56 +020082 git submodule add https://github.com/Mirantis/reclass-system-salt-model \
83 /srv/salt/reclass/classes/system/
84
85 cd /srv/salt/scripts
Petr Michalecd0cebae2017-08-31 12:40:42 +020086 HOSTNAME=cfg01 DOMAIN=infra.ci.local ./bootstrap.sh
Petr Michalecc7dabcf2017-08-30 16:30:13 +020087
88
Petr Michalec4c981822017-08-30 16:47:08 +020089Verify
90------
91Get the *verify.sh* script from https://github.com/salt-formulas/salt-formulas/tree/master/deploy/model
92
93.. code-block:: bash
94
95 cd /srv/salt/reclass
Petr Michalecd0cebae2017-08-31 12:40:42 +020096 HOSTNAME=cfg01 DOMAIN=infra.ci.local ./verify.sh # or just ./verify.sh
97
Petr Michalecc7dabcf2017-08-30 16:30:13 +020098
Petr Michalecd0cebae2017-08-31 12:40:42 +020099 # individuall minions, if minions get generated under nodes/_generated
Petr Michalec4c981822017-08-30 16:47:08 +0200100 ./verify.sh ctl01.k8s-cis-virtual.local
101
102
103Additional bootstrap ENV variables
104----------------------------------
105(for full list of options see the *bootstrap.sh* source)
106
107.. code-block:: bash
Petr Michalecc7dabcf2017-08-30 16:30:13 +0200108
109 # reclass
110 export RECLASS_ADDRESS=<repo url> ## if not already cloned in /srv/salt/reclass >
111
112 # formula
113 export FORMULAS_BRANCH=master
114 export FORMULAS_SOURCE=git
115
116 # system / host / salt master minion id
117 export HOSTNAME=cfg01
118 export DOMAIN=infra.ci.local
Petr Michalecd0cebae2017-08-31 12:40:42 +0200119 # Following variables are calculated from the above if not provided
Petr Michalecc7dabcf2017-08-30 16:30:13 +0200120 #export MINION_ID
Petr Michalecd0cebae2017-08-31 12:40:42 +0200121 #export MASTER_HOSTNAME
122 #export MASTER_IP
Petr Michalecc7dabcf2017-08-30 16:30:13 +0200123
124 # salt
125 export BOOTSTRAP_SALTSTACK_OPTS=" -dX stable 2016.3"
126 export EXTRA_FORMULAS="prometeus"
127 SALT_SOURCE=${SALT_SOURCE:-pkg}
128 SALT_VERSION=${SALT_VERSION:-latest}
129
130 # bootstrap
131 export SALT_MASTER_BOOTSTRAP_MINIMIZED=False
132 export CLUSTER_NAME=<%= cluster %>
133
134 # workarounds
135 export RECLASS_IGNORE_CLASS_NOTFOUND=False
136 export EXTRA_FORMULAS="prometheus telegraph"
137
138
139
140
141
Ales Komarek1b373112017-08-08 08:48:56 +0200142
143