blob: 68390d7c194b057bc27667d748f0d5ca2b42c9e2 [file] [log] [blame]
Filip Pytlounf5383a42015-10-06 16:28:32 +02001
2=====
3Linux
4=====
5
6Linux Operating Systems.
7
8* Ubuntu
9* CentOS
10* RedHat
11* Fedora
12* Arch
13
14Sample pillars
15==============
16
17Linux system
18------------
19
20Basic Linux box
21
22.. code-block:: yaml
23
24 linux:
25 system:
26 enabled: true
27 name: 'node1'
28 domain: 'domain.com'
29 cluster: 'system'
30 environment: prod
31 timezone: 'Europe/Prague'
32 utc: true
33
34Linux with system users, sowe with password set
35
36.. code-block:: yaml
37
38 linux:
39 system:
40 ...
41 user:
42 jdoe:
43 name: 'jdoe'
44 enabled: true
45 sudo: true
46 shell: /bin/bash
47 full_name: 'Jonh Doe'
48 home: '/home/jdoe'
49 email: 'jonh@doe.com'
50 jsmith:
51 name: 'jsmith'
52 enabled: true
53 full_name: 'Password'
54 home: '/home/jsmith'
55 password: userpassword
56
57Linux with package, latest version
58
59.. code-block:: yaml
60
61 linux:
62 system:
63 ...
64 package:
65 package-name:
66 version: latest
67
68Linux with package from certail repo, version with no upgrades
69
70.. code-block:: yaml
71
72 linux:
73 system:
74 ...
75 package:
76 package-name:
77 version: 2132.323
78 repo: 'custom-repo'
79 hold: true
80
81Linux with package from certail repo, version with no GPG verification
82
83.. code-block:: yaml
84
85 linux:
86 system:
87 ...
88 package:
89 package-name:
90 version: 2132.323
91 repo: 'custom-repo'
92 verify: false
93
94Linux with cron jobs
95
96.. code-block:: yaml
97
98 linux:
99 system:
100 ...
101 job:
102 cmd1:
103 command: '/cmd/to/run'
104 enabled: true
105 user: 'root'
106 hour: 2
107 minute: 0
108
Filip Pytlound0a29e72015-11-30 15:23:34 +0100109Linux security limits (limit sensu user memory usage to max 1GB):
110
111.. code-block:: yaml
112
113 linux:
114 system:
115 ...
116 limit:
117 sensu:
118 enabled: true
119 domain: sensu
120 limits:
121 - type: hard
122 item: as
123 value: 1000000
124
Filip Pytloun7fee0542015-10-15 11:19:24 +0200125Enable autologin on tty1 (may work only for Ubuntu 14.04):
126
127.. code-block:: yaml
128
129 linux:
130 system:
131 console:
132 tty1:
133 autologin: root
134
135To disable set autologin to `false`.
136
Filip Pytloun281034a2016-01-04 18:06:22 +0100137Kernel
138~~~~~~
139
140Install always up to date LTS kernel and headers from Ubuntu trusty:
141
142.. code-block:: yaml
143
144 linux:
145 system:
146 kernel:
147 type: generic
148 lts: trusty
149 headers: true
150
151Install specific kernel version and ensure all other kernel packages are
152not present. Also install extra modules and headers for this kernel:
153
154.. code-block:: yaml
155
156 linux:
157 system:
158 kernel:
159 type: generic
160 extra: true
161 headers: true
162 version: 4.2.0-22
163
Filip Pytlounf5383a42015-10-06 16:28:32 +0200164Repositories
165~~~~~~~~~~~~
166
167RedHat based Linux with additional OpenStack repo
168
169.. code-block:: yaml
170
171 linux:
172 system:
173 ...
174 repo:
175 rdo-icehouse:
176 enabled: true
177 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
178 pgpcheck: 0
179
180Ensure system repository to use czech Debian mirror (``default: true``)
181Also pin it's packages with priority 900.
182
183.. code-block:: yaml
184
185 linux:
186 system:
187 repo:
188 debian:
189 default: true
190 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
191 # Import signing key from URL if needed
192 key_url: "http://dummy.com/public.gpg"
193 pin:
194 - pin: 'origin "ftp.cz.debian.org"'
195 priority: 900
196 package: '*'
197
198Linux network
199-------------
200
201Linux with network manager
202
203.. code-block:: yaml
204
205 linux:
206 network:
207 enabled: true
208 network_manager: true
209
210Linux with default static network interfaces, default gateway interface and DNS servers
211
212.. code-block:: yaml
213
214 linux:
215 network:
216 enabled: true
217 interface:
218 eth0:
219 enabled: true
220 type: eth
221 address: 192.168.0.102
222 netmask: 255.255.255.0
223 gateway: 192.168.0.1
224 name_servers:
225 - 8.8.8.8
226 - 8.8.4.4
227 mtu: 1500
228
229Linux with bonded interfaces
230
231.. code-block:: yaml
232
233 linux:
234 network:
235 enabled: true
236 interface:
237 eth0:
238 type: eth
239 ...
240 eth1:
241 type: eth
242 ...
243 bond0:
244 enabled: true
245 type: bond
246 address: 192.168.0.102
247 netmask: 255.255.255.0
248 mtu: 1500
249 use_in:
250 - interface: ${linux:interface:eth0}
251 - interface: ${linux:interface:eth0}
252
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100253Linux with vlan interface_params
254
255.. code-block:: yaml
256
257 linux:
258 network:
259 enabled: true
260 interface:
261 vlan69:
262 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +0100263 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100264 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100265
Filip Pytlounf5383a42015-10-06 16:28:32 +0200266Linux with wireless interface parameters
267
268.. code-block:: yaml
269
270 linux:
271 network:
272 enabled: true
273 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100274 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +0200275 interface:
276 wlan0:
277 type: eth
278 wireless:
279 essid: example
280 key: example_key
281 security: wpa
282 priority: 1
283
284Linux networks with routes defined
285
286.. code-block:: yaml
287
288 linux:
289 network:
290 enabled: true
291 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100292 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +0200293 interface:
294 eth0:
295 type: eth
296 route:
297 default:
298 address: 192.168.0.123
299 netmask: 255.255.255.0
300 gateway: 192.168.0.1
301
302Native Linux Bridges
303
304.. code-block:: yaml
305
306 linux:
307 network:
308 interface:
309 eth1:
310 enabled: true
311 type: eth
312 proto: manual
313 up_cmds:
314 - ip address add 0/0 dev $IFACE
315 - ip link set $IFACE up
316 down_cmds:
317 - ip link set $IFACE down
318 br-ex:
319 enabled: true
320 type: bridge
321 address: ${linux:network:host:public_local:address}
322 netmask: 255.255.255.0
323 use_interfaces:
324 - eth1
325
326OpenVswitch Bridges
327
328.. code-block:: yaml
329
330 linux:
331 network:
332 bridge: openvswitch
333 interface:
334 eth1:
335 enabled: true
336 type: eth
337 proto: manual
338 up_cmds:
339 - ip address add 0/0 dev $IFACE
340 - ip link set $IFACE up
341 down_cmds:
342 - ip link set $IFACE down
343 br-ex:
344 enabled: true
345 type: bridge
346 address: ${linux:network:host:public_local:address}
347 netmask: 255.255.255.0
348 use_interfaces:
349 - eth1
350
351Linux with proxy
352
353.. code-block:: yaml
354
355 linux:
356 network:
357 ...
358 proxy:
359 host: proxy.domain.com
360 port: 3128
361
362Linux with hosts
363
364.. code-block:: yaml
365
366 linux:
367 network:
368 ...
369 host:
370 node1:
371 address: 192.168.10.200
372 names:
373 - node2.domain.com
374 - service2.domain.com
375 node2:
376 address: 192.168.10.201
377 names:
378 - node2.domain.com
379 - service2.domain.com
380
Filip Pytlounde9bea52016-01-11 15:39:10 +0100381Setup resolv.conf, nameservers, domain and search domains
382
383.. code-block:: yaml
384
385 linux:
386 network:
387 resolv:
388 dns:
389 - 8.8.4.4
390 - 8.8.8.8
391 domain: my.example.com
392 search:
393 - my.example.com
394 - example.com
395
Filip Pytlounf5383a42015-10-06 16:28:32 +0200396Linux storage pillars
397---------------------
398
399Linux with mounted Samba
400
401.. code-block:: yaml
402
403 linux:
404 storage:
405 enabled: true
406 mount:
407 samba1:
408 - path: /media/myuser/public/
409 - device: //192.168.0.1/storage
410 - file_system: cifs
411 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
412
413Linux with file swap
414
415.. code-block:: yaml
416
417 linux:
418 storage:
419 enabled: true
420 swap:
421 file:
422 enabled: true
423 engine: file
424 device: /swapfile
425 size: 1024
426
Filip Pytlounc8a001a2015-12-15 14:09:19 +0100427LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
428
429.. code-block:: yaml
430
431 parameters:
432 linux:
433 storage:
434 mount:
435 data:
436 device: /dev/vg1/data
437 file_system: ext4
438 path: /mnt/data
439 lvm:
440 vg1:
441 enabled: true
442 devices:
443 - /dev/sdb
444 volume:
445 data:
446 size: 40G
447 mount: ${linux:storage:mount:data}
448
Filip Pytlounf5383a42015-10-06 16:28:32 +0200449Usage
450=====
451
452Set mtu of network interface eth0 to 1400
453
454.. code-block:: bash
455
456 ip link set dev eth0 mtu 1400
457
458Read more
459=========
460
461* https://www.archlinux.org/
462* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu