blob: f9df956b386cb9cf75286301f4e80a51389d2720 [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
Jakub Pavlik78859382016-01-21 11:26:39 +0100198rc.local example
199
200.. code-block:: yaml
201
202 linux:
203 system:
204 rc:
205 local: |
206 #!/bin/sh -e
207 #
208 # rc.local
209 #
210 # This script is executed at the end of each multiuser runlevel.
211 # Make sure that the script will "exit 0" on success or any other
212 # value on error.
213 #
214 # In order to enable or disable this script just change the execution
215 # bits.
216 #
217 # By default this script does nothing.
218 exit 0
219
220
Filip Pytlounf5383a42015-10-06 16:28:32 +0200221Linux network
222-------------
223
224Linux with network manager
225
226.. code-block:: yaml
227
228 linux:
229 network:
230 enabled: true
231 network_manager: true
232
233Linux with default static network interfaces, default gateway interface and DNS servers
234
235.. code-block:: yaml
236
237 linux:
238 network:
239 enabled: true
240 interface:
241 eth0:
242 enabled: true
243 type: eth
244 address: 192.168.0.102
245 netmask: 255.255.255.0
246 gateway: 192.168.0.1
247 name_servers:
248 - 8.8.8.8
249 - 8.8.4.4
250 mtu: 1500
251
jan kaufman6d30adf2016-01-18 17:30:12 +0100252Linux with bonded interfaces and disabled NetworkManager
Filip Pytlounf5383a42015-10-06 16:28:32 +0200253
254.. code-block:: yaml
255
256 linux:
257 network:
258 enabled: true
259 interface:
260 eth0:
261 type: eth
262 ...
263 eth1:
264 type: eth
265 ...
266 bond0:
267 enabled: true
268 type: bond
269 address: 192.168.0.102
270 netmask: 255.255.255.0
271 mtu: 1500
272 use_in:
273 - interface: ${linux:interface:eth0}
274 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +0100275 network_manager:
276 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +0200277
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100278Linux with vlan interface_params
279
280.. code-block:: yaml
281
282 linux:
283 network:
284 enabled: true
285 interface:
286 vlan69:
287 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +0100288 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100289 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100290
Filip Pytlounf5383a42015-10-06 16:28:32 +0200291Linux with wireless interface parameters
292
293.. code-block:: yaml
294
295 linux:
296 network:
297 enabled: true
298 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100299 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +0200300 interface:
301 wlan0:
302 type: eth
303 wireless:
304 essid: example
305 key: example_key
306 security: wpa
307 priority: 1
308
309Linux networks with routes defined
310
311.. code-block:: yaml
312
313 linux:
314 network:
315 enabled: true
316 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100317 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +0200318 interface:
319 eth0:
320 type: eth
321 route:
322 default:
323 address: 192.168.0.123
324 netmask: 255.255.255.0
325 gateway: 192.168.0.1
326
327Native Linux Bridges
328
329.. code-block:: yaml
330
331 linux:
332 network:
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
351OpenVswitch Bridges
352
353.. code-block:: yaml
354
355 linux:
356 network:
357 bridge: openvswitch
358 interface:
359 eth1:
360 enabled: true
361 type: eth
362 proto: manual
363 up_cmds:
364 - ip address add 0/0 dev $IFACE
365 - ip link set $IFACE up
366 down_cmds:
367 - ip link set $IFACE down
368 br-ex:
369 enabled: true
370 type: bridge
371 address: ${linux:network:host:public_local:address}
372 netmask: 255.255.255.0
373 use_interfaces:
374 - eth1
375
376Linux with proxy
377
378.. code-block:: yaml
379
380 linux:
381 network:
382 ...
383 proxy:
384 host: proxy.domain.com
385 port: 3128
386
387Linux with hosts
388
389.. code-block:: yaml
390
391 linux:
392 network:
393 ...
394 host:
395 node1:
396 address: 192.168.10.200
397 names:
398 - node2.domain.com
399 - service2.domain.com
400 node2:
401 address: 192.168.10.201
402 names:
403 - node2.domain.com
404 - service2.domain.com
405
Filip Pytlounde9bea52016-01-11 15:39:10 +0100406Setup resolv.conf, nameservers, domain and search domains
407
408.. code-block:: yaml
409
410 linux:
411 network:
412 resolv:
413 dns:
414 - 8.8.4.4
415 - 8.8.8.8
416 domain: my.example.com
417 search:
418 - my.example.com
419 - example.com
420
Filip Pytlounf5383a42015-10-06 16:28:32 +0200421Linux storage pillars
422---------------------
423
424Linux with mounted Samba
425
426.. code-block:: yaml
427
428 linux:
429 storage:
430 enabled: true
431 mount:
432 samba1:
433 - path: /media/myuser/public/
434 - device: //192.168.0.1/storage
435 - file_system: cifs
436 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
437
438Linux with file swap
439
440.. code-block:: yaml
441
442 linux:
443 storage:
444 enabled: true
445 swap:
446 file:
447 enabled: true
448 engine: file
449 device: /swapfile
450 size: 1024
451
Filip Pytlounc8a001a2015-12-15 14:09:19 +0100452LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
453
454.. code-block:: yaml
455
456 parameters:
457 linux:
458 storage:
459 mount:
460 data:
461 device: /dev/vg1/data
462 file_system: ext4
463 path: /mnt/data
464 lvm:
465 vg1:
466 enabled: true
467 devices:
468 - /dev/sdb
469 volume:
470 data:
471 size: 40G
472 mount: ${linux:storage:mount:data}
473
Filip Pytlounf5383a42015-10-06 16:28:32 +0200474Usage
475=====
476
477Set mtu of network interface eth0 to 1400
478
479.. code-block:: bash
480
481 ip link set dev eth0 mtu 1400
482
483Read more
484=========
485
486* https://www.archlinux.org/
487* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu