blob: 91f1754961c615098e2faf06ccf5aa8bab763aa5 [file] [log] [blame]
Filip Pytlounb4b80592015-10-06 16:28:32 +02001
2====
3Salt
4====
5
6Salt 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
8Salt delivers a dynamic communication bus for infrastructures that can be used for orchestration, remote execution, configuration management and much more.
9
10Sample pillars
11==============
12
13Salt master
14-----------
15
16Salt master with base environment and pillar metadata source
17
18.. code-block:: yaml
19
20 salt:
21 master:
22 enabled: true
23 command_timeout: 5
24 worker_threads: 2
25 pillar:
26 engine: salt
27 source:
28 engine: git
29 address: 'git@repo.domain.com:salt/pillar-demo.git'
30 branch: 'master'
31 base_environment: prd
32 environment:
33 prd:
34 enabled: true
35 formula:
36 linux:
37 source: git
38 address: 'git@repo.domain.com:salt/formula-linux.git'
39 branch: 'master'
40 salt:
41 source: git
42 address: 'git@repo.domain.com:salt/formula-salt.git'
43 branch: 'master'
44 openssh:
45 source: git
46 address: 'git@repo.domain.com:salt/formula-openssh.git'
47 branch: 'master'
48
49Simple Salt master with base environment and custom states
50
51.. code-block:: yaml
52
53 salt:
54 master:
55 ...
56 environment:
57 base:
58 states:
59 - name: gitlab
60 source: git
61 address: 'git@repo.domain.cz:salt/state-gitlab.git'
62 branch: 'master'
63 formulas:
64 ...
65
66Salt master with reclass ENC
67
68.. code-block:: yaml
69
70 salt:
71 master:
72 enabled: true
73 ...
74 pillar:
75 engine: reclass
76 data_dir: /srv/salt/reclass
77
78Salt master with windows repository
79
80.. code-block:: yaml
81
82 salt:
83 master:
84 enabled: true
85 ...
86 windows_repo:
87 type: git
88 address: 'git@repo.domain.com:salt/win-packages.git'
89
90Salt master with API
91
92.. code-block:: yaml
93
94 salt:
95 master:
96 ...
97 api:
98 enabled: true
99 port: 8000
100
101Salt master with preset minions
102
103.. code-block:: yaml
104
105 salt:
106 master:
107 enabled: true
108 ...
109 minions:
110 - name: 'node1.system.location.domain.com'
111
112Salt master syndicate master of masters
113
114.. code-block:: yaml
115
116 salt:
117 master:
118 enabled: true
119 ...
120 syndic:
121 mode: master
122
123Salt master syndicate (client) master
124
125.. code-block:: yaml
126
127 salt:
128 master:
129 enabled: true
130 ...
131 syndicate:
132 mode: client
133 host: master-master
134
135Salt master with custom handlers
136
137.. code-block:: yaml
138
139 salt:
140 master:
141 enabled: true
142 command_timeout: 5
143 worker_threads: 2
144 environments:
145 - name: base
146 states:
147 - source: git
148 address: 'git@repo.domain.com:salt/state-ubuntu.git'
149 branch: 'master'
150 pillar:
151 source: git
152 address: 'git@repo.domain.com:salt/pillar-demo.git'
153 branch: 'master'
154 handlers:
155 name: logstash
156 type: udp
157 bind:
158 host: 127.0.0.1
159 port: 9999
160 minion:
161 handlers:
162 - engine: udp
163 bind:
164 host: 127.0.0.1
165 port: 9999
166 - engine: zmq
167 bind:
168 host: 127.0.0.1
169 port: 9999
170
171Salt minion
172-----------
173
174Simplest Salt minion
175
176.. code-block:: yaml
177
178 salt:
179 minion:
180 enabled: true
181 master:
182 host: master.domain.com
183
184Multi-master Salt minion
185
186.. code-block:: yaml
187
188 salt:
189 minion:
190 enabled: true
191 masters:
192 - host: master1.domain.com
193 - host: master2.domain.com
194
195Salt minion with salt mine options
196
Adam Tengler2a18ba92016-01-25 23:16:23 +0100197.. code-block:: yaml
198
Filip Pytlounb4b80592015-10-06 16:28:32 +0200199 salt:
200 minion:
201 enabled: true
202 master:
203 host: master.domain.com
204 mine:
205 interval: 60
206 module:
207 grains.items: []
208 network.interfaces: []
209
210Salt minion with graphing dependencies
211
212.. code-block:: yaml
213
214 salt:
215 minion:
216 enabled: true
217 graph_states: true
218 master:
219 host: master.domain.com
220
221Salt control (cloud/virt)
222-------------------------
223
224Salt cloud with local OpenStack insecure (ignoring SSL cert errors) provider
225
226.. code-block:: yaml
227
228 salt:
229 control:
230 enabled: true
231 provider:
232 openstack_account:
233 engine: openstack
234 insecure: true
235 region: RegionOne
236 identity_url: 'https://10.0.0.2:35357'
237 tenant: devops
238 user: user
239 password: 'password'
240 fixed_networks:
241 - 123d3332-18be-4d1d-8d4d-5f5a54456554e
242 floating_networks:
243 - public
244 ignore_cidr: 192.168.0.0/16
245
246Salt cloud with Digital Ocean provider
247
248.. code-block:: yaml
249
250 salt:
251 control:
252 enabled: true
253 provider:
254 dony1:
255 engine: digital_ocean
256 region: New York 1
257 client_key: xxxxxxx
258 api_key: xxxxxxx
259
260Salt cloud with cluster definition
261
262.. code-block:: yaml
263
264 salt:
265 control:
266 enabled: true
267 cluster:
268 devops_ase:
269 config:
270 engine: salt
271 host: 147.32.120.1
272 node:
273 proxy1.ase.cepsos.cz:
274 provider: cepsos_devops
275 image: Ubuntu12.04 x86_64
276 size: m1.medium
277 node1.ase.cepsos.cz:
278 provider: cepsos_devops
279 image: Ubuntu12.04 x86_64
280 size: m1.medium
281 node2.ase.cepsos.cz:
282 provider: cepsos_devops
283 image: Ubuntu12.04 x86_64
284 size: m1.medium
285 node3.ase.cepsos.cz:
286 provider: cepsos_devops
287 image: Ubuntu12.04 x86_64
288 size: m1.medium
289
290Usage
291=====
292
293Working with salt-cloud
294
295.. code-block:: bash
296
297 salt-cloud -m /path/to/map --assume-yes
298
299Debug LIBCLOUD for salt-cloud connection
300
301.. code-block:: bash
302
303 export LIBCLOUD_DEBUG=/dev/stderr; salt-cloud --list-sizes provider_name --log-level all
304
305Read more
306=========
307
308* http://salt.readthedocs.org/en/latest/
309* https://github.com/DanielBryan/salt-state-graph
310* http://karlgrz.com/testing-salt-states-rapidly-with-docker/
311* https://mywushublog.com/2013/03/configuration-management-with-salt-stack/
312* http://russell.ballestrini.net/replace-the-nagios-scheduler-and-nrpe-with-salt-stack/
313* https://github.com/saltstack-formulas/salt-formula
314* http://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html
315
316salt-cloud
317----------
318
319* http://www.blog.sandro-mathys.ch/2013/07/setting-user-password-when-launching.html
320* http://cloudinit.readthedocs.org/en/latest/topics/examples.html
321* http://salt-cloud.readthedocs.org/en/latest/topics/install/index.html
322* http://docs.saltstack.com/topics/cloud/digitalocean.html
323* http://salt-cloud.readthedocs.org/en/latest/topics/rackspace.html
324* http://salt-cloud.readthedocs.org/en/latest/topics/map.html
325* http://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html