Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1 | |
| 2 | ==== |
| 3 | Salt |
| 4 | ==== |
| 5 | |
| 6 | Salt is a new approach to infrastructure management. Easy enough to get running in minutes, scalable enough to manage tens of thousands of servers, and fast enough to communicate with them in seconds. |
| 7 | |
| 8 | Salt delivers a dynamic communication bus for infrastructures that can be used for orchestration, remote execution, configuration management and much more. |
| 9 | |
| 10 | Sample pillars |
| 11 | ============== |
| 12 | |
| 13 | Salt master |
| 14 | ----------- |
| 15 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 16 | Salt master with base production environment and pillar tree as metadata backend |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 17 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 18 | .. literalinclude:: tests/pillar/master_single_pillar.sls |
| 19 | :language: yaml |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 20 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 21 | Salt master with reclass ENC as metadata backend |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 22 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 23 | .. literalinclude:: tests/pillar/master_single_reclass.sls |
| 24 | :language: yaml |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 25 | |
| 26 | Salt master with API |
| 27 | |
| 28 | .. code-block:: yaml |
| 29 | |
| 30 | salt: |
| 31 | master: |
| 32 | ... |
| 33 | api: |
| 34 | enabled: true |
| 35 | port: 8000 |
| 36 | |
| 37 | Salt master with preset minions |
| 38 | |
| 39 | .. code-block:: yaml |
| 40 | |
| 41 | salt: |
| 42 | master: |
| 43 | enabled: true |
| 44 | ... |
| 45 | minions: |
| 46 | - name: 'node1.system.location.domain.com' |
| 47 | |
Adam Tengler | caedd97 | 2016-05-04 16:44:00 +0200 | [diff] [blame] | 48 | Salt master with alternative installation source and version (optional) - pip |
| 49 | |
| 50 | .. code-block:: yaml |
| 51 | |
| 52 | salt: |
| 53 | master: |
| 54 | enabled: true |
| 55 | ... |
| 56 | source: |
| 57 | engine: pip |
| 58 | version: 2016.3.0rc2 |
| 59 | |
Adam Tengler | 3eb85ad | 2016-05-06 02:52:40 +0200 | [diff] [blame^] | 60 | Salt master with specified formula to install through apt-get |
| 61 | |
| 62 | .. code-block:: yaml |
| 63 | |
| 64 | salt: |
| 65 | master: |
| 66 | enabled: true |
| 67 | ... |
| 68 | environment: |
| 69 | prd: |
| 70 | keysone: |
| 71 | source: pkg |
| 72 | name: salt-formula-keystone |
| 73 | |
| 74 | Clone master branch of keystone formula as local feature branch |
| 75 | |
| 76 | .. code-block:: yaml |
| 77 | |
| 78 | salt: |
| 79 | master: |
| 80 | enabled: true |
| 81 | ... |
| 82 | environment: |
| 83 | dev: |
| 84 | formula: |
| 85 | keystone: |
| 86 | source: git |
| 87 | address: git@github.com:openstack/salt-formula-keystone.git |
| 88 | revision: master |
| 89 | branch: feature |
| 90 | |
| 91 | Salt master with specified formula refs (for example for Gerrit review) |
| 92 | |
| 93 | .. code-block:: yaml |
| 94 | |
| 95 | salt: |
| 96 | master: |
| 97 | enabled: true |
| 98 | ... |
| 99 | environment: |
| 100 | dev: |
| 101 | formula: |
| 102 | keystone: |
| 103 | source: git |
| 104 | address: https://git.openstack.org/openstack/salt-formula-keystone |
| 105 | revision: refs/changes/56/123456/1 |
| 106 | |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 107 | Salt master syndicate master of masters |
| 108 | |
| 109 | .. code-block:: yaml |
| 110 | |
| 111 | salt: |
| 112 | master: |
| 113 | enabled: true |
| 114 | ... |
| 115 | syndic: |
| 116 | mode: master |
| 117 | |
| 118 | Salt master syndicate (client) master |
| 119 | |
| 120 | .. code-block:: yaml |
| 121 | |
| 122 | salt: |
| 123 | master: |
| 124 | enabled: true |
| 125 | ... |
| 126 | syndicate: |
| 127 | mode: client |
| 128 | host: master-master |
| 129 | |
| 130 | Salt master with custom handlers |
| 131 | |
| 132 | .. code-block:: yaml |
| 133 | |
| 134 | salt: |
| 135 | master: |
| 136 | enabled: true |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 137 | handler: |
| 138 | handler01: |
| 139 | engine: udp |
| 140 | bind: |
| 141 | host: 127.0.0.1 |
| 142 | port: 9999 |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 143 | minion: |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 144 | handler: |
| 145 | handler01: |
| 146 | engine: udp |
| 147 | bind: |
| 148 | host: 127.0.0.1 |
| 149 | port: 9999 |
| 150 | handler02: |
| 151 | engine: zmq |
| 152 | bind: |
| 153 | host: 127.0.0.1 |
| 154 | port: 9999 |
| 155 | |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 156 | |
| 157 | Salt minion |
| 158 | ----------- |
| 159 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 160 | Simplest Salt minion setup with central configuration node |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 161 | |
| 162 | .. code-block:: yaml |
| 163 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 164 | .. literalinclude:: tests/pillar/minion_master.sls |
| 165 | :language: yaml |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 166 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 167 | Multi-master Salt minion setup |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 168 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 169 | .. literalinclude:: tests/pillar/minion_multi_master.sls |
| 170 | :language: yaml |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 171 | |
| 172 | Salt minion with salt mine options |
| 173 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 174 | .. literalinclude:: tests/pillar/minion_mine.sls |
| 175 | :language: yaml |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 176 | |
| 177 | Salt minion with graphing dependencies |
| 178 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 179 | .. literalinclude:: tests/pillar/minion_graph.sls |
| 180 | :language: yaml |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 181 | |
Ales Komarek | 5d17e4b | 2016-04-08 11:53:53 +0200 | [diff] [blame] | 182 | Salt minion with PKI CA |
| 183 | |
| 184 | .. literalinclude:: tests/pillar/minion_pki_ca.sls |
| 185 | :language: yaml |
| 186 | |
| 187 | Salt minion with PKI certificate |
| 188 | |
| 189 | .. literalinclude:: tests/pillar/minion_pki_cert.sls |
| 190 | :language: yaml |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 191 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 192 | Salt control (cloud/kvm/docker) |
| 193 | ------------------------------- |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 194 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 195 | Salt cloud with local OpenStack provider |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 196 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 197 | .. literalinclude:: tests/pillar/control_cloud_openstack.sls |
| 198 | :language: yaml |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 199 | |
| 200 | Salt cloud with Digital Ocean provider |
| 201 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 202 | .. literalinclude:: tests/pillar/control_cloud_digitalocean.sls |
| 203 | :language: yaml |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 204 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 205 | Salt virt KVM cluster |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 206 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 207 | .. literalinclude:: tests/pillar/control_virt.sls |
| 208 | :language: yaml |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 209 | |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 210 | |
| 211 | Usage |
| 212 | ===== |
| 213 | |
| 214 | Working with salt-cloud |
| 215 | |
| 216 | .. code-block:: bash |
| 217 | |
| 218 | salt-cloud -m /path/to/map --assume-yes |
| 219 | |
| 220 | Debug LIBCLOUD for salt-cloud connection |
| 221 | |
| 222 | .. code-block:: bash |
| 223 | |
| 224 | export LIBCLOUD_DEBUG=/dev/stderr; salt-cloud --list-sizes provider_name --log-level all |
| 225 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 226 | |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 227 | Read more |
| 228 | ========= |
| 229 | |
| 230 | * http://salt.readthedocs.org/en/latest/ |
| 231 | * https://github.com/DanielBryan/salt-state-graph |
| 232 | * http://karlgrz.com/testing-salt-states-rapidly-with-docker/ |
| 233 | * https://mywushublog.com/2013/03/configuration-management-with-salt-stack/ |
| 234 | * http://russell.ballestrini.net/replace-the-nagios-scheduler-and-nrpe-with-salt-stack/ |
| 235 | * https://github.com/saltstack-formulas/salt-formula |
| 236 | * http://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html |
| 237 | |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 238 | |
Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 239 | salt-cloud |
| 240 | ---------- |
| 241 | |
| 242 | * http://www.blog.sandro-mathys.ch/2013/07/setting-user-password-when-launching.html |
| 243 | * http://cloudinit.readthedocs.org/en/latest/topics/examples.html |
| 244 | * http://salt-cloud.readthedocs.org/en/latest/topics/install/index.html |
| 245 | * http://docs.saltstack.com/topics/cloud/digitalocean.html |
| 246 | * http://salt-cloud.readthedocs.org/en/latest/topics/rackspace.html |
| 247 | * http://salt-cloud.readthedocs.org/en/latest/topics/map.html |
| 248 | * http://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html |
Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 249 | |
| 250 | salt-virt |
| 251 | --------- |
smolaon | a66f7a6 | 2016-03-08 21:49:41 +0100 | [diff] [blame] | 252 | |
| 253 | Sample pillar |
| 254 | |
| 255 | .. code-block:: yaml |
| 256 | |
| 257 | salt: |
| 258 | control: |
| 259 | enabled: True |
| 260 | virt_enabled: True |
| 261 | size: |
| 262 | medium: |
| 263 | cpu: 2 |
| 264 | ram: 1024 |
| 265 | cluster: |
| 266 | localnode: |
| 267 | domain: domain.com |
| 268 | engine: virt |
| 269 | config: |
| 270 | engine: salt |
| 271 | host: 127.0.0.1 |
| 272 | node: |
| 273 | ubuntu01: |
| 274 | provider: node001.domain.com |
| 275 | image: ubuntu-14-04-x64-1456128611.qcow2 |
| 276 | size: medium |
| 277 | disk_profile: database |
Adam Tengler | caedd97 | 2016-05-04 16:44:00 +0200 | [diff] [blame] | 278 | net_profile: testing |