Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 1 | ============== |
| 2 | Deploy scripts |
| 3 | ============== |
| 4 | |
| 5 | This ``deploy/scripts`` serve as shared common place to link any deployment tools. |
| 6 | |
| 7 | |
| 8 | **bootstrap-salt.sh** |
| 9 | **bootstrap-salt.ps1** |
| 10 | |
| 11 | Salt bootstrap scripts. Local copy of upstream `https://bootstrap.saltstack.com/`_. |
| 12 | |
Petr Michalec | c7dabcf | 2017-08-30 16:30:13 +0200 | [diff] [blame] | 13 | **bootstrap.sh** |
Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 14 | |
Petr Michalec | c7dabcf | 2017-08-30 16:30:13 +0200 | [diff] [blame] | 15 | Script 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 Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 19 | |
Petr Michalec | c7dabcf | 2017-08-30 16:30:13 +0200 | [diff] [blame] | 20 | TL;DR: |
Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 21 | |
Petr Michalec | d0cebae | 2017-08-31 12:40:42 +0200 | [diff] [blame] | 22 | Bootstrap 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 | |
| 34 | Bootstrap salt-master: |
| 35 | |
Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 36 | .. code-block:: bash |
| 37 | |
| 38 | cd /srv/salt/scripts |
Ondrej Smola | b9f8a85 | 2017-09-18 19:43:51 +0200 | [diff] [blame] | 39 | CLUSTER_NAME=regionOne HOSTNAME=cfg01 DOMAIN=infra.ci.local ./bootstrap.sh |
Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 40 | |
| 41 | .. note: |
Petr Michalec | 4c98182 | 2017-08-30 16:47:08 +0200 | [diff] [blame] | 42 | Creates /srv/salt/scripts/.salt-master-setup.sh.passed if succesfully passed the "setup script" |
| 43 | with the aim to avoid subsequent setup. |
Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 44 | |
| 45 | |
Petr Michalec | c7dabcf | 2017-08-30 16:30:13 +0200 | [diff] [blame] | 46 | **salt-master-setup.sh** (DEPRECATED, use bootstrap.sh instead) |
| 47 | |
| 48 | Script to install and configure salt *minion* but mostly *salt master* with *salt-formulas* common prerequisites in mind. |
| 49 | Configuration driven by environment variables, see source for more details... |
| 50 | |
| 51 | |
| 52 | **salt-master-init.sh** (DEPRECATED, use bootstrap.sh instead) |
| 53 | |
| 54 | Script to bootstrap *salt master* and verify the model. To install salt master uses ``salt-master-setup.sh``. |
| 55 | Configuration driven by environment variables. |
| 56 | |
| 57 | |
Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 58 | **formula-fetch.sh** |
| 59 | |
| 60 | Script to install formulas with dependencies. |
| 61 | |
| 62 | |
| 63 | **salt-state-apply-trend.sh** |
| 64 | |
| 65 | Simple 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 | |
| 69 | Bootstrap the Salt Master node |
| 70 | ============================== |
| 71 | (expects salt-formulas reclass model repo) |
| 72 | |
| 73 | .. code-block:: bash |
| 74 | |
Petr Michalec | 4a11f9d | 2017-08-08 14:15:56 +0200 | [diff] [blame] | 75 | git clone https://github.com/salt-formulas/salt-formulas-scripts /srv/salt/scripts |
Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 76 | |
| 77 | git clone <model-repository> /srv/salt/reclass |
Petr Michalec | c7dabcf | 2017-08-30 16:30:13 +0200 | [diff] [blame] | 78 | cd /srv/salt/reclass |
Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 79 | git submodule update --init --recursive |
Petr Michalec | c7dabcf | 2017-08-30 16:30:13 +0200 | [diff] [blame] | 80 | |
| 81 | # OR (if system level is not add yet) |
Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 82 | git submodule add https://github.com/Mirantis/reclass-system-salt-model \ |
| 83 | /srv/salt/reclass/classes/system/ |
| 84 | |
| 85 | cd /srv/salt/scripts |
Petr Michalec | d0cebae | 2017-08-31 12:40:42 +0200 | [diff] [blame] | 86 | HOSTNAME=cfg01 DOMAIN=infra.ci.local ./bootstrap.sh |
Petr Michalec | c7dabcf | 2017-08-30 16:30:13 +0200 | [diff] [blame] | 87 | |
| 88 | |
Petr Michalec | 4c98182 | 2017-08-30 16:47:08 +0200 | [diff] [blame] | 89 | Verify |
| 90 | ------ |
| 91 | Get 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 Michalec | d0cebae | 2017-08-31 12:40:42 +0200 | [diff] [blame] | 96 | HOSTNAME=cfg01 DOMAIN=infra.ci.local ./verify.sh # or just ./verify.sh |
| 97 | |
Petr Michalec | c7dabcf | 2017-08-30 16:30:13 +0200 | [diff] [blame] | 98 | |
Petr Michalec | d0cebae | 2017-08-31 12:40:42 +0200 | [diff] [blame] | 99 | # individuall minions, if minions get generated under nodes/_generated |
Petr Michalec | 4c98182 | 2017-08-30 16:47:08 +0200 | [diff] [blame] | 100 | ./verify.sh ctl01.k8s-cis-virtual.local |
| 101 | |
| 102 | |
| 103 | Additional bootstrap ENV variables |
| 104 | ---------------------------------- |
| 105 | (for full list of options see the *bootstrap.sh* source) |
| 106 | |
| 107 | .. code-block:: bash |
Petr Michalec | c7dabcf | 2017-08-30 16:30:13 +0200 | [diff] [blame] | 108 | |
| 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 Michalec | d0cebae | 2017-08-31 12:40:42 +0200 | [diff] [blame] | 119 | # Following variables are calculated from the above if not provided |
Petr Michalec | c7dabcf | 2017-08-30 16:30:13 +0200 | [diff] [blame] | 120 | #export MINION_ID |
Petr Michalec | d0cebae | 2017-08-31 12:40:42 +0200 | [diff] [blame] | 121 | #export MASTER_HOSTNAME |
| 122 | #export MASTER_IP |
Petr Michalec | c7dabcf | 2017-08-30 16:30:13 +0200 | [diff] [blame] | 123 | |
| 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 Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 142 | |
| 143 | |