| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 2 | ============ | 
|  | 3 | Salt Formula | 
|  | 4 | ============ | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 5 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 6 | Salt is a new approach to infrastructure management. Easy enough to get | 
|  | 7 | running in minutes, scalable enough to manage tens of thousands of servers, | 
|  | 8 | and fast enough to communicate with them in seconds. | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 9 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 10 | Salt delivers a dynamic communication bus for infrastructures that can be used | 
|  | 11 | for orchestration, remote execution, configuration management and much more. | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 12 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 13 |  | 
|  | 14 | Sample Metadata | 
|  | 15 | =============== | 
|  | 16 |  | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 17 |  | 
|  | 18 | Salt master | 
|  | 19 | ----------- | 
|  | 20 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 21 | Salt master with base formulas and pillar 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_pillar.sls | 
|  | 24 | :language: yaml | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 25 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 26 | Salt master with reclass ENC metadata backend | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 27 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 28 | .. literalinclude:: tests/pillar/master_single_reclass.sls | 
|  | 29 | :language: yaml | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 30 |  | 
| Petr Michalec | 1f541c4 | 2017-08-17 13:30:37 +0200 | [diff] [blame] | 31 | Salt master with multiple ext_pillars | 
|  | 32 |  | 
|  | 33 | .. literalinclude:: tests/pillar/master_single_extpillars.sls | 
|  | 34 | :language: yaml | 
|  | 35 |  | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 36 | Salt master with API | 
|  | 37 |  | 
| Ales Komarek | b2c8ff6 | 2016-08-22 00:20:01 +0200 | [diff] [blame] | 38 | .. literalinclude:: tests/pillar/master_api.sls | 
|  | 39 | :language: yaml | 
| Ales Komarek | cdb280f | 2016-07-27 15:37:51 +0200 | [diff] [blame] | 40 |  | 
|  | 41 | Salt master with defined user ACLs | 
|  | 42 |  | 
| Ales Komarek | b2c8ff6 | 2016-08-22 00:20:01 +0200 | [diff] [blame] | 43 | .. literalinclude:: tests/pillar/master_acl.sls | 
|  | 44 | :language: yaml | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 45 |  | 
|  | 46 | Salt master with preset minions | 
|  | 47 |  | 
|  | 48 | .. code-block:: yaml | 
|  | 49 |  | 
|  | 50 | salt: | 
|  | 51 | master: | 
|  | 52 | enabled: true | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 53 | minions: | 
|  | 54 | - name: 'node1.system.location.domain.com' | 
|  | 55 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 56 | Salt master with pip based installation (optional) | 
| Adam Tengler | caedd97 | 2016-05-04 16:44:00 +0200 | [diff] [blame] | 57 |  | 
|  | 58 | .. code-block:: yaml | 
|  | 59 |  | 
|  | 60 | salt: | 
|  | 61 | master: | 
|  | 62 | enabled: true | 
|  | 63 | ... | 
|  | 64 | source: | 
|  | 65 | engine: pip | 
|  | 66 | version: 2016.3.0rc2 | 
|  | 67 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 68 | Install formula through system package management | 
| Adam Tengler | 3eb85ad | 2016-05-06 02:52:40 +0200 | [diff] [blame] | 69 |  | 
|  | 70 | .. code-block:: yaml | 
|  | 71 |  | 
|  | 72 | salt: | 
|  | 73 | master: | 
|  | 74 | enabled: true | 
|  | 75 | ... | 
|  | 76 | environment: | 
|  | 77 | prd: | 
| Petr Michalec | 7a2f1d2 | 2017-05-17 22:08:32 +0200 | [diff] [blame] | 78 | keystone: | 
| Adam Tengler | 3eb85ad | 2016-05-06 02:52:40 +0200 | [diff] [blame] | 79 | source: pkg | 
|  | 80 | name: salt-formula-keystone | 
| Petr Michalec | 7a2f1d2 | 2017-05-17 22:08:32 +0200 | [diff] [blame] | 81 | nova: | 
|  | 82 | source: pkg | 
|  | 83 | name: salt-formula-keystone | 
|  | 84 | version: 0.1+0~20160818133412.24~1.gbp6e1ebb | 
|  | 85 | postresql: | 
|  | 86 | source: pkg | 
|  | 87 | name: salt-formula-postgresql | 
|  | 88 | version: purged | 
|  | 89 |  | 
|  | 90 | Formula keystone is installed latest version and the formulas without version are installed in one call to aptpkg module. | 
|  | 91 | If the version attribute is present sls iterates over formulas and take action to install specific version or remove it. | 
|  | 92 | The version attribute may have these values ``[latest|purged|removed|<VERSION>]``. | 
| Adam Tengler | 3eb85ad | 2016-05-06 02:52:40 +0200 | [diff] [blame] | 93 |  | 
|  | 94 | Clone master branch of keystone formula as local feature branch | 
|  | 95 |  | 
|  | 96 | .. code-block:: yaml | 
|  | 97 |  | 
|  | 98 | salt: | 
|  | 99 | master: | 
|  | 100 | enabled: true | 
|  | 101 | ... | 
|  | 102 | environment: | 
|  | 103 | dev: | 
|  | 104 | formula: | 
|  | 105 | keystone: | 
|  | 106 | source: git | 
|  | 107 | address: git@github.com:openstack/salt-formula-keystone.git | 
|  | 108 | revision: master | 
|  | 109 | branch: feature | 
|  | 110 |  | 
|  | 111 | Salt master with specified formula refs (for example for Gerrit review) | 
|  | 112 |  | 
|  | 113 | .. code-block:: yaml | 
|  | 114 |  | 
|  | 115 | salt: | 
|  | 116 | master: | 
|  | 117 | enabled: true | 
|  | 118 | ... | 
|  | 119 | environment: | 
|  | 120 | dev: | 
|  | 121 | formula: | 
|  | 122 | keystone: | 
|  | 123 | source: git | 
|  | 124 | address: https://git.openstack.org/openstack/salt-formula-keystone | 
|  | 125 | revision: refs/changes/56/123456/1 | 
|  | 126 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 127 | Salt master with logging handlers | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 128 |  | 
|  | 129 | .. code-block:: yaml | 
|  | 130 |  | 
|  | 131 | salt: | 
|  | 132 | master: | 
|  | 133 | enabled: true | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 134 | handler: | 
|  | 135 | handler01: | 
|  | 136 | engine: udp | 
|  | 137 | bind: | 
|  | 138 | host: 127.0.0.1 | 
|  | 139 | port: 9999 | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 140 | minion: | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 141 | handler: | 
|  | 142 | handler01: | 
|  | 143 | engine: udp | 
|  | 144 | bind: | 
|  | 145 | host: 127.0.0.1 | 
|  | 146 | port: 9999 | 
|  | 147 | handler02: | 
|  | 148 | engine: zmq | 
|  | 149 | bind: | 
|  | 150 | host: 127.0.0.1 | 
|  | 151 | port: 9999 | 
|  | 152 |  | 
| Ales Komarek | a9fc6e7 | 2017-09-06 15:02:40 +0200 | [diff] [blame] | 153 |  | 
|  | 154 | Salt engine definition for saltgraph metadata collector | 
|  | 155 |  | 
|  | 156 | .. code-block:: yaml | 
|  | 157 |  | 
|  | 158 | salt: | 
|  | 159 | master: | 
|  | 160 | engine: | 
|  | 161 | graph_metadata: | 
|  | 162 | engine: saltgraph | 
|  | 163 | host: 127.0.0.1 | 
|  | 164 | port: 5432 | 
|  | 165 | user: salt | 
|  | 166 | password: salt | 
|  | 167 | database: salt | 
|  | 168 |  | 
|  | 169 | Salt engine definition for sending events from docker events | 
|  | 170 |  | 
|  | 171 | .. code-block:: yaml | 
|  | 172 |  | 
|  | 173 | salt: | 
|  | 174 | master: | 
|  | 175 | engine: | 
|  | 176 | docker_events: | 
|  | 177 | docker_url: unix://var/run/docker.sock | 
|  | 178 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 179 | Salt master peer setup for remote certificate signing | 
| Jakub Pavlik | d485984 | 2016-05-23 10:48:04 +0200 | [diff] [blame] | 180 |  | 
|  | 181 | .. code-block:: yaml | 
|  | 182 |  | 
|  | 183 | salt: | 
|  | 184 | master: | 
|  | 185 | peer: | 
|  | 186 | ".*": | 
|  | 187 | - x509.sign_remote_certificate | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 188 |  | 
| Ales Komarek | b2ada52 | 2017-12-07 11:31:32 +0100 | [diff] [blame^] | 189 |  | 
|  | 190 | Salt master backup configuration | 
|  | 191 |  | 
|  | 192 | .. code-block:: yaml | 
|  | 193 |  | 
|  | 194 | salt: | 
|  | 195 | master: | 
|  | 196 | backup: true | 
|  | 197 | initial_data: | 
|  | 198 | engine: backupninja | 
|  | 199 | source: backup-node-host | 
|  | 200 | host: original-salt-master-id | 
|  | 201 |  | 
| Tomáš Kukrál | 8922aef | 2017-05-10 10:27:04 +0200 | [diff] [blame] | 202 | Configure verbosity of state output (used for `salt` command) | 
|  | 203 |  | 
|  | 204 | .. code-block:: yaml | 
|  | 205 |  | 
|  | 206 | salt: | 
|  | 207 | master: | 
| Tomáš Kukrál | 044667b | 2017-05-11 10:12:15 +0200 | [diff] [blame] | 208 | state_output: changes | 
| Tomáš Kukrál | 8922aef | 2017-05-10 10:27:04 +0200 | [diff] [blame] | 209 |  | 
| Petr Michalec | 1f541c4 | 2017-08-17 13:30:37 +0200 | [diff] [blame] | 210 |  | 
| Ales Komarek | e7844d1 | 2017-06-08 12:00:01 +0200 | [diff] [blame] | 211 | Salt synchronise node pillar and modules after start | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 212 |  | 
|  | 213 | .. code-block:: yaml | 
|  | 214 |  | 
|  | 215 | salt: | 
|  | 216 | master: | 
|  | 217 | reactor: | 
|  | 218 | salt/minion/*/start: | 
| Ales Komarek | e7844d1 | 2017-06-08 12:00:01 +0200 | [diff] [blame] | 219 | - salt://salt/reactor/node_start.sls | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 220 |  | 
| Ales Komarek | e7844d1 | 2017-06-08 12:00:01 +0200 | [diff] [blame] | 221 | Trigger basic node install | 
|  | 222 |  | 
|  | 223 | .. code-block:: yaml | 
|  | 224 |  | 
|  | 225 | salt: | 
|  | 226 | master: | 
|  | 227 | reactor: | 
|  | 228 | salt/minion/install: | 
|  | 229 | - salt://salt/reactor/node_install.sls | 
|  | 230 |  | 
|  | 231 | Sample event to trigger the node installation | 
|  | 232 |  | 
|  | 233 | .. code-block:: bash | 
|  | 234 |  | 
|  | 235 | salt-call event.send 'salt/minion/install' | 
|  | 236 |  | 
| Ales Komarek | 213fbe0 | 2017-08-21 16:39:05 +0200 | [diff] [blame] | 237 | Run any defined orchestration pipeline | 
| Ales Komarek | 5c58de3 | 2017-06-06 11:49:32 +0200 | [diff] [blame] | 238 |  | 
|  | 239 | .. code-block:: yaml | 
|  | 240 |  | 
|  | 241 | salt: | 
|  | 242 | master: | 
|  | 243 | reactor: | 
|  | 244 | salt/orchestrate/start: | 
|  | 245 | - salt://salt/reactor/orchestrate_start.sls | 
|  | 246 |  | 
| Ales Komarek | e7844d1 | 2017-06-08 12:00:01 +0200 | [diff] [blame] | 247 | Event to trigger the orchestration pipeline | 
| Ales Komarek | 5c58de3 | 2017-06-06 11:49:32 +0200 | [diff] [blame] | 248 |  | 
|  | 249 | .. code-block:: bash | 
|  | 250 |  | 
| Ales Komarek | e7844d1 | 2017-06-08 12:00:01 +0200 | [diff] [blame] | 251 | salt-call event.send 'salt/orchestrate/start' "{'orchestrate': 'salt/orchestrate/infra_install.sls'}" | 
| Ales Komarek | 5c58de3 | 2017-06-06 11:49:32 +0200 | [diff] [blame] | 252 |  | 
| Ales Komarek | 3ed7c43 | 2017-08-24 16:15:49 +0200 | [diff] [blame] | 253 | Synchronise modules and pillars on minion start. | 
|  | 254 |  | 
|  | 255 | .. code-block:: yaml | 
|  | 256 |  | 
|  | 257 | salt: | 
|  | 258 | master: | 
|  | 259 | reactor: | 
|  | 260 | 'salt/minion/*/start': | 
|  | 261 | - salt://salt/reactor/minion_start.sls | 
|  | 262 |  | 
| Ales Komarek | 213fbe0 | 2017-08-21 16:39:05 +0200 | [diff] [blame] | 263 | Add and/or remove the minion key | 
| Ales Komarek | 5c58de3 | 2017-06-06 11:49:32 +0200 | [diff] [blame] | 264 |  | 
|  | 265 | .. code-block:: yaml | 
|  | 266 |  | 
|  | 267 | salt: | 
|  | 268 | master: | 
|  | 269 | reactor: | 
| Ales Komarek | 213fbe0 | 2017-08-21 16:39:05 +0200 | [diff] [blame] | 270 | salt/key/create: | 
|  | 271 | - salt://salt/reactor/key_create.sls | 
|  | 272 | salt/key/remove: | 
|  | 273 | - salt://salt/reactor/key_remove.sls | 
| Ales Komarek | 5c58de3 | 2017-06-06 11:49:32 +0200 | [diff] [blame] | 274 |  | 
| Ales Komarek | 213fbe0 | 2017-08-21 16:39:05 +0200 | [diff] [blame] | 275 | Event to trigger the key creation | 
| Ales Komarek | 5c58de3 | 2017-06-06 11:49:32 +0200 | [diff] [blame] | 276 |  | 
|  | 277 | .. code-block:: bash | 
|  | 278 |  | 
| Adam Tengler | 6218896 | 2017-09-04 13:34:44 +0000 | [diff] [blame] | 279 | salt-call event.send 'salt/key/create' \ | 
|  | 280 | > "{'node_id': 'id-of-minion', 'node_host': '172.16.10.100', 'orch_post_create': 'kubernetes.orchestrate.compute_install', 'post_create_pillar': {'node_name': 'id-of-minion'}}" | 
| Ales Komarek | 5c58de3 | 2017-06-06 11:49:32 +0200 | [diff] [blame] | 281 |  | 
| Ales Komarek | 213fbe0 | 2017-08-21 16:39:05 +0200 | [diff] [blame] | 282 | .. note:: | 
|  | 283 |  | 
|  | 284 | You can add pass additional `orch_pre_create`, `orch_post_create`, | 
|  | 285 | `orch_pre_remove` or `orch_post_remove` parameters to the event to call | 
|  | 286 | extra orchestrate files. This can be useful for example for | 
|  | 287 | registering/unregistering nodes from the monitoring alarms or dashboards. | 
|  | 288 |  | 
|  | 289 | The key creation event needs to be run from other machine than the one | 
|  | 290 | being registered. | 
|  | 291 |  | 
|  | 292 | Event to trigger the key removal | 
|  | 293 |  | 
|  | 294 | .. code-block:: bash | 
|  | 295 |  | 
|  | 296 | salt-call event.send 'salt/key/remove' | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 297 |  | 
| Petr Michalec | 1f541c4 | 2017-08-17 13:30:37 +0200 | [diff] [blame] | 298 |  | 
|  | 299 | Encrypted pillars | 
|  | 300 | ----------------- | 
|  | 301 |  | 
|  | 302 | Note: NACL + below configuration will be available in Salt > 2017.7. | 
|  | 303 |  | 
|  | 304 | External resources: | 
|  | 305 |  | 
|  | 306 | - Tutorial to configure salt + reclass ext_pillar and nacl: http://apealive.net/post/2017-09-salt-nacl-ext-pillar/ | 
|  | 307 | - Saltstack documentation: https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.nacl.html | 
|  | 308 |  | 
|  | 309 | Configure salt NACL module: | 
|  | 310 |  | 
|  | 311 | .. code-block:: shell | 
|  | 312 |  | 
|  | 313 | pip install --upgrade libnacl===1.5.2 | 
|  | 314 | salt-call --local nacl.keygen /etc/salt/pki/master/nacl | 
|  | 315 |  | 
|  | 316 | local: | 
|  | 317 | saved sk_file:/etc/salt/pki/master/nacl  pk_file: /etc/salt/pki/master/nacl.pub | 
|  | 318 |  | 
|  | 319 |  | 
|  | 320 | .. code-block:: yaml | 
|  | 321 |  | 
|  | 322 | salt: | 
|  | 323 | master: | 
|  | 324 | pillar: | 
|  | 325 | reclass: *reclass | 
|  | 326 | nacl: | 
|  | 327 | index: 99 | 
|  | 328 | nacl: | 
|  | 329 | box_type: sealedbox | 
|  | 330 | sk_file: /etc/salt/pki/master/nacl | 
|  | 331 | pk_file: /etc/salt/pki/master/nacl.pub | 
|  | 332 | #sk: None | 
|  | 333 | #pk: None | 
|  | 334 |  | 
|  | 335 | NACL encrypt secrets: | 
|  | 336 |  | 
|  | 337 | salt-call --local nacl.enc 'my_secret_value' pk_file=/etc/salt/pki/master/nacl.pub | 
|  | 338 | hXTkJpC1hcKMS7yZVGESutWrkvzusXfETXkacSklIxYjfWDlMJmR37MlmthdIgjXpg4f2AlBKb8tc9Woma7q | 
|  | 339 | # or | 
|  | 340 | salt-run nacl.enc 'myotherpass' | 
|  | 341 | ADDFD0Rav6p6+63sojl7Htfrncp5rrDVyeE4BSPO7ipq8fZuLDIVAzQLf4PCbDqi+Fau5KD3/J/E+Pw= | 
|  | 342 |  | 
|  | 343 |  | 
|  | 344 | NACL encrypted values on pillar: | 
|  | 345 |  | 
|  | 346 | Use Boxed syntax `NACL[CryptedValue=]` to encode value on pillar: | 
|  | 347 |  | 
|  | 348 | .. code-block:: yaml | 
|  | 349 |  | 
|  | 350 | my_pillar: | 
|  | 351 | my_nacl: | 
|  | 352 | key0: unencrypted_value | 
|  | 353 | key1: NACL[hXTkJpC1hcKMS7yZVGESutWrkvzusXfETXkacSklIxYjfWDlMJmR37MlmthdIgjXpg4f2AlBKb8tc9Woma7q] | 
|  | 354 |  | 
|  | 355 | NACL large files: | 
|  | 356 |  | 
|  | 357 | .. code-block:: shell | 
|  | 358 | salt-call nacl.enc_file /tmp/cert.crt out=/srv/salt/env/dev/cert.nacl | 
|  | 359 | # or more advanced | 
|  | 360 | cert=$(cat /tmp/cert.crt) | 
|  | 361 | salt-call --out=newline_values_only nacl.enc_pub data="$cert" > /srv/salt/env/dev/cert.nacl | 
|  | 362 |  | 
|  | 363 |  | 
|  | 364 | NACL within template/native pillars: | 
|  | 365 |  | 
|  | 366 | pillarexample: | 
|  | 367 | user: root | 
|  | 368 | password1: {{salt.nacl.dec('DRB7Q6/X5gGSRCTpZyxS6hlbWj0llUA+uaVyvou3vJ4=')|json}} | 
|  | 369 | cert_key: {{salt.nacl.dec_file('/srv/salt/env/dev/certs/example.com/cert.nacl')|json}} | 
|  | 370 | cert_key2: {{salt.nacl.dec_file('salt:///certs/example.com/cert2.nacl')|json}} | 
|  | 371 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 372 | Salt syndic | 
|  | 373 | ----------- | 
|  | 374 |  | 
|  | 375 | The master of masters | 
|  | 376 |  | 
|  | 377 | .. code-block:: yaml | 
|  | 378 |  | 
|  | 379 | salt: | 
|  | 380 | master: | 
|  | 381 | enabled: true | 
|  | 382 | order_masters: True | 
|  | 383 |  | 
|  | 384 | Lower syndicated master | 
|  | 385 |  | 
|  | 386 | .. code-block:: yaml | 
|  | 387 |  | 
|  | 388 | salt: | 
|  | 389 | syndic: | 
|  | 390 | enabled: true | 
|  | 391 | master: | 
|  | 392 | host: master-of-master-host | 
|  | 393 | timeout: 5 | 
|  | 394 |  | 
|  | 395 | Syndicated master with multiple master of masters | 
|  | 396 |  | 
|  | 397 | .. code-block:: yaml | 
|  | 398 |  | 
|  | 399 | salt: | 
|  | 400 | syndic: | 
|  | 401 | enabled: true | 
|  | 402 | masters: | 
|  | 403 | - host: master-of-master-host1 | 
|  | 404 | - host: master-of-master-host2 | 
|  | 405 | timeout: 5 | 
|  | 406 |  | 
|  | 407 |  | 
|  | 408 | Salt-minion proxy | 
|  | 409 | ----------------- | 
| Jiri Broulik | a0f4668 | 2017-04-20 22:45:01 +0200 | [diff] [blame] | 410 |  | 
|  | 411 | Salt proxy pillar | 
|  | 412 |  | 
|  | 413 | .. code-block:: yaml | 
|  | 414 |  | 
|  | 415 | salt: | 
|  | 416 | minion: | 
| Jiri Broulik | 8827524 | 2017-05-24 17:21:17 +0200 | [diff] [blame] | 417 | proxy_minion: | 
| Jiri Broulik | a0f4668 | 2017-04-20 22:45:01 +0200 | [diff] [blame] | 418 | master: localhost | 
|  | 419 | device: | 
|  | 420 | vsrx01.mydomain.local: | 
|  | 421 | enabled: true | 
|  | 422 | engine: napalm | 
|  | 423 | csr1000v.mydomain.local: | 
|  | 424 | enabled: true | 
|  | 425 | engine: napalm | 
|  | 426 |  | 
|  | 427 | .. note:: This is pillar of the the real salt-minion | 
|  | 428 |  | 
|  | 429 |  | 
|  | 430 | Proxy pillar for IOS device | 
|  | 431 |  | 
|  | 432 | .. code-block:: yaml | 
|  | 433 |  | 
|  | 434 | proxy: | 
|  | 435 | proxytype: napalm | 
|  | 436 | driver: ios | 
|  | 437 | host: csr1000v.mydomain.local | 
|  | 438 | username: root | 
|  | 439 | passwd: r00tme | 
|  | 440 |  | 
|  | 441 | .. note:: This is pillar of the node thats not able to run salt-minion itself | 
|  | 442 |  | 
|  | 443 |  | 
|  | 444 | Proxy pillar for JunOS device | 
|  | 445 |  | 
|  | 446 | .. code-block:: yaml | 
|  | 447 |  | 
|  | 448 | proxy: | 
|  | 449 | proxytype: napalm | 
|  | 450 | driver: junos | 
|  | 451 | host: vsrx01.mydomain.local | 
|  | 452 | username: root | 
|  | 453 | passwd: r00tme | 
|  | 454 | optional_args: | 
|  | 455 | config_format: set | 
|  | 456 |  | 
|  | 457 | .. note:: This is pillar of the node thats not able to run salt-minion itself | 
|  | 458 |  | 
| Ales Komarek | 8fb1da8 | 2016-08-21 23:52:03 +0200 | [diff] [blame] | 459 |  | 
|  | 460 | Salt SSH | 
|  | 461 | -------- | 
|  | 462 |  | 
|  | 463 | Salt SSH with sudoer using key | 
|  | 464 |  | 
|  | 465 | .. literalinclude:: tests/pillar/master_ssh_minion_key.sls | 
|  | 466 | :language: yaml | 
|  | 467 |  | 
|  | 468 | Salt SSH with sudoer using password | 
|  | 469 |  | 
|  | 470 | .. literalinclude:: tests/pillar/master_ssh_minion_password.sls | 
|  | 471 | :language: yaml | 
|  | 472 |  | 
|  | 473 | Salt SSH with root using password | 
|  | 474 |  | 
|  | 475 | .. literalinclude:: tests/pillar/master_ssh_minion_root.sls | 
|  | 476 | :language: yaml | 
|  | 477 |  | 
|  | 478 |  | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 479 | Salt minion | 
|  | 480 | ----------- | 
|  | 481 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 482 | Simplest Salt minion setup with central configuration node | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 483 |  | 
|  | 484 | .. code-block:: yaml | 
|  | 485 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 486 | .. literalinclude:: tests/pillar/minion_master.sls | 
|  | 487 | :language: yaml | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 488 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 489 | Multi-master Salt minion setup | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 490 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 491 | .. literalinclude:: tests/pillar/minion_multi_master.sls | 
|  | 492 | :language: yaml | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 493 |  | 
|  | 494 | Salt minion with salt mine options | 
|  | 495 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 496 | .. literalinclude:: tests/pillar/minion_mine.sls | 
|  | 497 | :language: yaml | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 498 |  | 
|  | 499 | Salt minion with graphing dependencies | 
|  | 500 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 501 | .. literalinclude:: tests/pillar/minion_graph.sls | 
|  | 502 | :language: yaml | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 503 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 504 | Salt minion behind HTTP proxy | 
| Ondrej Smola | c2d3e6f | 2017-03-26 17:52:40 +0200 | [diff] [blame] | 505 |  | 
|  | 506 | .. code-block:: yaml | 
|  | 507 |  | 
|  | 508 | salt: | 
|  | 509 | minion: | 
|  | 510 | proxy: | 
|  | 511 | host: 127.0.0.1 | 
|  | 512 | port: 3128 | 
|  | 513 |  | 
| Sam Stoelinga | bb4c04b | 2017-06-26 15:47:19 -0700 | [diff] [blame] | 514 | Salt minion to specify non-default HTTP backend. The default tornado backend | 
|  | 515 | does not respect HTTP proxy settings set as environment variables. This is | 
|  | 516 | useful for cases where you need to set no_proxy lists. | 
|  | 517 |  | 
|  | 518 | .. code-block:: yaml | 
|  | 519 |  | 
|  | 520 | salt: | 
|  | 521 | minion: | 
|  | 522 | backend: urllib2 | 
|  | 523 |  | 
|  | 524 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 525 | Salt minion with PKI certificate authority (CA) | 
| Ales Komarek | 5d17e4b | 2016-04-08 11:53:53 +0200 | [diff] [blame] | 526 |  | 
|  | 527 | .. literalinclude:: tests/pillar/minion_pki_ca.sls | 
|  | 528 | :language: yaml | 
|  | 529 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 530 | Salt minion using PKI certificate | 
| Ales Komarek | 5d17e4b | 2016-04-08 11:53:53 +0200 | [diff] [blame] | 531 |  | 
|  | 532 | .. literalinclude:: tests/pillar/minion_pki_cert.sls | 
|  | 533 | :language: yaml | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 534 |  | 
| Petr Michalec | 56066ac | 2017-06-01 10:52:56 +0200 | [diff] [blame] | 535 | Salt minion trust CA certificates issued by salt CA on a specific host (ie: salt-master node) | 
|  | 536 |  | 
|  | 537 | .. code-block:: yaml | 
|  | 538 |  | 
|  | 539 | salt: | 
|  | 540 | minion: | 
|  | 541 | trusted_ca_minions: | 
|  | 542 | - cfg01 | 
| Ales Komarek | 8fb1da8 | 2016-08-21 23:52:03 +0200 | [diff] [blame] | 543 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 544 | Salt control (cloud/kvm/docker) | 
|  | 545 | ------------------------------- | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 546 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 547 | Salt cloud with local OpenStack provider | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 548 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 549 | .. literalinclude:: tests/pillar/control_cloud_openstack.sls | 
|  | 550 | :language: yaml | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 551 |  | 
|  | 552 | Salt cloud with Digital Ocean provider | 
|  | 553 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 554 | .. literalinclude:: tests/pillar/control_cloud_digitalocean.sls | 
|  | 555 | :language: yaml | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 556 |  | 
| Ales Komarek | 8fb1da8 | 2016-08-21 23:52:03 +0200 | [diff] [blame] | 557 | Salt virt with KVM cluster | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 558 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 559 | .. literalinclude:: tests/pillar/control_virt.sls | 
|  | 560 | :language: yaml | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 561 |  | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 562 |  | 
|  | 563 | Usage | 
|  | 564 | ===== | 
|  | 565 |  | 
|  | 566 | Working with salt-cloud | 
|  | 567 |  | 
|  | 568 | .. code-block:: bash | 
|  | 569 |  | 
|  | 570 | salt-cloud -m /path/to/map --assume-yes | 
|  | 571 |  | 
|  | 572 | Debug LIBCLOUD for salt-cloud connection | 
|  | 573 |  | 
|  | 574 | .. code-block:: bash | 
|  | 575 |  | 
|  | 576 | export LIBCLOUD_DEBUG=/dev/stderr; salt-cloud --list-sizes provider_name --log-level all | 
|  | 577 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 578 |  | 
| Ales Komarek | 5474068 | 2017-05-15 07:16:23 +0200 | [diff] [blame] | 579 | More Information | 
|  | 580 | ================ | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 581 |  | 
|  | 582 | * http://salt.readthedocs.org/en/latest/ | 
|  | 583 | * https://github.com/DanielBryan/salt-state-graph | 
|  | 584 | * http://karlgrz.com/testing-salt-states-rapidly-with-docker/ | 
|  | 585 | * https://mywushublog.com/2013/03/configuration-management-with-salt-stack/ | 
|  | 586 | * http://russell.ballestrini.net/replace-the-nagios-scheduler-and-nrpe-with-salt-stack/ | 
|  | 587 | * https://github.com/saltstack-formulas/salt-formula | 
|  | 588 | * http://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html | 
|  | 589 |  | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 590 |  | 
| Filip Pytloun | b4b8059 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 591 | salt-cloud | 
|  | 592 | ---------- | 
|  | 593 |  | 
|  | 594 | * http://www.blog.sandro-mathys.ch/2013/07/setting-user-password-when-launching.html | 
|  | 595 | * http://cloudinit.readthedocs.org/en/latest/topics/examples.html | 
|  | 596 | * http://salt-cloud.readthedocs.org/en/latest/topics/install/index.html | 
|  | 597 | * http://docs.saltstack.com/topics/cloud/digitalocean.html | 
|  | 598 | * http://salt-cloud.readthedocs.org/en/latest/topics/rackspace.html | 
|  | 599 | * http://salt-cloud.readthedocs.org/en/latest/topics/map.html | 
|  | 600 | * http://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html | 
| Ales Komarek | 8ba9c0b | 2016-02-21 14:59:59 +0100 | [diff] [blame] | 601 |  | 
| Filip Pytloun | 954dbd6 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 602 |  | 
|  | 603 | Documentation and Bugs | 
|  | 604 | ====================== | 
|  | 605 |  | 
|  | 606 | To learn how to install and update salt-formulas, consult the documentation | 
|  | 607 | available online at: | 
|  | 608 |  | 
|  | 609 | http://salt-formulas.readthedocs.io/ | 
|  | 610 |  | 
|  | 611 | In the unfortunate event that bugs are discovered, they should be reported to | 
|  | 612 | the appropriate issue tracker. Use Github issue tracker for specific salt | 
|  | 613 | formula: | 
|  | 614 |  | 
|  | 615 | https://github.com/salt-formulas/salt-formula-salt/issues | 
|  | 616 |  | 
|  | 617 | For feature requests, bug reports or blueprints affecting entire ecosystem, | 
|  | 618 | use Launchpad salt-formulas project: | 
|  | 619 |  | 
|  | 620 | https://launchpad.net/salt-formulas | 
|  | 621 |  | 
|  | 622 | You can also join salt-formulas-users team and subscribe to mailing list: | 
|  | 623 |  | 
|  | 624 | https://launchpad.net/~salt-formulas-users | 
|  | 625 |  | 
|  | 626 | Developers wishing to work on the salt-formulas projects should always base | 
|  | 627 | their work on master branch and submit pull request against specific formula. | 
|  | 628 |  | 
|  | 629 | https://github.com/salt-formulas/salt-formula-salt | 
|  | 630 |  | 
|  | 631 | Any questions or feedback is always welcome so feel free to join our IRC | 
|  | 632 | channel: | 
|  | 633 |  | 
|  | 634 | #salt-formulas @ irc.freenode.net |