blob: 5f528fde1e79d7875b4907ebffe73029b4283034 [file] [log] [blame]
Filip Pytlounb4b80592015-10-06 16:28:32 +02001
Ales Komarek54740682017-05-15 07:16:23 +02002============
3Salt Formula
4============
Filip Pytlounb4b80592015-10-06 16:28:32 +02005
Ales Komarek54740682017-05-15 07:16:23 +02006Salt is a new approach to infrastructure management. Easy enough to get
7running in minutes, scalable enough to manage tens of thousands of servers,
8and fast enough to communicate with them in seconds.
Filip Pytlounb4b80592015-10-06 16:28:32 +02009
Ales Komarek54740682017-05-15 07:16:23 +020010Salt delivers a dynamic communication bus for infrastructures that can be used
11for orchestration, remote execution, configuration management and much more.
Filip Pytlounb4b80592015-10-06 16:28:32 +020012
Ales Komarek54740682017-05-15 07:16:23 +020013
14Sample Metadata
15===============
16
Filip Pytlounb4b80592015-10-06 16:28:32 +020017
18Salt master
19-----------
20
Ales Komarek54740682017-05-15 07:16:23 +020021Salt master with base formulas and pillar metadata backend
Filip Pytlounb4b80592015-10-06 16:28:32 +020022
Ales Komarek8ba9c0b2016-02-21 14:59:59 +010023.. literalinclude:: tests/pillar/master_single_pillar.sls
24 :language: yaml
Filip Pytlounb4b80592015-10-06 16:28:32 +020025
Ales Komarek54740682017-05-15 07:16:23 +020026Salt master with reclass ENC metadata backend
Filip Pytlounb4b80592015-10-06 16:28:32 +020027
Ales Komarek8ba9c0b2016-02-21 14:59:59 +010028.. literalinclude:: tests/pillar/master_single_reclass.sls
29 :language: yaml
Filip Pytlounb4b80592015-10-06 16:28:32 +020030
31Salt master with API
32
Ales Komarekb2c8ff62016-08-22 00:20:01 +020033.. literalinclude:: tests/pillar/master_api.sls
34 :language: yaml
Ales Komarekcdb280f2016-07-27 15:37:51 +020035
36Salt master with defined user ACLs
37
Ales Komarekb2c8ff62016-08-22 00:20:01 +020038.. literalinclude:: tests/pillar/master_acl.sls
39 :language: yaml
Filip Pytlounb4b80592015-10-06 16:28:32 +020040
41Salt master with preset minions
42
43.. code-block:: yaml
44
45 salt:
46 master:
47 enabled: true
Filip Pytlounb4b80592015-10-06 16:28:32 +020048 minions:
49 - name: 'node1.system.location.domain.com'
50
Ales Komarek54740682017-05-15 07:16:23 +020051Salt master with pip based installation (optional)
Adam Tenglercaedd972016-05-04 16:44:00 +020052
53.. code-block:: yaml
54
55 salt:
56 master:
57 enabled: true
58 ...
59 source:
60 engine: pip
61 version: 2016.3.0rc2
62
Ales Komarek54740682017-05-15 07:16:23 +020063Install formula through system package management
Adam Tengler3eb85ad2016-05-06 02:52:40 +020064
65.. code-block:: yaml
66
67 salt:
68 master:
69 enabled: true
70 ...
71 environment:
72 prd:
Petr Michalec7a2f1d22017-05-17 22:08:32 +020073 keystone:
Adam Tengler3eb85ad2016-05-06 02:52:40 +020074 source: pkg
75 name: salt-formula-keystone
Petr Michalec7a2f1d22017-05-17 22:08:32 +020076 nova:
77 source: pkg
78 name: salt-formula-keystone
79 version: 0.1+0~20160818133412.24~1.gbp6e1ebb
80 postresql:
81 source: pkg
82 name: salt-formula-postgresql
83 version: purged
84
85Formula keystone is installed latest version and the formulas without version are installed in one call to aptpkg module.
86If the version attribute is present sls iterates over formulas and take action to install specific version or remove it.
87The version attribute may have these values ``[latest|purged|removed|<VERSION>]``.
Adam Tengler3eb85ad2016-05-06 02:52:40 +020088
89Clone master branch of keystone formula as local feature branch
90
91.. code-block:: yaml
92
93 salt:
94 master:
95 enabled: true
96 ...
97 environment:
98 dev:
99 formula:
100 keystone:
101 source: git
102 address: git@github.com:openstack/salt-formula-keystone.git
103 revision: master
104 branch: feature
105
106Salt master with specified formula refs (for example for Gerrit review)
107
108.. code-block:: yaml
109
110 salt:
111 master:
112 enabled: true
113 ...
114 environment:
115 dev:
116 formula:
117 keystone:
118 source: git
119 address: https://git.openstack.org/openstack/salt-formula-keystone
120 revision: refs/changes/56/123456/1
121
Ales Komarek54740682017-05-15 07:16:23 +0200122Salt master with logging handlers
Filip Pytlounb4b80592015-10-06 16:28:32 +0200123
124.. code-block:: yaml
125
126 salt:
127 master:
128 enabled: true
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100129 handler:
130 handler01:
131 engine: udp
132 bind:
133 host: 127.0.0.1
134 port: 9999
Filip Pytlounb4b80592015-10-06 16:28:32 +0200135 minion:
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100136 handler:
137 handler01:
138 engine: udp
139 bind:
140 host: 127.0.0.1
141 port: 9999
142 handler02:
143 engine: zmq
144 bind:
145 host: 127.0.0.1
146 port: 9999
147
Ales Komarek54740682017-05-15 07:16:23 +0200148Salt master peer setup for remote certificate signing
Jakub Pavlikd4859842016-05-23 10:48:04 +0200149
150.. code-block:: yaml
151
152 salt:
153 master:
154 peer:
155 ".*":
156 - x509.sign_remote_certificate
Filip Pytlounb4b80592015-10-06 16:28:32 +0200157
Tomáš Kukrál8922aef2017-05-10 10:27:04 +0200158Configure verbosity of state output (used for `salt` command)
159
160.. code-block:: yaml
161
162 salt:
163 master:
Tomáš Kukrál044667b2017-05-11 10:12:15 +0200164 state_output: changes
Tomáš Kukrál8922aef2017-05-10 10:27:04 +0200165
Ales Komareke7844d12017-06-08 12:00:01 +0200166Salt synchronise node pillar and modules after start
Ales Komarek54740682017-05-15 07:16:23 +0200167
168.. code-block:: yaml
169
170 salt:
171 master:
172 reactor:
173 salt/minion/*/start:
Ales Komareke7844d12017-06-08 12:00:01 +0200174 - salt://salt/reactor/node_start.sls
Ales Komarek54740682017-05-15 07:16:23 +0200175
Ales Komareke7844d12017-06-08 12:00:01 +0200176Trigger basic node install
177
178.. code-block:: yaml
179
180 salt:
181 master:
182 reactor:
183 salt/minion/install:
184 - salt://salt/reactor/node_install.sls
185
186Sample event to trigger the node installation
187
188.. code-block:: bash
189
190 salt-call event.send 'salt/minion/install'
191
192Run any orchestration pipeline
Ales Komarek5c58de32017-06-06 11:49:32 +0200193
194.. code-block:: yaml
195
196 salt:
197 master:
198 reactor:
199 salt/orchestrate/start:
200 - salt://salt/reactor/orchestrate_start.sls
201
Ales Komareke7844d12017-06-08 12:00:01 +0200202Event to trigger the orchestration pipeline
Ales Komarek5c58de32017-06-06 11:49:32 +0200203
204.. code-block:: bash
205
Ales Komareke7844d12017-06-08 12:00:01 +0200206 salt-call event.send 'salt/orchestrate/start' "{'orchestrate': 'salt/orchestrate/infra_install.sls'}"
Ales Komarek5c58de32017-06-06 11:49:32 +0200207
Ales Komareke7844d12017-06-08 12:00:01 +0200208Classify node after start
Ales Komarek5c58de32017-06-06 11:49:32 +0200209
210.. code-block:: yaml
211
212 salt:
213 master:
214 reactor:
215 reclass/minion/classify:
216 - salt://reclass/reactor/node_register.sls
217
Ales Komareke7844d12017-06-08 12:00:01 +0200218Event to trigger the node classification
Ales Komarek5c58de32017-06-06 11:49:32 +0200219
220.. code-block:: bash
221
222 salt-call event.send 'reclass/minion/classify' "{'node_master_ip': '$config_host', 'node_ip': '${node_ip}', 'node_domain': '$node_domain', 'node_cluster': '$node_cluster', 'node_hostname': '$node_hostname', 'node_os': '$node_os'}"
223
Ales Komarek54740682017-05-15 07:16:23 +0200224
225Salt syndic
226-----------
227
228The master of masters
229
230.. code-block:: yaml
231
232 salt:
233 master:
234 enabled: true
235 order_masters: True
236
237Lower syndicated master
238
239.. code-block:: yaml
240
241 salt:
242 syndic:
243 enabled: true
244 master:
245 host: master-of-master-host
246 timeout: 5
247
248Syndicated master with multiple master of masters
249
250.. code-block:: yaml
251
252 salt:
253 syndic:
254 enabled: true
255 masters:
256 - host: master-of-master-host1
257 - host: master-of-master-host2
258 timeout: 5
259
260
261Salt-minion proxy
262-----------------
Jiri Broulika0f46682017-04-20 22:45:01 +0200263
264Salt proxy pillar
265
266.. code-block:: yaml
267
268 salt:
269 minion:
Jiri Broulik88275242017-05-24 17:21:17 +0200270 proxy_minion:
Jiri Broulika0f46682017-04-20 22:45:01 +0200271 master: localhost
272 device:
273 vsrx01.mydomain.local:
274 enabled: true
275 engine: napalm
276 csr1000v.mydomain.local:
277 enabled: true
278 engine: napalm
279
280.. note:: This is pillar of the the real salt-minion
281
282
283Proxy pillar for IOS device
284
285.. code-block:: yaml
286
287 proxy:
288 proxytype: napalm
289 driver: ios
290 host: csr1000v.mydomain.local
291 username: root
292 passwd: r00tme
293
294.. note:: This is pillar of the node thats not able to run salt-minion itself
295
296
297Proxy pillar for JunOS device
298
299.. code-block:: yaml
300
301 proxy:
302 proxytype: napalm
303 driver: junos
304 host: vsrx01.mydomain.local
305 username: root
306 passwd: r00tme
307 optional_args:
308 config_format: set
309
310.. note:: This is pillar of the node thats not able to run salt-minion itself
311
Ales Komarek8fb1da82016-08-21 23:52:03 +0200312
313Salt SSH
314--------
315
316Salt SSH with sudoer using key
317
318.. literalinclude:: tests/pillar/master_ssh_minion_key.sls
319 :language: yaml
320
321Salt SSH with sudoer using password
322
323.. literalinclude:: tests/pillar/master_ssh_minion_password.sls
324 :language: yaml
325
326Salt SSH with root using password
327
328.. literalinclude:: tests/pillar/master_ssh_minion_root.sls
329 :language: yaml
330
331
Filip Pytlounb4b80592015-10-06 16:28:32 +0200332Salt minion
333-----------
334
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100335Simplest Salt minion setup with central configuration node
Filip Pytlounb4b80592015-10-06 16:28:32 +0200336
337.. code-block:: yaml
338
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100339.. literalinclude:: tests/pillar/minion_master.sls
340 :language: yaml
Filip Pytlounb4b80592015-10-06 16:28:32 +0200341
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100342Multi-master Salt minion setup
Filip Pytlounb4b80592015-10-06 16:28:32 +0200343
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100344.. literalinclude:: tests/pillar/minion_multi_master.sls
345 :language: yaml
Filip Pytlounb4b80592015-10-06 16:28:32 +0200346
347Salt minion with salt mine options
348
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100349.. literalinclude:: tests/pillar/minion_mine.sls
350 :language: yaml
Filip Pytlounb4b80592015-10-06 16:28:32 +0200351
352Salt minion with graphing dependencies
353
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100354.. literalinclude:: tests/pillar/minion_graph.sls
355 :language: yaml
Filip Pytlounb4b80592015-10-06 16:28:32 +0200356
Ales Komarek54740682017-05-15 07:16:23 +0200357Salt minion behind HTTP proxy
Ondrej Smolac2d3e6f2017-03-26 17:52:40 +0200358
359.. code-block:: yaml
360
361 salt:
362 minion:
363 proxy:
364 host: 127.0.0.1
365 port: 3128
366
Ales Komarek54740682017-05-15 07:16:23 +0200367Salt minion with PKI certificate authority (CA)
Ales Komarek5d17e4b2016-04-08 11:53:53 +0200368
369.. literalinclude:: tests/pillar/minion_pki_ca.sls
370 :language: yaml
371
Ales Komarek54740682017-05-15 07:16:23 +0200372Salt minion using PKI certificate
Ales Komarek5d17e4b2016-04-08 11:53:53 +0200373
374.. literalinclude:: tests/pillar/minion_pki_cert.sls
375 :language: yaml
Filip Pytlounb4b80592015-10-06 16:28:32 +0200376
Petr Michalec56066ac2017-06-01 10:52:56 +0200377Salt minion trust CA certificates issued by salt CA on a specific host (ie: salt-master node)
378
379.. code-block:: yaml
380
381 salt:
382 minion:
383 trusted_ca_minions:
384 - cfg01
Ales Komarek8fb1da82016-08-21 23:52:03 +0200385
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100386Salt control (cloud/kvm/docker)
387-------------------------------
Filip Pytlounb4b80592015-10-06 16:28:32 +0200388
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100389Salt cloud with local OpenStack provider
Filip Pytlounb4b80592015-10-06 16:28:32 +0200390
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100391.. literalinclude:: tests/pillar/control_cloud_openstack.sls
392 :language: yaml
Filip Pytlounb4b80592015-10-06 16:28:32 +0200393
394Salt cloud with Digital Ocean provider
395
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100396.. literalinclude:: tests/pillar/control_cloud_digitalocean.sls
397 :language: yaml
Filip Pytlounb4b80592015-10-06 16:28:32 +0200398
Ales Komarek8fb1da82016-08-21 23:52:03 +0200399Salt virt with KVM cluster
Filip Pytlounb4b80592015-10-06 16:28:32 +0200400
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100401.. literalinclude:: tests/pillar/control_virt.sls
402 :language: yaml
Filip Pytlounb4b80592015-10-06 16:28:32 +0200403
Filip Pytlounb4b80592015-10-06 16:28:32 +0200404
405Usage
406=====
407
408Working with salt-cloud
409
410.. code-block:: bash
411
412 salt-cloud -m /path/to/map --assume-yes
413
414Debug LIBCLOUD for salt-cloud connection
415
416.. code-block:: bash
417
418 export LIBCLOUD_DEBUG=/dev/stderr; salt-cloud --list-sizes provider_name --log-level all
419
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100420
Ales Komarek54740682017-05-15 07:16:23 +0200421More Information
422================
Filip Pytlounb4b80592015-10-06 16:28:32 +0200423
424* http://salt.readthedocs.org/en/latest/
425* https://github.com/DanielBryan/salt-state-graph
426* http://karlgrz.com/testing-salt-states-rapidly-with-docker/
427* https://mywushublog.com/2013/03/configuration-management-with-salt-stack/
428* http://russell.ballestrini.net/replace-the-nagios-scheduler-and-nrpe-with-salt-stack/
429* https://github.com/saltstack-formulas/salt-formula
430* http://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html
431
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100432
Filip Pytlounb4b80592015-10-06 16:28:32 +0200433salt-cloud
434----------
435
436* http://www.blog.sandro-mathys.ch/2013/07/setting-user-password-when-launching.html
437* http://cloudinit.readthedocs.org/en/latest/topics/examples.html
438* http://salt-cloud.readthedocs.org/en/latest/topics/install/index.html
439* http://docs.saltstack.com/topics/cloud/digitalocean.html
440* http://salt-cloud.readthedocs.org/en/latest/topics/rackspace.html
441* http://salt-cloud.readthedocs.org/en/latest/topics/map.html
442* http://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html
Ales Komarek8ba9c0b2016-02-21 14:59:59 +0100443
Filip Pytloun954dbd62017-02-02 13:02:03 +0100444
445Documentation and Bugs
446======================
447
448To learn how to install and update salt-formulas, consult the documentation
449available online at:
450
451 http://salt-formulas.readthedocs.io/
452
453In the unfortunate event that bugs are discovered, they should be reported to
454the appropriate issue tracker. Use Github issue tracker for specific salt
455formula:
456
457 https://github.com/salt-formulas/salt-formula-salt/issues
458
459For feature requests, bug reports or blueprints affecting entire ecosystem,
460use Launchpad salt-formulas project:
461
462 https://launchpad.net/salt-formulas
463
464You can also join salt-formulas-users team and subscribe to mailing list:
465
466 https://launchpad.net/~salt-formulas-users
467
468Developers wishing to work on the salt-formulas projects should always base
469their work on master branch and submit pull request against specific formula.
470
471 https://github.com/salt-formulas/salt-formula-salt
472
473Any questions or feedback is always welcome so feel free to join our IRC
474channel:
475
476 #salt-formulas @ irc.freenode.net