blob: ee0c53dda21a32e93b95bbe78b88d15d82689f75 [file] [log] [blame]
Aleš Komárek63572992017-04-11 13:16:44 +02001============
2Linux Fomula
3============
Filip Pytlounf5383a42015-10-06 16:28:32 +02004
5Linux Operating Systems.
6
7* Ubuntu
8* CentOS
9* RedHat
10* Fedora
11* Arch
12
Aleš Komárek63572992017-04-11 13:16:44 +020013Sample Pillars
Filip Pytlounf5383a42015-10-06 16:28:32 +020014==============
15
Aleš Komárek63572992017-04-11 13:16:44 +020016
17Linux System
Filip Pytlounf5383a42015-10-06 16:28:32 +020018------------
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
azvyagintsev967af132017-06-12 12:25:24 +030034Linux with system users, some with password set:
35.. WARNING::
36If no 'password' variable has been passed - any predifined password
37will be removed.
Filip Pytlounf5383a42015-10-06 16:28:32 +020038
39.. code-block:: yaml
40
41 linux:
42 system:
43 ...
44 user:
45 jdoe:
46 name: 'jdoe'
47 enabled: true
48 sudo: true
49 shell: /bin/bash
50 full_name: 'Jonh Doe'
51 home: '/home/jdoe'
52 email: 'jonh@doe.com'
53 jsmith:
54 name: 'jsmith'
55 enabled: true
azvyagintsev967af132017-06-12 12:25:24 +030056 full_name: 'With clear password'
Filip Pytlounf5383a42015-10-06 16:28:32 +020057 home: '/home/jsmith'
azvyagintsev967af132017-06-12 12:25:24 +030058 hash_password: true
59 password: "userpassword"
60 mark:
61 name: 'mark'
62 enabled: true
63 full_name: "unchange password'
64 home: '/home/mark'
65 password: false
66 elizabeth:
67 name: 'elizabeth'
68 enabled: true
69 full_name: 'With hased password'
70 home: '/home/elizabeth'
71 password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10"
Filip Pytlounf5383a42015-10-06 16:28:32 +020072
Petr Michalec1c4c8d82017-02-28 19:09:21 +010073Configure sudo for users and groups under ``/etc/sudoers.d/``.
74This ways ``linux.system.sudo`` pillar map to actual sudo attributes:
75
76.. code-block:: jinja
Aleš Komárek63572992017-04-11 13:16:44 +020077
Petr Michalec1c4c8d82017-02-28 19:09:21 +010078 # simplified template:
79 Cmds_Alias {{ alias }}={{ commands }}
80 {{ user }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
81 %{{ group }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
82
83 # when rendered:
84 saltuser1 ALL=(ALL) NOPASSWD: ALL
85
Petr Michalec1c4c8d82017-02-28 19:09:21 +010086.. code-block:: yaml
Aleš Komárek63572992017-04-11 13:16:44 +020087
Petr Michalec1c4c8d82017-02-28 19:09:21 +010088 linux:
89 system:
90 sudo:
91 enabled: true
Tomas Kammd8eb3002017-05-08 19:30:29 +020092 aliases:
Petr Michalec1c4c8d82017-02-28 19:09:21 +010093 host:
94 LOCAL:
95 - localhost
96 PRODUCTION:
97 - db1
98 - db2
99 runas:
100 DBA:
101 - postgres
102 - mysql
103 SALT:
104 - root
105 command:
106 # Note: This is not 100% safe when ALL keyword is used, user still may modify configs and hide his actions.
107 # Best practice is to specify full list of commands user is allowed to run.
108 SUPPORT_RESTRICTED:
109 - /bin/vi /etc/sudoers*
110 - /bin/vim /etc/sudoers*
111 - /bin/nano /etc/sudoers*
112 - /bin/emacs /etc/sudoers*
113 - /bin/su - root
114 - /bin/su -
115 - /bin/su
116 - /usr/sbin/visudo
117 SUPPORT_SHELLS:
118 - /bin/sh
119 - /bin/ksh
120 - /bin/bash
121 - /bin/rbash
122 - /bin/dash
123 - /bin/zsh
124 - /bin/csh
125 - /bin/fish
126 - /bin/tcsh
127 - /usr/bin/login
128 - /usr/bin/su
129 - /usr/su
130 ALL_SALT_SAFE:
131 - /usr/bin/salt state*
132 - /usr/bin/salt service*
133 - /usr/bin/salt pillar*
134 - /usr/bin/salt grains*
135 - /usr/bin/salt saltutil*
136 - /usr/bin/salt-call state*
137 - /usr/bin/salt-call service*
138 - /usr/bin/salt-call pillar*
139 - /usr/bin/salt-call grains*
140 - /usr/bin/salt-call saltutil*
141 SALT_TRUSTED:
142 - /usr/bin/salt*
143 users:
144 # saltuser1 with default values: saltuser1 ALL=(ALL) NOPASSWD: ALL
145 saltuser1: {}
146 saltuser2:
147 hosts:
148 - LOCAL
149 # User Alias DBA
150 DBA:
151 hosts:
152 - ALL
153 commands:
154 - ALL_SALT_SAFE
155 groups:
156 db-ops:
157 hosts:
158 - ALL
159 - '!PRODUCTION'
160 runas:
161 - DBA
162 commands:
163 - /bin/cat *
164 - /bin/less *
165 - /bin/ls *
166 salt-ops:
167 hosts:
168 - 'ALL'
169 runas:
170 - SALT
171 commands:
172 - SUPPORT_SHELLS
173 salt-ops-2nd:
174 name: salt-ops
175 nopasswd: false
Jakub Josef7a9d9b92017-05-16 11:39:01 +0200176 setenv: true # Enable sudo -E option
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100177 runas:
178 - DBA
179 commands:
180 - ALL
181 - '!SUPPORT_SHELLS'
182 - '!SUPPORT_RESTRICTED'
183
Filip Pytlounf5383a42015-10-06 16:28:32 +0200184Linux with package, latest version
185
186.. code-block:: yaml
187
188 linux:
189 system:
190 ...
191 package:
192 package-name:
193 version: latest
194
195Linux with package from certail repo, version with no upgrades
196
197.. code-block:: yaml
198
199 linux:
200 system:
201 ...
202 package:
203 package-name:
204 version: 2132.323
205 repo: 'custom-repo'
206 hold: true
207
208Linux with package from certail repo, version with no GPG verification
209
210.. code-block:: yaml
211
212 linux:
213 system:
214 ...
215 package:
216 package-name:
217 version: 2132.323
218 repo: 'custom-repo'
219 verify: false
220
Bruno Binet69a9d8d2017-02-16 22:34:32 +0100221Linux with autoupdates (automatically install security package updates)
222
223.. code-block:: yaml
224
225 linux:
226 system:
227 ...
228 autoupdates:
229 enabled: true
230 mail: root@localhost
231 mail_only_on_error: true
232 remove_unused_dependencies: false
233 automatic_reboot: true
234 automatic_reboot_time: "02:00"
235
Filip Pytlounf5383a42015-10-06 16:28:32 +0200236Linux with cron jobs
Filip Pytloun91222222017-08-04 10:55:27 +0200237By default it will use name as an identifier, unless identifier key is
238explicitly set or False (then it will use Salt's default behavior which is
239identifier same as command resulting in not being able to change it)
Filip Pytlounf5383a42015-10-06 16:28:32 +0200240
241.. code-block:: yaml
242
243 linux:
244 system:
245 ...
246 job:
247 cmd1:
248 command: '/cmd/to/run'
Filip Pytloun91222222017-08-04 10:55:27 +0200249 identifier: cmd1
Filip Pytlounf5383a42015-10-06 16:28:32 +0200250 enabled: true
251 user: 'root'
252 hour: 2
253 minute: 0
254
Filip Pytlound0a29e72015-11-30 15:23:34 +0100255Linux security limits (limit sensu user memory usage to max 1GB):
256
257.. code-block:: yaml
258
259 linux:
260 system:
261 ...
262 limit:
263 sensu:
264 enabled: true
265 domain: sensu
266 limits:
267 - type: hard
268 item: as
269 value: 1000000
270
Filip Pytloun7fee0542015-10-15 11:19:24 +0200271Enable autologin on tty1 (may work only for Ubuntu 14.04):
272
273.. code-block:: yaml
274
275 linux:
276 system:
277 console:
278 tty1:
279 autologin: root
Filip Pytloun281d0202016-01-29 14:03:51 +0100280 # Enable serial console
281 ttyS0:
282 autologin: root
283 rate: 115200
284 term: xterm
Filip Pytloun7fee0542015-10-15 11:19:24 +0200285
286To disable set autologin to `false`.
287
Filip Pytloun7731b852016-02-01 11:13:47 +0100288Set ``policy-rc.d`` on Debian-based systems. Action can be any available
289command in ``while true`` loop and ``case`` context.
290Following will disallow dpkg to stop/start services for cassandra package automatically:
291
292.. code-block:: yaml
293
294 linux:
295 system:
296 policyrcd:
297 - package: cassandra
298 action: exit 101
299 - package: '*'
300 action: switch
301
Filip Pytlounc49445a2016-04-04 14:23:20 +0200302Set system locales:
303
304.. code-block:: yaml
305
306 linux:
307 system:
308 locale:
309 en_US.UTF-8:
310 default: true
Filip Pytlounee1745f2016-04-04 17:39:41 +0200311 "cs_CZ.UTF-8 UTF-8":
Filip Pytlounc49445a2016-04-04 14:23:20 +0200312 enabled: true
313
Andrey Shestakove7cca052017-05-24 23:06:24 +0300314Systemd settings:
315
316.. code-block:: yaml
317
318 linux:
319 system:
320 ...
321 systemd:
322 system:
323 Manager:
324 DefaultLimitNOFILE: 307200
325 DefaultLimitNPROC: 307200
326 user:
327 Manager:
328 DefaultLimitCPU: 2
329 DefaultLimitNPROC: 4
330
Filip Pytloun8b2131e2017-11-08 13:29:03 +0100331Ensure presence of directory:
332
333.. code-block:: yaml
334
335 linux:
336 system:
337 directory:
338 /tmp/test:
339 user: root
340 group: root
341 mode: 700
342 makedirs: true
343
Richard Felkl2e07d652018-01-19 10:19:06 +0100344Ensure presence of file by specifying it's source:
345
346.. code-block:: yaml
347
348 linux:
349 system:
350 file:
351 /tmp/test.txt:
352 source: http://example.com/test.txt
353 user: root
354 group: root
Bruno Binetbbbe1b12018-02-05 15:52:21 +0100355 mode: 700
Richard Felkl2e07d652018-01-19 10:19:06 +0100356 dir_mode: 700
357 encoding: utf-8
358 hash: <<md5 hash>>
359 makedirs: true
360
361Ensure presence of file by specifying it's contents:
362
363.. code-block:: yaml
364
365 linux:
366 system:
367 file:
368 /tmp/test.txt:
369 contents: |
370 line1
371 line2
372 user: root
373 group: root
Bruno Binetbbbe1b12018-02-05 15:52:21 +0100374 mode: 700
Richard Felkl2e07d652018-01-19 10:19:06 +0100375 dir_mode: 700
376 encoding: utf-8
377 hash: <<md5 hash>>
378 makedirs: true
Filip Pytloun281034a2016-01-04 18:06:22 +0100379Kernel
380~~~~~~
381
382Install always up to date LTS kernel and headers from Ubuntu trusty:
383
384.. code-block:: yaml
385
386 linux:
387 system:
388 kernel:
389 type: generic
390 lts: trusty
391 headers: true
392
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100393Load kernel modules and add them to `/etc/modules`:
394
395.. code-block:: yaml
396
397 linux:
398 system:
399 kernel:
400 modules:
401 - nf_conntrack
402 - tp_smapi
403 - 8021q
404
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300405Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
406will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`:
407
408.. code-block:: yaml
409
410 linux:
411 system:
412 kernel:
413 module:
414 nf_conntrack:
415 option:
416 hashsize: 262144
417
418
419
Filip Pytloun281034a2016-01-04 18:06:22 +0100420Install specific kernel version and ensure all other kernel packages are
421not present. Also install extra modules and headers for this kernel:
422
423.. code-block:: yaml
424
425 linux:
426 system:
427 kernel:
428 type: generic
429 extra: true
430 headers: true
431 version: 4.2.0-22
432
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100433Systcl kernel parameters
434
435.. code-block:: yaml
436
437 linux:
438 system:
439 kernel:
440 sysctl:
441 net.ipv4.tcp_keepalive_intvl: 3
442 net.ipv4.tcp_keepalive_time: 30
443 net.ipv4.tcp_keepalive_probes: 8
444
Michael Polenchukebf55522018-01-25 13:22:39 +0400445Configure kernel boot options:
446
447.. code-block:: yaml
448
449 linux:
450 system:
451 kernel:
452 boot_options:
453 - elevator=deadline
454 - spectre_v2=off
455 - nopti
456
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100457
458CPU
459~~~
460
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300461Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100462
463.. code-block:: yaml
464
465 linux:
466 system:
467 cpu:
468 governor: performance
469
Nick Metzf04f5f32018-01-08 15:25:04 +0100470
Jiri Broulik303905d2018-01-11 14:12:48 +0100471CGROUPS
472~~~~~~~
473
474Setup linux cgroups:
475
476.. code-block:: yaml
477
478 linux:
479 system:
480 cgroup:
481 enabled: true
482 group:
483 ceph_group_1:
484 controller:
485 cpu:
486 shares:
487 value: 250
488 cpuacct:
489 usage:
490 value: 0
491 cpuset:
492 cpus:
493 value: 1,2,3
494 memory:
495 limit_in_bytes:
496 value: 2G
497 memsw.limit_in_bytes:
498 value: 3G
499 mapping:
500 subjects:
501 - '@ceph'
502 generic_group_1:
503 controller:
504 cpu:
505 shares:
506 value: 250
507 cpuacct:
508 usage:
509 value: 0
510 mapping:
511 subjects:
512 - '*:firefox'
513 - 'student:cp'
514
515
Nick Metzf04f5f32018-01-08 15:25:04 +0100516Shared Libraries
517~~~~~~~~~~~~~~~~
518
519Set additional shared library to Linux system library path
520
521.. code-block:: yaml
522
523 linux:
524 system:
525 ld:
526 library:
527 java:
528 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
529 - /opt/java/jre/lib/amd64/server
530
531
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200532Certificates
533~~~~~~~~~~~~
534
535Add certificate authority into system trusted CA bundle
536
537.. code-block:: yaml
538
539 linux:
540 system:
541 ca_certificates:
542 mycert: |
543 -----BEGIN CERTIFICATE-----
544 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
545 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
546 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
547 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
548 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
549 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
550 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
551 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
552 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
553 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
554 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
555 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
556 -----END CERTIFICATE-----
557
Filip Pytloun361096c2017-08-23 10:57:20 +0200558Sysfs
559~~~~~
560
561Install sysfsutils and set sysfs attributes:
562
563.. code-block:: yaml
564
565 linux:
566 system:
567 sysfs:
568 scheduler:
569 block/sda/queue/scheduler: deadline
570 power:
571 mode:
572 power/state: 0660
573 owner:
574 power/state: "root:power"
575 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
576
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100577Huge Pages
578~~~~~~~~~~~~
579
580Huge Pages give a performance boost to applications that intensively deal
581with memory allocation/deallocation by decreasing memory fragmentation.
582
583.. code-block:: yaml
584
585 linux:
586 system:
587 kernel:
588 hugepages:
589 small:
590 size: 2M
591 count: 107520
592 mount_point: /mnt/hugepages_2MB
593 mount: false/true # default false
594 large:
595 default: true # default automatically mounted
596 size: 1G
597 count: 210
598 mount_point: /mnt/hugepages_1GB
599
600Note: not recommended to use both pagesizes in concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100601
Jakub Pavlik5398d872017-02-13 22:30:47 +0100602Intel SR-IOV
603~~~~~~~~~~~~
604
605PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV) specification defines a standardized mechanism to virtualize PCIe devices. The mechanism can virtualize a single PCIe Ethernet controller to appear as multiple PCIe devices.
606
607.. code-block:: yaml
608
609 linux:
610 system:
611 kernel:
612 sriov: True
613 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
614 rc:
615 local: |
616 #!/bin/sh -e
617 # Enable 7 VF on eth1
618 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
619 exit 0
620
Jakub Pavlik6c9ead12017-02-16 21:53:13 +0100621Isolate CPU options
622~~~~~~~~~~~~~~~~~~~
623
624Remove the specified CPUs, as defined by the cpu_number values, from the general kernel
625SMP balancing and scheduler algroithms. The only way to move a process onto or off an
626"isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the
627maximum value is 1 less than the number of CPUs on the system.
628
629.. code-block:: yaml
630
631 linux:
632 system:
633 kernel:
634 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100635
Filip Pytlounf5383a42015-10-06 16:28:32 +0200636Repositories
637~~~~~~~~~~~~
638
639RedHat based Linux with additional OpenStack repo
640
641.. code-block:: yaml
642
643 linux:
644 system:
645 ...
646 repo:
647 rdo-icehouse:
648 enabled: true
649 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
650 pgpcheck: 0
651
652Ensure system repository to use czech Debian mirror (``default: true``)
653Also pin it's packages with priority 900.
654
655.. code-block:: yaml
656
657 linux:
658 system:
659 repo:
660 debian:
661 default: true
662 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
663 # Import signing key from URL if needed
664 key_url: "http://dummy.com/public.gpg"
665 pin:
666 - pin: 'origin "ftp.cz.debian.org"'
667 priority: 900
668 package: '*'
669
Petr Michalec10462bb2017-03-23 19:18:08 +0100670
671Package manager proxy setup globally:
672
673.. code-block:: yaml
674
675 linux:
676 system:
677 ...
678 repo:
679 apt-mk:
680 source: "deb http://apt-mk.mirantis.com/ stable main salt"
681 ...
682 proxy:
683 pkg:
684 enabled: true
685 ftp: ftp://ftp-proxy-for-apt.host.local:2121
686 ...
687 # NOTE: Global defaults for any other componet that configure proxy on the system.
688 # If your environment has just one simple proxy, set it on linux:system:proxy.
689 #
690 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
691 # as for https and http
692 ftp: ftp://proxy.host.local:2121
693 http: http://proxy.host.local:3142
694 https: https://proxy.host.local:3143
695
696Package manager proxy setup per repository:
697
698.. code-block:: yaml
699
700 linux:
701 system:
702 ...
703 repo:
704 debian:
705 source: "deb http://apt-mk.mirantis.com/ stable main salt"
706 ...
707 apt-mk:
708 source: "deb http://apt-mk.mirantis.com/ stable main salt"
709 # per repository proxy
710 proxy:
711 enabled: true
712 http: http://maas-01:8080
713 https: http://maas-01:8080
714 ...
715 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600716 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +0100717 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
718 pkg:
719 enabled: true
720 ftp: ftp://proxy.host.local:2121
721 #http: http://proxy.host.local:3142
722 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600723 ...
Petr Michalec10462bb2017-03-23 19:18:08 +0100724 # global system fallback system defaults
725 ftp: ftp://proxy.host.local:2121
726 http: http://proxy.host.local:3142
727 https: https://proxy.host.local:3143
728
729
Jiri Broulik34a29b42017-04-25 14:42:54 +0200730Remove all repositories:
731
732.. code-block:: yaml
733
734 linux:
735 system:
736 purge_repos: true
737
Filip Pytlounc512e6c2017-11-22 14:28:10 +0100738Setup custom apt config options:
739
740.. code-block:: yaml
741
742 linux:
743 system:
744 apt:
745 config:
746 compression-workaround:
747 "Acquire::CompressionTypes::Order": "gz"
748 docker-clean:
749 "DPkg::Post-Invoke":
750 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
751 "APT::Update::Post-Invoke":
752 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
Jiri Broulik34a29b42017-04-25 14:42:54 +0200753
Petr Michalec10462bb2017-03-23 19:18:08 +0100754RC
755~~
756
Jakub Pavlik78859382016-01-21 11:26:39 +0100757rc.local example
758
759.. code-block:: yaml
760
761 linux:
762 system:
763 rc:
764 local: |
765 #!/bin/sh -e
766 #
767 # rc.local
768 #
769 # This script is executed at the end of each multiuser runlevel.
770 # Make sure that the script will "exit 0" on success or any other
771 # value on error.
772 #
773 # In order to enable or disable this script just change the execution
774 # bits.
775 #
776 # By default this script does nothing.
777 exit 0
778
Petr Michalec10462bb2017-03-23 19:18:08 +0100779
Filip Pytloun1f40dac2016-01-22 15:52:57 +0100780Prompt
781~~~~~~
782
783Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every
784user can have different prompt.
785
786.. code-block:: yaml
787
788 linux:
789 system:
790 prompt:
791 root: \\n\\[\\033[0;37m\\]\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\[\\e[0m\\]\\n\\[\\e[1;31m\\][\\u@\\h:\\w]\\[\\e[0m\\]
792 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
793
794On Debian systems to set prompt system-wide it's necessary to remove setting
795PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from
796``/etc/skel/.bashrc``). This formula will do this automatically, but will not
Filip Pytlound9b68da2016-01-22 15:58:41 +0100797touch existing user's ``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +0100798
Filip Pytlouneef11c12016-03-25 11:00:23 +0100799Bash
800~~~~
801
802Fix bash configuration to preserve history across sessions (like ZSH does by
803default).
804
805.. code-block:: yaml
806
807 linux:
808 system:
809 bash:
810 preserve_history: true
811
Filip Pytloune874dfb2016-01-22 16:57:34 +0100812Message of the day
813~~~~~~~~~~~~~~~~~~
814
815``pam_motd`` from package ``update-motd`` is used for dynamic messages of the
816day. Setting custom motd will cleanup existing ones.
817
818.. code-block:: yaml
819
820 linux:
821 system:
822 motd:
823 - release: |
824 #!/bin/sh
825 [ -r /etc/lsb-release ] && . /etc/lsb-release
826
827 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
828 # Fall back to using the very slow lsb_release utility
829 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
830 fi
831
832 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
833 - warning: |
834 #!/bin/sh
835 printf "This is [company name] network.\n"
836 printf "Unauthorized access strictly prohibited.\n"
837
Marek Celoud713e9072017-05-18 15:20:25 +0200838Services
839~~~~~~~~
840
841Stop and disable linux service:
842
843.. code-block:: yaml
844
845 linux:
846 system:
847 service:
848 apt-daily.timer:
849 status: dead
850
851Possible status is dead (disable service by default), running (enable service by default), enabled, disabled.
852
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +0300853Linux with atop service:
854
855.. code-block:: yaml
856
857 linux:
858 system:
859 atop:
860 enabled: true
861 interval: 20
862 logpath: "/var/log/atop"
863 outfile: "/var/log/atop/daily.log"
864
Filip Pytloun2f70b492016-02-19 15:55:25 +0100865RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +0100866^^^^^^^^^^^^^
Filip Pytloun2f70b492016-02-19 15:55:25 +0100867
868Unfortunately ``update-motd`` is currently not available for RHEL so there's
869no native support for dynamic motd.
870You can still set static one, only pillar structure differs:
871
872.. code-block:: yaml
873
874 linux:
875 system:
876 motd: |
877 This is [company name] network.
878 Unauthorized access strictly prohibited.
879
Filip Pytloun8296bb92016-02-19 18:42:09 +0100880Haveged
881~~~~~~~
882
883If you are running headless server and are low on entropy, it may be a good
884idea to setup Haveged.
885
886.. code-block:: yaml
887
888 linux:
889 system:
890 haveged:
891 enabled: true
892
Filip Pytlounf5383a42015-10-06 16:28:32 +0200893Linux network
894-------------
895
896Linux with network manager
897
898.. code-block:: yaml
899
900 linux:
901 network:
902 enabled: true
903 network_manager: true
904
905Linux with default static network interfaces, default gateway interface and DNS servers
906
907.. code-block:: yaml
908
909 linux:
910 network:
911 enabled: true
912 interface:
913 eth0:
914 enabled: true
915 type: eth
916 address: 192.168.0.102
917 netmask: 255.255.255.0
918 gateway: 192.168.0.1
919 name_servers:
920 - 8.8.8.8
921 - 8.8.4.4
922 mtu: 1500
923
jan kaufman6d30adf2016-01-18 17:30:12 +0100924Linux with bonded interfaces and disabled NetworkManager
Filip Pytlounf5383a42015-10-06 16:28:32 +0200925
926.. code-block:: yaml
927
928 linux:
929 network:
930 enabled: true
931 interface:
932 eth0:
933 type: eth
934 ...
935 eth1:
936 type: eth
937 ...
938 bond0:
939 enabled: true
940 type: bond
941 address: 192.168.0.102
942 netmask: 255.255.255.0
943 mtu: 1500
944 use_in:
945 - interface: ${linux:interface:eth0}
946 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +0100947 network_manager:
948 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +0200949
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100950Linux with vlan interface_params
951
952.. code-block:: yaml
953
954 linux:
955 network:
956 enabled: true
957 interface:
958 vlan69:
959 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +0100960 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100961 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100962
Filip Pytlounf5383a42015-10-06 16:28:32 +0200963Linux with wireless interface parameters
964
965.. code-block:: yaml
966
967 linux:
968 network:
969 enabled: true
970 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100971 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +0200972 interface:
973 wlan0:
974 type: eth
975 wireless:
976 essid: example
977 key: example_key
978 security: wpa
979 priority: 1
980
981Linux networks with routes defined
982
983.. code-block:: yaml
984
985 linux:
986 network:
987 enabled: true
988 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100989 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +0200990 interface:
991 eth0:
992 type: eth
993 route:
994 default:
995 address: 192.168.0.123
996 netmask: 255.255.255.0
997 gateway: 192.168.0.1
998
999Native Linux Bridges
1000
1001.. code-block:: yaml
1002
1003 linux:
1004 network:
1005 interface:
1006 eth1:
1007 enabled: true
1008 type: eth
1009 proto: manual
1010 up_cmds:
1011 - ip address add 0/0 dev $IFACE
1012 - ip link set $IFACE up
1013 down_cmds:
1014 - ip link set $IFACE down
1015 br-ex:
1016 enabled: true
1017 type: bridge
1018 address: ${linux:network:host:public_local:address}
1019 netmask: 255.255.255.0
1020 use_interfaces:
1021 - eth1
1022
1023OpenVswitch Bridges
1024
1025.. code-block:: yaml
1026
1027 linux:
1028 network:
1029 bridge: openvswitch
1030 interface:
1031 eth1:
1032 enabled: true
1033 type: eth
1034 proto: manual
1035 up_cmds:
1036 - ip address add 0/0 dev $IFACE
1037 - ip link set $IFACE up
1038 down_cmds:
1039 - ip link set $IFACE down
1040 br-ex:
1041 enabled: true
1042 type: bridge
1043 address: ${linux:network:host:public_local:address}
1044 netmask: 255.255.255.0
1045 use_interfaces:
1046 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001047 br-prv:
1048 enabled: true
1049 type: ovs_bridge
1050 mtu: 65000
1051 br-ens7:
1052 enabled: true
1053 name: br-ens7
1054 type: ovs_bridge
1055 proto: manual
1056 mtu: 9000
1057 use_interfaces:
1058 - ens7
1059 patch-br-ens7-br-prv:
1060 enabled: true
1061 name: ens7-prv
1062 ovs_type: ovs_port
1063 type: ovs_port
1064 bridge: br-ens7
1065 port_type: patch
1066 peer: prv-ens7
1067 mtu: 65000
1068 patch-br-prv-br-ens7:
1069 enabled: true
1070 name: prv-ens7
1071 bridge: br-prv
1072 ovs_type: ovs_port
1073 type: ovs_port
1074 port_type: patch
1075 peer: ens7-prv
1076 mtu: 65000
1077 ens7:
1078 enabled: true
1079 name: ens7
1080 proto: manual
1081 ovs_port_type: OVSPort
1082 type: ovs_port
1083 ovs_bridge: br-ens7
1084 bridge: br-ens7
Filip Pytlounf5383a42015-10-06 16:28:32 +02001085
Petr Jediný8f8ae542017-07-13 16:19:12 +02001086Debian manual proto interfaces
1087
1088When you are changing interface proto from static in up state to manual, you
1089may need to flush ip addresses. For example, if you want to use the interface
1090and the ip on the bridge. This can be done by setting the ``ipflush_onchange``
1091to true.
1092
1093.. code-block:: yaml
1094
1095 linux:
1096 network:
1097 interface:
1098 eth1:
1099 enabled: true
1100 type: eth
1101 proto: manual
1102 mtu: 9100
1103 ipflush_onchange: true
1104
Jiri Broulik1a191e32018-01-15 15:54:21 +01001105Debian static proto interfaces
1106
1107When you are changing interface proto from dhcp in up state to static, you
1108may need to flush ip addresses and restart interface to assign ip address from a managed file.
1109For example, if you want to use the interface and the ip on the bridge.
1110This can be done by setting the ``ipflush_onchange`` with combination
1111``restart_on_ipflush`` param set to to true.
1112
1113.. code-block:: yaml
1114
1115 linux:
1116 network:
1117 interface:
1118 eth1:
1119 enabled: true
1120 type: eth
1121 proto: static
1122 address: 10.1.0.22
1123 netmask: 255.255.255.0
1124 ipflush_onchange: true
1125 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001126
Petr Jedinýd577cb52017-06-28 20:17:49 +02001127Concatinating and removing interface files
1128
1129Debian based distributions have `/etc/network/interfaces.d/` directory, where
1130you can store configuration of network interfaces in separate files. You can
1131concatinate the files to the defined destination when needed, this operation
1132removes the file from the `/etc/network/interfaces.d/`. If you just need to
1133remove iface files, you can use the `remove_iface_files` key.
1134
1135.. code-block:: yaml
1136
1137 linux:
1138 network:
1139 concat_iface_files:
1140 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1141 dst: '/etc/network/interfaces'
1142 remove_iface_files:
1143 - '/etc/network/interfaces.d/90-custom.cfg'
1144
1145
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001146DHCP client configuration
1147
1148None of the keys is mandatory, include only those you really need. For full list
1149of available options under send, supersede, prepend, append refer to dhcp-options(5)
1150
1151.. code-block:: yaml
1152
1153 linux:
1154 network:
1155 dhclient:
1156 enabled: true
1157 backoff_cutoff: 15
1158 initial_interval: 10
1159 reboot: 10
1160 retry: 60
1161 select_timeout: 0
1162 timeout: 120
1163 send:
1164 - option: host-name
1165 declaration: "= gethostname()"
1166 supersede:
1167 - option: host-name
1168 declaration: "spaceship"
1169 - option: domain-name
1170 declaration: "domain.home"
1171 #- option: arp-cache-timeout
1172 # declaration: 20
1173 prepend:
1174 - option: domain-name-servers
1175 declaration:
1176 - 8.8.8.8
1177 - 8.8.4.4
1178 - option: domain-search
1179 declaration:
1180 - example.com
1181 - eng.example.com
1182 #append:
1183 #- option: domain-name-servers
1184 # declaration: 127.0.0.1
1185 # ip or subnet to reject dhcp offer from
1186 reject:
1187 - 192.33.137.209
1188 - 10.0.2.0/24
1189 request:
1190 - subnet-mask
1191 - broadcast-address
1192 - time-offset
1193 - routers
1194 - domain-name
1195 - domain-name-servers
1196 - domain-search
1197 - host-name
1198 - dhcp6.name-servers
1199 - dhcp6.domain-search
1200 - dhcp6.fqdn
1201 - dhcp6.sntp-servers
1202 - netbios-name-servers
1203 - netbios-scope
1204 - interface-mtu
1205 - rfc3442-classless-static-routes
1206 - ntp-servers
1207 require:
1208 - subnet-mask
1209 - domain-name-servers
1210 # if per interface configuration required add below
1211 interface:
1212 ens2:
1213 initial_interval: 11
1214 reject:
1215 - 192.33.137.210
1216 ens3:
1217 initial_interval: 12
1218 reject:
1219 - 192.33.137.211
1220
Petr Michaleceb14b552017-06-01 10:27:05 +02001221Linux network systemd settings:
1222
1223.. code-block:: yaml
1224
1225 linux:
1226 network:
1227 ...
1228 systemd:
1229 link:
1230 10-iface-dmz:
1231 Match:
1232 MACAddress: c8:5b:67:fa:1a:af
1233 OriginalName: eth0
1234 Link:
1235 Name: dmz0
1236 netdev:
1237 20-bridge-dmz:
1238 match:
1239 name: dmz0
1240 network:
1241 mescription: bridge
1242 bridge: br-dmz0
1243 network:
1244 # works with lowercase, keys are by default capitalized
1245 40-dhcp:
1246 match:
1247 name: '*'
1248 network:
1249 DHCP: yes
1250
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001251
Petr Michalec10462bb2017-03-23 19:18:08 +01001252Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001253
Ales Komarek417e8c52017-08-25 15:10:29 +02001254Use ``/etc/environment`` for static system wide variable assignment after
1255boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001256
1257.. code-block:: yaml
1258
1259 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001260 system:
1261 env:
1262 BOB_VARIABLE: Alice
1263 ...
1264 BOB_PATH:
1265 - /srv/alice/bin
1266 - /srv/bob/bin
1267 ...
1268 ftp_proxy: none
1269 http_proxy: http://global-http-proxy.host.local:8080
1270 https_proxy: ${linux:system:proxy:https}
1271 no_proxy:
1272 - 192.168.0.80
1273 - 192.168.1.80
1274 - .domain.com
1275 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02001276 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001277 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001278 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01001279 ftp: ftp://proxy.host.local:2121
1280 http: http://proxy.host.local:3142
1281 https: https://proxy.host.local:3143
1282 noproxy:
1283 - .domain.com
1284 - .local
1285
1286Configure profile.d scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01001287
Ales Komarek417e8c52017-08-25 15:10:29 +02001288The profile.d scripts are being sourced during .sh execution and support
1289variable expansion in opposite to /etc/environment global settings in
1290``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01001291
1292.. code-block:: yaml
1293
1294 linux:
1295 system:
1296 profile:
1297 locales: |
1298 export LANG=C
1299 export LC_ALL=C
1300 ...
1301 vi_flavors.sh: |
1302 export PAGER=view
1303 export EDITOR=vim
1304 alias vi=vim
1305 shell_locales.sh: |
1306 export LANG=en_US
1307 export LC_ALL=en_US.UTF-8
1308 shell_proxies.sh: |
1309 export FTP_PROXY=ftp://127.0.3.3:2121
1310 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02001311
1312Linux with hosts
1313
Filip Pytloun86506fe2017-01-26 14:36:16 +01001314Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
1315that are not defined in model except defaults for both IPv4 and IPv6 localhost
1316and hostname + fqdn.
Ales Komarek417e8c52017-08-25 15:10:29 +02001317
Filip Pytloun86506fe2017-01-26 14:36:16 +01001318It's good to use this option if you want to ensure /etc/hosts is always in a
1319clean state however it's not enabled by default for safety.
1320
Filip Pytlounf5383a42015-10-06 16:28:32 +02001321.. code-block:: yaml
1322
1323 linux:
1324 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001325 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001326 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001327 # No need to define this one if purge_hosts is true
1328 hostname:
1329 address: 127.0.1.1
1330 names:
1331 - ${linux:network:fqdn}
1332 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02001333 node1:
1334 address: 192.168.10.200
1335 names:
1336 - node2.domain.com
1337 - service2.domain.com
1338 node2:
1339 address: 192.168.10.201
1340 names:
1341 - node2.domain.com
1342 - service2.domain.com
1343
Ales Komarek417e8c52017-08-25 15:10:29 +02001344Linux with hosts collected from mine
1345
1346In this case all dns records defined within infrastrucuture will be passed to
1347local hosts records or any DNS server. Only hosts with `grain` parameter to
1348true will be propagated to the mine.
1349
1350.. code-block:: yaml
1351
1352 linux:
1353 network:
1354 purge_hosts: true
1355 mine_dns_records: true
1356 host:
1357 node1:
1358 address: 192.168.10.200
1359 grain: true
1360 names:
1361 - node2.domain.com
1362 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01001363
Filip Pytlounde9bea52016-01-11 15:39:10 +01001364Setup resolv.conf, nameservers, domain and search domains
1365
1366.. code-block:: yaml
1367
1368 linux:
1369 network:
1370 resolv:
1371 dns:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001372 - 8.8.4.4
1373 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01001374 domain: my.example.com
1375 search:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001376 - my.example.com
1377 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01001378 options:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001379 - ndots: 5
1380 - timeout: 2
1381 - attempts: 2
Filip Pytlounde9bea52016-01-11 15:39:10 +01001382
Ales Komarek417e8c52017-08-25 15:10:29 +02001383setting custom TX queue length for tap interfaces
Andrii Petrenko735761d2017-03-21 17:17:35 -07001384
1385.. code-block:: yaml
1386
1387 linux:
1388 network:
1389 tap_custom_txqueuelen: 10000
1390
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001391DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001392
1393**DPDK OVS NIC**
1394
1395.. code-block:: yaml
1396
1397 linux:
1398 network:
1399 bridge: openvswitch
1400 dpdk:
1401 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001402 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001403 openvswitch:
1404 pmd_cpu_mask: "0x6"
1405 dpdk_socket_mem: "1024,1024"
1406 dpdk_lcore_mask: "0x400"
1407 memory_channels: 2
1408 interface:
1409 dpkd0:
1410 name: ${_param:dpdk_nic}
1411 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001412 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001413 enabled: true
1414 type: dpdk_ovs_port
1415 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001416 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001417 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01001418 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001419 br-prv:
1420 enabled: true
1421 type: dpdk_ovs_bridge
1422
1423**DPDK OVS Bond**
1424
1425.. code-block:: yaml
1426
1427 linux:
1428 network:
1429 bridge: openvswitch
1430 dpdk:
1431 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001432 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001433 openvswitch:
1434 pmd_cpu_mask: "0x6"
1435 dpdk_socket_mem: "1024,1024"
1436 dpdk_lcore_mask: "0x400"
1437 memory_channels: 2
1438 interface:
1439 dpdk_second_nic:
1440 name: ${_param:primary_second_nic}
1441 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001442 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001443 bond: dpdkbond0
1444 enabled: true
1445 type: dpdk_ovs_port
1446 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001447 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001448 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001449 dpdk_first_nic:
1450 name: ${_param:primary_first_nic}
1451 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001452 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001453 bond: dpdkbond0
1454 enabled: true
1455 type: dpdk_ovs_port
1456 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001457 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001458 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001459 dpdkbond0:
1460 enabled: true
1461 bridge: br-prv
1462 type: dpdk_ovs_bond
1463 mode: active-backup
1464 br-prv:
1465 enabled: true
1466 type: dpdk_ovs_bridge
1467
Jakub Pavlikaa759062017-03-13 15:57:26 +01001468**DPDK OVS bridge for VXLAN**
1469
1470If VXLAN is used as tenant segmentation then ip address must be set on br-prv
1471
1472.. code-block:: yaml
1473
1474 linux:
1475 network:
1476 ...
1477 interface:
1478 br-prv:
1479 enabled: true
1480 type: dpdk_ovs_bridge
1481 address: 192.168.50.0
1482 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04001483 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01001484 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001485
1486Linux storage
1487-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02001488
1489Linux with mounted Samba
1490
1491.. code-block:: yaml
1492
1493 linux:
1494 storage:
1495 enabled: true
1496 mount:
1497 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01001498 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001499 - path: /media/myuser/public/
1500 - device: //192.168.0.1/storage
1501 - file_system: cifs
1502 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
1503
Jiri Broulikb017f932017-03-31 13:55:36 +02001504NFS mount
1505
1506.. code-block:: yaml
1507
1508 linux:
1509 storage:
1510 enabled: true
1511 mount:
1512 nfs_glance:
1513 enabled: true
1514 path: /var/lib/glance/images
1515 device: 172.16.10.110:/var/nfs/glance
1516 file_system: nfs
1517 opts: rw,sync
1518
1519
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001520File swap configuration
Filip Pytlounf5383a42015-10-06 16:28:32 +02001521
1522.. code-block:: yaml
1523
1524 linux:
1525 storage:
1526 enabled: true
1527 swap:
1528 file:
1529 enabled: true
1530 engine: file
1531 device: /swapfile
1532 size: 1024
1533
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001534Partition swap configuration
Lachlan Evenson30676512016-01-22 15:43:28 -08001535
1536.. code-block:: yaml
1537
1538 linux:
1539 storage:
1540 enabled: true
1541 swap:
1542 partition:
1543 enabled: true
1544 engine: partition
1545 device: /dev/vg0/swap
1546
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001547LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
1548
1549.. code-block:: yaml
1550
1551 parameters:
1552 linux:
1553 storage:
1554 mount:
1555 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01001556 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001557 device: /dev/vg1/data
1558 file_system: ext4
1559 path: /mnt/data
1560 lvm:
1561 vg1:
1562 enabled: true
1563 devices:
1564 - /dev/sdb
1565 volume:
1566 data:
1567 size: 40G
1568 mount: ${linux:storage:mount:data}
1569
Jakub Pavlik4f742142017-08-08 15:05:50 +02001570Create partitions on disk. Specify size in MB. It expects empty
Piotr Krukd51911b2017-12-04 11:27:08 +01001571disk without any existing partitions. (set startsector=1, if you want to start partitions from 2048)
Jakub Pavlik4f742142017-08-08 15:05:50 +02001572
1573.. code-block:: yaml
1574
1575 linux:
1576 storage:
1577 disk:
1578 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01001579 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02001580 name: /dev/loop1
1581 type: gpt
1582 partitions:
1583 - size: 200 #size in MB
1584 type: fat32
1585 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02001586 mkfs: True
1587 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02001588 /dev/vda1:
1589 partitions:
1590 - size: 5
1591 type: ext2
1592 - size: 10
1593 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02001594
1595Multipath with Fujitsu Eternus DXL
1596
1597.. code-block:: yaml
1598
1599 parameters:
1600 linux:
1601 storage:
1602 multipath:
1603 enabled: true
1604 blacklist_devices:
1605 - /dev/sda
1606 - /dev/sdb
1607 backends:
1608 - fujitsu_eternus_dxl
1609
1610Multipath with Hitachi VSP 1000
1611
1612.. code-block:: yaml
1613
1614 parameters:
1615 linux:
1616 storage:
1617 multipath:
1618 enabled: true
1619 blacklist_devices:
1620 - /dev/sda
1621 - /dev/sdb
1622 backends:
1623 - hitachi_vsp1000
1624
1625Multipath with IBM Storwize
1626
1627.. code-block:: yaml
1628
1629 parameters:
1630 linux:
1631 storage:
1632 multipath:
1633 enabled: true
1634 blacklist_devices:
1635 - /dev/sda
1636 - /dev/sdb
1637 backends:
1638 - ibm_storwize
1639
1640Multipath with multiple backends
1641
1642.. code-block:: yaml
1643
1644 parameters:
1645 linux:
1646 storage:
1647 multipath:
1648 enabled: true
1649 blacklist_devices:
1650 - /dev/sda
1651 - /dev/sdb
1652 - /dev/sdc
1653 - /dev/sdd
1654 backends:
1655 - ibm_storwize
1656 - fujitsu_eternus_dxl
1657 - hitachi_vsp1000
1658
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001659PAM LDAP integration
1660
1661.. code-block:: yaml
1662
1663 parameters:
1664 linux:
1665 system:
1666 auth:
1667 enabled: true
1668 ldap:
1669 enabled: true
1670 binddn: cn=bind,ou=service_users,dc=example,dc=com
1671 bindpw: secret
1672 uri: ldap://127.0.0.1
1673 base: ou=users,dc=example,dc=com
1674 ldap_version: 3
1675 pagesize: 65536
1676 referrals: off
1677 filter:
1678 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1679 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1680 group: (&(objectClass=group)(gidNumber=*))
1681
Ales Komareka634f4b2016-10-02 13:11:04 +02001682Disabled multipath (the default setup)
1683
1684.. code-block:: yaml
1685
1686 parameters:
1687 linux:
1688 storage:
1689 multipath:
1690 enabled: false
1691
Simon Pasquier375001e2017-01-26 13:22:33 +01001692Linux with local loopback device
1693
1694.. code-block:: yaml
1695
1696 linux:
1697 storage:
1698 loopback:
1699 disk1:
1700 file: /srv/disk1
1701 size: 50G
1702
Filip Pytlounb2c8f852016-11-21 17:03:43 +01001703External config generation
1704--------------------------
1705
1706You are able to use config support metadata between formulas and only generate
1707config files for external use, eg. docker, etc.
1708
1709.. code-block:: yaml
1710
1711 parameters:
1712 linux:
1713 system:
1714 config:
1715 pillar:
1716 jenkins:
1717 master:
1718 home: /srv/volumes/jenkins
1719 approved_scripts:
1720 - method java.net.URL openConnection
1721 credentials:
1722 - type: username_password
1723 scope: global
1724 id: test
1725 desc: Testing credentials
1726 username: test
1727 password: test
1728
Vladimir Ereminccf28842017-04-10 23:52:10 +03001729Netconsole Remote Kernel Logging
1730--------------------------------
1731
1732Netconsole logger could be configured for configfs-enabled kernels
1733(`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in
1734runtime (if network is already configured), and on-boot after interface
1735initialization. Notes:
1736
1737 * receiver could be located only in same L3 domain
1738 (or you need to configure gateway MAC manually)
1739 * receiver's MAC is detected only on configuration time
1740 * using broadcast MAC is not recommended
1741
1742.. code-block:: yaml
1743
1744 parameters:
1745 linux:
1746 system:
1747 netconsole:
1748 enabled: true
1749 port: 514 (optional)
1750 loglevel: debug (optional)
1751 target:
1752 192.168.0.1:
1753 interface: bond0
1754 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02001755
Filip Pytlounf5383a42015-10-06 16:28:32 +02001756Usage
1757=====
1758
1759Set mtu of network interface eth0 to 1400
1760
1761.. code-block:: bash
1762
1763 ip link set dev eth0 mtu 1400
1764
1765Read more
1766=========
1767
1768* https://www.archlinux.org/
1769* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
Filip Pytloun018f8712017-02-02 13:02:03 +01001770
1771Documentation and Bugs
1772======================
1773
1774To learn how to install and update salt-formulas, consult the documentation
1775available online at:
1776
1777 http://salt-formulas.readthedocs.io/
1778
1779In the unfortunate event that bugs are discovered, they should be reported to
1780the appropriate issue tracker. Use Github issue tracker for specific salt
1781formula:
1782
1783 https://github.com/salt-formulas/salt-formula-linux/issues
1784
1785For feature requests, bug reports or blueprints affecting entire ecosystem,
1786use Launchpad salt-formulas project:
1787
1788 https://launchpad.net/salt-formulas
1789
1790You can also join salt-formulas-users team and subscribe to mailing list:
1791
1792 https://launchpad.net/~salt-formulas-users
1793
1794Developers wishing to work on the salt-formulas projects should always base
1795their work on master branch and submit pull request against specific formula.
1796
1797 https://github.com/salt-formulas/salt-formula-linux
1798
1799Any questions or feedback is always welcome so feel free to join our IRC
1800channel:
1801
1802 #salt-formulas @ irc.freenode.net