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