blob: 2765990809ddab247b9abba763d5a337c8253ebf [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
Richard Felklf40599a2018-02-06 22:56:41 +0100353 user: root #optional
354 group: root #optional
355 mode: 700 #optional
356 dir_mode: 700 #optional
357 encoding: utf-8 #optional
358 hash: <<hash>> or <<URI to hash>> #optional
359 makedirs: true #optional
360
361 linux:
362 system:
363 file:
364 test.txt:
365 name: /tmp/test.txt
366 source: http://example.com/test.txt
Richard Felkl2e07d652018-01-19 10:19:06 +0100367
368Ensure presence of file by specifying it's contents:
369
370.. code-block:: yaml
371
372 linux:
373 system:
374 file:
375 /tmp/test.txt:
376 contents: |
377 line1
378 line2
Richard Felklf40599a2018-02-06 22:56:41 +0100379
380 linux:
381 system:
382 file:
383 /tmp/test.txt:
384 contents_pillar: linux:network:hostname
385
386 linux:
387 system:
388 file:
389 /tmp/test.txt:
390 contents_grains: motd
391
Filip Pytloun281034a2016-01-04 18:06:22 +0100392Kernel
393~~~~~~
394
395Install always up to date LTS kernel and headers from Ubuntu trusty:
396
397.. code-block:: yaml
398
399 linux:
400 system:
401 kernel:
402 type: generic
403 lts: trusty
404 headers: true
405
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100406Load kernel modules and add them to `/etc/modules`:
407
408.. code-block:: yaml
409
410 linux:
411 system:
412 kernel:
413 modules:
414 - nf_conntrack
415 - tp_smapi
416 - 8021q
417
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300418Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
419will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`:
420
421.. code-block:: yaml
422
423 linux:
424 system:
425 kernel:
426 module:
427 nf_conntrack:
428 option:
429 hashsize: 262144
430
431
432
Filip Pytloun281034a2016-01-04 18:06:22 +0100433Install specific kernel version and ensure all other kernel packages are
434not present. Also install extra modules and headers for this kernel:
435
436.. code-block:: yaml
437
438 linux:
439 system:
440 kernel:
441 type: generic
442 extra: true
443 headers: true
444 version: 4.2.0-22
445
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100446Systcl kernel parameters
447
448.. code-block:: yaml
449
450 linux:
451 system:
452 kernel:
453 sysctl:
454 net.ipv4.tcp_keepalive_intvl: 3
455 net.ipv4.tcp_keepalive_time: 30
456 net.ipv4.tcp_keepalive_probes: 8
457
Michael Polenchukebf55522018-01-25 13:22:39 +0400458Configure kernel boot options:
459
460.. code-block:: yaml
461
462 linux:
463 system:
464 kernel:
465 boot_options:
466 - elevator=deadline
467 - spectre_v2=off
468 - nopti
469
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100470
471CPU
472~~~
473
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300474Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100475
476.. code-block:: yaml
477
478 linux:
479 system:
480 cpu:
481 governor: performance
482
Nick Metzf04f5f32018-01-08 15:25:04 +0100483
Jiri Broulik303905d2018-01-11 14:12:48 +0100484CGROUPS
485~~~~~~~
486
487Setup linux cgroups:
488
489.. code-block:: yaml
490
491 linux:
492 system:
493 cgroup:
494 enabled: true
495 group:
496 ceph_group_1:
497 controller:
498 cpu:
499 shares:
500 value: 250
501 cpuacct:
502 usage:
503 value: 0
504 cpuset:
505 cpus:
506 value: 1,2,3
507 memory:
508 limit_in_bytes:
509 value: 2G
510 memsw.limit_in_bytes:
511 value: 3G
512 mapping:
513 subjects:
514 - '@ceph'
515 generic_group_1:
516 controller:
517 cpu:
518 shares:
519 value: 250
520 cpuacct:
521 usage:
522 value: 0
523 mapping:
524 subjects:
525 - '*:firefox'
526 - 'student:cp'
527
528
Nick Metzf04f5f32018-01-08 15:25:04 +0100529Shared Libraries
530~~~~~~~~~~~~~~~~
531
532Set additional shared library to Linux system library path
533
534.. code-block:: yaml
535
536 linux:
537 system:
538 ld:
539 library:
540 java:
541 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
542 - /opt/java/jre/lib/amd64/server
543
544
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200545Certificates
546~~~~~~~~~~~~
547
548Add certificate authority into system trusted CA bundle
549
550.. code-block:: yaml
551
552 linux:
553 system:
554 ca_certificates:
555 mycert: |
556 -----BEGIN CERTIFICATE-----
557 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
558 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
559 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
560 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
561 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
562 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
563 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
564 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
565 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
566 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
567 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
568 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
569 -----END CERTIFICATE-----
570
Filip Pytloun361096c2017-08-23 10:57:20 +0200571Sysfs
572~~~~~
573
574Install sysfsutils and set sysfs attributes:
575
576.. code-block:: yaml
577
578 linux:
579 system:
580 sysfs:
581 scheduler:
582 block/sda/queue/scheduler: deadline
583 power:
584 mode:
585 power/state: 0660
586 owner:
587 power/state: "root:power"
588 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
589
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100590Huge Pages
591~~~~~~~~~~~~
592
593Huge Pages give a performance boost to applications that intensively deal
594with memory allocation/deallocation by decreasing memory fragmentation.
595
596.. code-block:: yaml
597
598 linux:
599 system:
600 kernel:
601 hugepages:
602 small:
603 size: 2M
604 count: 107520
605 mount_point: /mnt/hugepages_2MB
Michael Polenchukd9369fe2018-05-08 17:53:08 +0400606 mount: false/true # default is true (mount immediately) / false (just save in the fstab)
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100607 large:
608 default: true # default automatically mounted
609 size: 1G
610 count: 210
611 mount_point: /mnt/hugepages_1GB
612
613Note: not recommended to use both pagesizes in concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100614
Jakub Pavlik5398d872017-02-13 22:30:47 +0100615Intel SR-IOV
616~~~~~~~~~~~~
617
618PCI-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.
619
620.. code-block:: yaml
621
622 linux:
623 system:
624 kernel:
625 sriov: True
626 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
627 rc:
628 local: |
629 #!/bin/sh -e
630 # Enable 7 VF on eth1
631 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
632 exit 0
633
Jakub Pavlik6c9ead12017-02-16 21:53:13 +0100634Isolate CPU options
635~~~~~~~~~~~~~~~~~~~
636
637Remove the specified CPUs, as defined by the cpu_number values, from the general kernel
638SMP balancing and scheduler algroithms. The only way to move a process onto or off an
639"isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the
640maximum value is 1 less than the number of CPUs on the system.
641
642.. code-block:: yaml
643
644 linux:
645 system:
646 kernel:
647 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100648
Filip Pytlounf5383a42015-10-06 16:28:32 +0200649Repositories
650~~~~~~~~~~~~
651
652RedHat based Linux with additional OpenStack repo
653
654.. code-block:: yaml
655
656 linux:
657 system:
658 ...
659 repo:
660 rdo-icehouse:
661 enabled: true
662 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
663 pgpcheck: 0
664
665Ensure system repository to use czech Debian mirror (``default: true``)
666Also pin it's packages with priority 900.
667
668.. code-block:: yaml
669
670 linux:
671 system:
672 repo:
673 debian:
674 default: true
675 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
676 # Import signing key from URL if needed
677 key_url: "http://dummy.com/public.gpg"
678 pin:
679 - pin: 'origin "ftp.cz.debian.org"'
680 priority: 900
681 package: '*'
682
Petr Michalec10462bb2017-03-23 19:18:08 +0100683
684Package manager proxy setup globally:
685
686.. code-block:: yaml
687
688 linux:
689 system:
690 ...
691 repo:
692 apt-mk:
693 source: "deb http://apt-mk.mirantis.com/ stable main salt"
694 ...
695 proxy:
696 pkg:
697 enabled: true
698 ftp: ftp://ftp-proxy-for-apt.host.local:2121
699 ...
700 # NOTE: Global defaults for any other componet that configure proxy on the system.
701 # If your environment has just one simple proxy, set it on linux:system:proxy.
702 #
703 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
704 # as for https and http
705 ftp: ftp://proxy.host.local:2121
706 http: http://proxy.host.local:3142
707 https: https://proxy.host.local:3143
708
709Package manager proxy setup per repository:
710
711.. code-block:: yaml
712
713 linux:
714 system:
715 ...
716 repo:
717 debian:
718 source: "deb http://apt-mk.mirantis.com/ stable main salt"
719 ...
720 apt-mk:
721 source: "deb http://apt-mk.mirantis.com/ stable main salt"
722 # per repository proxy
723 proxy:
724 enabled: true
725 http: http://maas-01:8080
726 https: http://maas-01:8080
727 ...
728 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600729 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +0100730 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
731 pkg:
732 enabled: true
733 ftp: ftp://proxy.host.local:2121
734 #http: http://proxy.host.local:3142
735 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600736 ...
Petr Michalec10462bb2017-03-23 19:18:08 +0100737 # global system fallback system defaults
738 ftp: ftp://proxy.host.local:2121
739 http: http://proxy.host.local:3142
740 https: https://proxy.host.local:3143
741
742
Jiri Broulik34a29b42017-04-25 14:42:54 +0200743Remove all repositories:
744
745.. code-block:: yaml
746
747 linux:
748 system:
749 purge_repos: true
750
Filip Pytlounc512e6c2017-11-22 14:28:10 +0100751Setup custom apt config options:
752
753.. code-block:: yaml
754
755 linux:
756 system:
757 apt:
758 config:
759 compression-workaround:
760 "Acquire::CompressionTypes::Order": "gz"
761 docker-clean:
762 "DPkg::Post-Invoke":
763 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
764 "APT::Update::Post-Invoke":
765 - "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 +0200766
Petr Michalec10462bb2017-03-23 19:18:08 +0100767RC
768~~
769
Jakub Pavlik78859382016-01-21 11:26:39 +0100770rc.local example
771
772.. code-block:: yaml
773
774 linux:
775 system:
776 rc:
777 local: |
778 #!/bin/sh -e
779 #
780 # rc.local
781 #
782 # This script is executed at the end of each multiuser runlevel.
783 # Make sure that the script will "exit 0" on success or any other
784 # value on error.
785 #
786 # In order to enable or disable this script just change the execution
787 # bits.
788 #
789 # By default this script does nothing.
790 exit 0
791
Petr Michalec10462bb2017-03-23 19:18:08 +0100792
Filip Pytloun1f40dac2016-01-22 15:52:57 +0100793Prompt
794~~~~~~
795
796Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every
797user can have different prompt.
798
799.. code-block:: yaml
800
801 linux:
802 system:
803 prompt:
804 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\\]
805 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
806
807On Debian systems to set prompt system-wide it's necessary to remove setting
808PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from
809``/etc/skel/.bashrc``). This formula will do this automatically, but will not
Filip Pytlound9b68da2016-01-22 15:58:41 +0100810touch existing user's ``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +0100811
Filip Pytlouneef11c12016-03-25 11:00:23 +0100812Bash
813~~~~
814
815Fix bash configuration to preserve history across sessions (like ZSH does by
816default).
817
818.. code-block:: yaml
819
820 linux:
821 system:
822 bash:
823 preserve_history: true
824
Dmitry Teselkin949398e2018-05-03 15:50:00 +0300825Login banner message
826~~~~~~~~~~~~~~~~~~~~
827
828/etc/issue is a text file which contains a message or system
829identification to be printed before the login prompt. It may contain
830various @char and \char sequences, if supported by the getty-type
831program employed on the system.
832
833Setting logon banner message is easy:
834
835.. code-block:: yaml
836
837 liunx:
838 system:
839 banner:
840 enabled: true
841 contents: |
842 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
843
844 You must have explicit, authorized permission to access or configure this
845 device. Unauthorized attempts and actions to access or use this system may
846 result in civil and/or criminal penalties.
847 All activities performed on this system are logged and monitored.
848
Filip Pytloune874dfb2016-01-22 16:57:34 +0100849Message of the day
850~~~~~~~~~~~~~~~~~~
851
Dmitry Teselkin538c8242018-04-02 16:13:37 +0300852``pam_motd`` from package ``libpam-modules`` is used for dynamic messages of the
Filip Pytloune874dfb2016-01-22 16:57:34 +0100853day. Setting custom motd will cleanup existing ones.
854
Dmitry Teselkin538c8242018-04-02 16:13:37 +0300855Setting static motd will replace existing ``/etc/motd`` and remove scripts from
856``/etc/update-motd.d``.
857
858Setting static motd:
859
860.. code-block:: yaml
861
862 linux:
863 system:
864 motd: |
865 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
866
867 You must have explicit, authorized permission to access or configure this
868 device. Unauthorized attempts and actions to access or use this system may
869 result in civil and/or criminal penalties.
870 All activities performed on this system are logged and monitored.
871
872Setting dynamic motd:
873
Filip Pytloune874dfb2016-01-22 16:57:34 +0100874.. code-block:: yaml
875
876 linux:
877 system:
878 motd:
879 - release: |
880 #!/bin/sh
881 [ -r /etc/lsb-release ] && . /etc/lsb-release
882
883 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
884 # Fall back to using the very slow lsb_release utility
885 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
886 fi
887
888 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
889 - warning: |
890 #!/bin/sh
891 printf "This is [company name] network.\n"
892 printf "Unauthorized access strictly prohibited.\n"
893
Marek Celoud713e9072017-05-18 15:20:25 +0200894Services
895~~~~~~~~
896
897Stop and disable linux service:
898
899.. code-block:: yaml
900
901 linux:
902 system:
903 service:
904 apt-daily.timer:
905 status: dead
906
907Possible status is dead (disable service by default), running (enable service by default), enabled, disabled.
908
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +0300909Linux with atop service:
910
911.. code-block:: yaml
912
913 linux:
914 system:
915 atop:
916 enabled: true
917 interval: 20
918 logpath: "/var/log/atop"
919 outfile: "/var/log/atop/daily.log"
920
Oleksii Chupryn144432b2018-05-22 10:34:48 +0300921Linux with mcelog service:
922
923.. code-block:: yaml
924
925 linux:
926 system:
927 mcelog:
928 enabled: true
929 logging:
930 syslog: true
931 syslog_error: true
932
Filip Pytloun2f70b492016-02-19 15:55:25 +0100933RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +0100934^^^^^^^^^^^^^
Filip Pytloun2f70b492016-02-19 15:55:25 +0100935
936Unfortunately ``update-motd`` is currently not available for RHEL so there's
937no native support for dynamic motd.
938You can still set static one, only pillar structure differs:
939
940.. code-block:: yaml
941
942 linux:
943 system:
944 motd: |
945 This is [company name] network.
946 Unauthorized access strictly prohibited.
947
Filip Pytloun8296bb92016-02-19 18:42:09 +0100948Haveged
949~~~~~~~
950
951If you are running headless server and are low on entropy, it may be a good
952idea to setup Haveged.
953
954.. code-block:: yaml
955
956 linux:
957 system:
958 haveged:
959 enabled: true
960
Filip Pytlounf5383a42015-10-06 16:28:32 +0200961Linux network
962-------------
963
964Linux with network manager
965
966.. code-block:: yaml
967
968 linux:
969 network:
970 enabled: true
971 network_manager: true
972
973Linux with default static network interfaces, default gateway interface and DNS servers
974
975.. code-block:: yaml
976
977 linux:
978 network:
979 enabled: true
980 interface:
981 eth0:
982 enabled: true
983 type: eth
984 address: 192.168.0.102
985 netmask: 255.255.255.0
986 gateway: 192.168.0.1
987 name_servers:
988 - 8.8.8.8
989 - 8.8.4.4
990 mtu: 1500
991
jan kaufman6d30adf2016-01-18 17:30:12 +0100992Linux with bonded interfaces and disabled NetworkManager
Filip Pytlounf5383a42015-10-06 16:28:32 +0200993
994.. code-block:: yaml
995
996 linux:
997 network:
998 enabled: true
999 interface:
1000 eth0:
1001 type: eth
1002 ...
1003 eth1:
1004 type: eth
1005 ...
1006 bond0:
1007 enabled: true
1008 type: bond
1009 address: 192.168.0.102
1010 netmask: 255.255.255.0
1011 mtu: 1500
1012 use_in:
1013 - interface: ${linux:interface:eth0}
1014 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +01001015 network_manager:
1016 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001017
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001018Linux with vlan interface_params
1019
1020.. code-block:: yaml
1021
1022 linux:
1023 network:
1024 enabled: true
1025 interface:
1026 vlan69:
1027 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001028 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001029 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001030
Filip Pytlounf5383a42015-10-06 16:28:32 +02001031Linux with wireless interface parameters
1032
1033.. code-block:: yaml
1034
1035 linux:
1036 network:
1037 enabled: true
1038 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001039 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001040 interface:
1041 wlan0:
1042 type: eth
1043 wireless:
1044 essid: example
1045 key: example_key
1046 security: wpa
1047 priority: 1
1048
1049Linux networks with routes defined
1050
1051.. code-block:: yaml
1052
1053 linux:
1054 network:
1055 enabled: true
1056 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001057 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001058 interface:
1059 eth0:
1060 type: eth
1061 route:
1062 default:
1063 address: 192.168.0.123
1064 netmask: 255.255.255.0
1065 gateway: 192.168.0.1
1066
1067Native Linux Bridges
1068
1069.. code-block:: yaml
1070
1071 linux:
1072 network:
1073 interface:
1074 eth1:
1075 enabled: true
1076 type: eth
1077 proto: manual
1078 up_cmds:
1079 - ip address add 0/0 dev $IFACE
1080 - ip link set $IFACE up
1081 down_cmds:
1082 - ip link set $IFACE down
1083 br-ex:
1084 enabled: true
1085 type: bridge
1086 address: ${linux:network:host:public_local:address}
1087 netmask: 255.255.255.0
1088 use_interfaces:
1089 - eth1
1090
1091OpenVswitch Bridges
1092
1093.. code-block:: yaml
1094
1095 linux:
1096 network:
1097 bridge: openvswitch
1098 interface:
1099 eth1:
1100 enabled: true
1101 type: eth
1102 proto: manual
1103 up_cmds:
1104 - ip address add 0/0 dev $IFACE
1105 - ip link set $IFACE up
1106 down_cmds:
1107 - ip link set $IFACE down
1108 br-ex:
1109 enabled: true
1110 type: bridge
1111 address: ${linux:network:host:public_local:address}
1112 netmask: 255.255.255.0
1113 use_interfaces:
1114 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001115 br-prv:
1116 enabled: true
1117 type: ovs_bridge
1118 mtu: 65000
1119 br-ens7:
1120 enabled: true
1121 name: br-ens7
1122 type: ovs_bridge
1123 proto: manual
1124 mtu: 9000
1125 use_interfaces:
1126 - ens7
1127 patch-br-ens7-br-prv:
1128 enabled: true
1129 name: ens7-prv
1130 ovs_type: ovs_port
1131 type: ovs_port
1132 bridge: br-ens7
1133 port_type: patch
1134 peer: prv-ens7
1135 mtu: 65000
1136 patch-br-prv-br-ens7:
1137 enabled: true
1138 name: prv-ens7
1139 bridge: br-prv
1140 ovs_type: ovs_port
1141 type: ovs_port
1142 port_type: patch
1143 peer: ens7-prv
1144 mtu: 65000
1145 ens7:
1146 enabled: true
1147 name: ens7
1148 proto: manual
1149 ovs_port_type: OVSPort
1150 type: ovs_port
1151 ovs_bridge: br-ens7
1152 bridge: br-ens7
Filip Pytlounf5383a42015-10-06 16:28:32 +02001153
Petr Jediný8f8ae542017-07-13 16:19:12 +02001154Debian manual proto interfaces
1155
1156When you are changing interface proto from static in up state to manual, you
1157may need to flush ip addresses. For example, if you want to use the interface
1158and the ip on the bridge. This can be done by setting the ``ipflush_onchange``
1159to true.
1160
1161.. code-block:: yaml
1162
1163 linux:
1164 network:
1165 interface:
1166 eth1:
1167 enabled: true
1168 type: eth
1169 proto: manual
1170 mtu: 9100
1171 ipflush_onchange: true
1172
Jiri Broulik1a191e32018-01-15 15:54:21 +01001173Debian static proto interfaces
1174
1175When you are changing interface proto from dhcp in up state to static, you
1176may need to flush ip addresses and restart interface to assign ip address from a managed file.
1177For example, if you want to use the interface and the ip on the bridge.
1178This can be done by setting the ``ipflush_onchange`` with combination
1179``restart_on_ipflush`` param set to to true.
1180
1181.. code-block:: yaml
1182
1183 linux:
1184 network:
1185 interface:
1186 eth1:
1187 enabled: true
1188 type: eth
1189 proto: static
1190 address: 10.1.0.22
1191 netmask: 255.255.255.0
1192 ipflush_onchange: true
1193 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001194
Petr Jedinýd577cb52017-06-28 20:17:49 +02001195Concatinating and removing interface files
1196
1197Debian based distributions have `/etc/network/interfaces.d/` directory, where
1198you can store configuration of network interfaces in separate files. You can
1199concatinate the files to the defined destination when needed, this operation
1200removes the file from the `/etc/network/interfaces.d/`. If you just need to
1201remove iface files, you can use the `remove_iface_files` key.
1202
1203.. code-block:: yaml
1204
1205 linux:
1206 network:
1207 concat_iface_files:
1208 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1209 dst: '/etc/network/interfaces'
1210 remove_iface_files:
1211 - '/etc/network/interfaces.d/90-custom.cfg'
1212
1213
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001214DHCP client configuration
1215
1216None of the keys is mandatory, include only those you really need. For full list
1217of available options under send, supersede, prepend, append refer to dhcp-options(5)
1218
1219.. code-block:: yaml
1220
1221 linux:
1222 network:
1223 dhclient:
1224 enabled: true
1225 backoff_cutoff: 15
1226 initial_interval: 10
1227 reboot: 10
1228 retry: 60
1229 select_timeout: 0
1230 timeout: 120
1231 send:
1232 - option: host-name
1233 declaration: "= gethostname()"
1234 supersede:
1235 - option: host-name
1236 declaration: "spaceship"
1237 - option: domain-name
1238 declaration: "domain.home"
1239 #- option: arp-cache-timeout
1240 # declaration: 20
1241 prepend:
1242 - option: domain-name-servers
1243 declaration:
1244 - 8.8.8.8
1245 - 8.8.4.4
1246 - option: domain-search
1247 declaration:
1248 - example.com
1249 - eng.example.com
1250 #append:
1251 #- option: domain-name-servers
1252 # declaration: 127.0.0.1
1253 # ip or subnet to reject dhcp offer from
1254 reject:
1255 - 192.33.137.209
1256 - 10.0.2.0/24
1257 request:
1258 - subnet-mask
1259 - broadcast-address
1260 - time-offset
1261 - routers
1262 - domain-name
1263 - domain-name-servers
1264 - domain-search
1265 - host-name
1266 - dhcp6.name-servers
1267 - dhcp6.domain-search
1268 - dhcp6.fqdn
1269 - dhcp6.sntp-servers
1270 - netbios-name-servers
1271 - netbios-scope
1272 - interface-mtu
1273 - rfc3442-classless-static-routes
1274 - ntp-servers
1275 require:
1276 - subnet-mask
1277 - domain-name-servers
1278 # if per interface configuration required add below
1279 interface:
1280 ens2:
1281 initial_interval: 11
1282 reject:
1283 - 192.33.137.210
1284 ens3:
1285 initial_interval: 12
1286 reject:
1287 - 192.33.137.211
1288
Petr Michaleceb14b552017-06-01 10:27:05 +02001289Linux network systemd settings:
1290
1291.. code-block:: yaml
1292
1293 linux:
1294 network:
1295 ...
1296 systemd:
1297 link:
1298 10-iface-dmz:
1299 Match:
1300 MACAddress: c8:5b:67:fa:1a:af
1301 OriginalName: eth0
1302 Link:
1303 Name: dmz0
1304 netdev:
1305 20-bridge-dmz:
1306 match:
1307 name: dmz0
1308 network:
1309 mescription: bridge
1310 bridge: br-dmz0
1311 network:
1312 # works with lowercase, keys are by default capitalized
1313 40-dhcp:
1314 match:
1315 name: '*'
1316 network:
1317 DHCP: yes
1318
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001319
Petr Michalec10462bb2017-03-23 19:18:08 +01001320Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001321
Ales Komarek417e8c52017-08-25 15:10:29 +02001322Use ``/etc/environment`` for static system wide variable assignment after
1323boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001324
1325.. code-block:: yaml
1326
1327 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001328 system:
1329 env:
1330 BOB_VARIABLE: Alice
1331 ...
1332 BOB_PATH:
1333 - /srv/alice/bin
1334 - /srv/bob/bin
1335 ...
1336 ftp_proxy: none
1337 http_proxy: http://global-http-proxy.host.local:8080
1338 https_proxy: ${linux:system:proxy:https}
1339 no_proxy:
1340 - 192.168.0.80
1341 - 192.168.1.80
1342 - .domain.com
1343 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02001344 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001345 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001346 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01001347 ftp: ftp://proxy.host.local:2121
1348 http: http://proxy.host.local:3142
1349 https: https://proxy.host.local:3143
1350 noproxy:
1351 - .domain.com
1352 - .local
1353
1354Configure profile.d scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01001355
Ales Komarek417e8c52017-08-25 15:10:29 +02001356The profile.d scripts are being sourced during .sh execution and support
1357variable expansion in opposite to /etc/environment global settings in
1358``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01001359
1360.. code-block:: yaml
1361
1362 linux:
1363 system:
1364 profile:
1365 locales: |
1366 export LANG=C
1367 export LC_ALL=C
1368 ...
1369 vi_flavors.sh: |
1370 export PAGER=view
1371 export EDITOR=vim
1372 alias vi=vim
1373 shell_locales.sh: |
1374 export LANG=en_US
1375 export LC_ALL=en_US.UTF-8
1376 shell_proxies.sh: |
1377 export FTP_PROXY=ftp://127.0.3.3:2121
1378 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02001379
1380Linux with hosts
1381
Filip Pytloun86506fe2017-01-26 14:36:16 +01001382Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
1383that are not defined in model except defaults for both IPv4 and IPv6 localhost
1384and hostname + fqdn.
Ales Komarek417e8c52017-08-25 15:10:29 +02001385
Filip Pytloun86506fe2017-01-26 14:36:16 +01001386It's good to use this option if you want to ensure /etc/hosts is always in a
1387clean state however it's not enabled by default for safety.
1388
Filip Pytlounf5383a42015-10-06 16:28:32 +02001389.. code-block:: yaml
1390
1391 linux:
1392 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001393 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001394 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001395 # No need to define this one if purge_hosts is true
1396 hostname:
1397 address: 127.0.1.1
1398 names:
1399 - ${linux:network:fqdn}
1400 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02001401 node1:
1402 address: 192.168.10.200
1403 names:
1404 - node2.domain.com
1405 - service2.domain.com
1406 node2:
1407 address: 192.168.10.201
1408 names:
1409 - node2.domain.com
1410 - service2.domain.com
1411
Ales Komarek417e8c52017-08-25 15:10:29 +02001412Linux with hosts collected from mine
1413
1414In this case all dns records defined within infrastrucuture will be passed to
1415local hosts records or any DNS server. Only hosts with `grain` parameter to
1416true will be propagated to the mine.
1417
1418.. code-block:: yaml
1419
1420 linux:
1421 network:
1422 purge_hosts: true
1423 mine_dns_records: true
1424 host:
1425 node1:
1426 address: 192.168.10.200
1427 grain: true
1428 names:
1429 - node2.domain.com
1430 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01001431
Filip Pytlounde9bea52016-01-11 15:39:10 +01001432Setup resolv.conf, nameservers, domain and search domains
1433
1434.. code-block:: yaml
1435
1436 linux:
1437 network:
1438 resolv:
1439 dns:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001440 - 8.8.4.4
1441 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01001442 domain: my.example.com
1443 search:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001444 - my.example.com
1445 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01001446 options:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001447 - ndots: 5
1448 - timeout: 2
1449 - attempts: 2
Filip Pytlounde9bea52016-01-11 15:39:10 +01001450
Ales Komarek417e8c52017-08-25 15:10:29 +02001451setting custom TX queue length for tap interfaces
Andrii Petrenko735761d2017-03-21 17:17:35 -07001452
1453.. code-block:: yaml
1454
1455 linux:
1456 network:
1457 tap_custom_txqueuelen: 10000
1458
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001459DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001460
1461**DPDK OVS NIC**
1462
1463.. code-block:: yaml
1464
1465 linux:
1466 network:
1467 bridge: openvswitch
1468 dpdk:
1469 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001470 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001471 openvswitch:
1472 pmd_cpu_mask: "0x6"
1473 dpdk_socket_mem: "1024,1024"
1474 dpdk_lcore_mask: "0x400"
1475 memory_channels: 2
1476 interface:
1477 dpkd0:
1478 name: ${_param:dpdk_nic}
1479 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001480 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001481 enabled: true
1482 type: dpdk_ovs_port
1483 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001484 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001485 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01001486 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001487 br-prv:
1488 enabled: true
1489 type: dpdk_ovs_bridge
1490
1491**DPDK OVS Bond**
1492
1493.. code-block:: yaml
1494
1495 linux:
1496 network:
1497 bridge: openvswitch
1498 dpdk:
1499 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001500 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001501 openvswitch:
1502 pmd_cpu_mask: "0x6"
1503 dpdk_socket_mem: "1024,1024"
1504 dpdk_lcore_mask: "0x400"
1505 memory_channels: 2
1506 interface:
1507 dpdk_second_nic:
1508 name: ${_param:primary_second_nic}
1509 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001510 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001511 bond: dpdkbond0
1512 enabled: true
1513 type: dpdk_ovs_port
1514 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001515 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001516 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001517 dpdk_first_nic:
1518 name: ${_param:primary_first_nic}
1519 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001520 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001521 bond: dpdkbond0
1522 enabled: true
1523 type: dpdk_ovs_port
1524 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001525 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001526 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001527 dpdkbond0:
1528 enabled: true
1529 bridge: br-prv
1530 type: dpdk_ovs_bond
1531 mode: active-backup
1532 br-prv:
1533 enabled: true
1534 type: dpdk_ovs_bridge
1535
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01001536**DPDK OVS LACP Bond with vlan tag**
1537
1538.. code-block:: yaml
1539
1540 linux:
1541 network:
1542 bridge: openvswitch
1543 dpdk:
1544 enabled: true
1545 driver: uio
1546 openvswitch:
1547 pmd_cpu_mask: "0x6"
1548 dpdk_socket_mem: "1024,1024"
1549 dpdk_lcore_mask: "0x400"
1550 memory_channels: "2"
1551 interface:
1552 eth3:
1553 enabled: true
1554 type: eth
1555 proto: manual
1556 name: ${_param:tenant_first_nic}
1557 eth4:
1558 enabled: true
1559 type: eth
1560 proto: manual
1561 name: ${_param:tenant_second_nic}
1562 dpdk0:
1563 name: ${_param:tenant_first_nic}
1564 pci: "0000:81:00.0"
1565 driver: igb_uio
1566 bond: bond1
1567 enabled: true
1568 type: dpdk_ovs_port
1569 n_rxq: 2
1570 dpdk1:
1571 name: ${_param:tenant_second_nic}
1572 pci: "0000:81:00.1"
1573 driver: igb_uio
1574 bond: bond1
1575 enabled: true
1576 type: dpdk_ovs_port
1577 n_rxq: 2
1578 bond1:
1579 enabled: true
1580 bridge: br-prv
1581 type: dpdk_ovs_bond
1582 mode: balance-slb
1583 br-prv:
1584 enabled: true
1585 type: dpdk_ovs_bridge
1586 tag: ${_param:tenant_vlan}
1587 address: ${_param:tenant_address}
1588 netmask: ${_param:tenant_network_netmask}
1589
Jakub Pavlikaa759062017-03-13 15:57:26 +01001590**DPDK OVS bridge for VXLAN**
1591
1592If VXLAN is used as tenant segmentation then ip address must be set on br-prv
1593
1594.. code-block:: yaml
1595
1596 linux:
1597 network:
1598 ...
1599 interface:
1600 br-prv:
1601 enabled: true
1602 type: dpdk_ovs_bridge
1603 address: 192.168.50.0
1604 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04001605 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01001606 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001607
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02001608
1609
1610**DPDK OVS bridge with Linux network interface**
1611
1612.. code-block:: yaml
1613
1614 linux:
1615 network:
1616 ...
1617 interface:
1618 eth0:
1619 type: eth
1620 ovs_bridge: br-prv
1621 ...
1622 br-prv:
1623 enabled: true
1624 type: dpdk_ovs_bridge
1625 ...
1626
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001627Linux storage
1628-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02001629
1630Linux with mounted Samba
1631
1632.. code-block:: yaml
1633
1634 linux:
1635 storage:
1636 enabled: true
1637 mount:
1638 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01001639 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001640 - path: /media/myuser/public/
1641 - device: //192.168.0.1/storage
1642 - file_system: cifs
1643 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
1644
Jiri Broulikb017f932017-03-31 13:55:36 +02001645NFS mount
1646
1647.. code-block:: yaml
1648
1649 linux:
1650 storage:
1651 enabled: true
1652 mount:
1653 nfs_glance:
1654 enabled: true
1655 path: /var/lib/glance/images
1656 device: 172.16.10.110:/var/nfs/glance
1657 file_system: nfs
1658 opts: rw,sync
1659
1660
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001661File swap configuration
Filip Pytlounf5383a42015-10-06 16:28:32 +02001662
1663.. code-block:: yaml
1664
1665 linux:
1666 storage:
1667 enabled: true
1668 swap:
1669 file:
1670 enabled: true
1671 engine: file
1672 device: /swapfile
1673 size: 1024
1674
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001675Partition swap configuration
Lachlan Evenson30676512016-01-22 15:43:28 -08001676
1677.. code-block:: yaml
1678
1679 linux:
1680 storage:
1681 enabled: true
1682 swap:
1683 partition:
1684 enabled: true
1685 engine: partition
1686 device: /dev/vg0/swap
1687
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001688LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
1689
1690.. code-block:: yaml
1691
1692 parameters:
1693 linux:
1694 storage:
1695 mount:
1696 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01001697 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001698 device: /dev/vg1/data
1699 file_system: ext4
1700 path: /mnt/data
1701 lvm:
1702 vg1:
1703 enabled: true
1704 devices:
1705 - /dev/sdb
1706 volume:
1707 data:
1708 size: 40G
1709 mount: ${linux:storage:mount:data}
1710
Jakub Pavlik4f742142017-08-08 15:05:50 +02001711Create partitions on disk. Specify size in MB. It expects empty
Piotr Krukd51911b2017-12-04 11:27:08 +01001712disk without any existing partitions. (set startsector=1, if you want to start partitions from 2048)
Jakub Pavlik4f742142017-08-08 15:05:50 +02001713
1714.. code-block:: yaml
1715
1716 linux:
1717 storage:
1718 disk:
1719 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01001720 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02001721 name: /dev/loop1
1722 type: gpt
1723 partitions:
1724 - size: 200 #size in MB
1725 type: fat32
1726 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02001727 mkfs: True
1728 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02001729 /dev/vda1:
1730 partitions:
1731 - size: 5
1732 type: ext2
1733 - size: 10
1734 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02001735
1736Multipath with Fujitsu Eternus DXL
1737
1738.. code-block:: yaml
1739
1740 parameters:
1741 linux:
1742 storage:
1743 multipath:
1744 enabled: true
1745 blacklist_devices:
1746 - /dev/sda
1747 - /dev/sdb
1748 backends:
1749 - fujitsu_eternus_dxl
1750
1751Multipath with Hitachi VSP 1000
1752
1753.. code-block:: yaml
1754
1755 parameters:
1756 linux:
1757 storage:
1758 multipath:
1759 enabled: true
1760 blacklist_devices:
1761 - /dev/sda
1762 - /dev/sdb
1763 backends:
1764 - hitachi_vsp1000
1765
1766Multipath with IBM Storwize
1767
1768.. code-block:: yaml
1769
1770 parameters:
1771 linux:
1772 storage:
1773 multipath:
1774 enabled: true
1775 blacklist_devices:
1776 - /dev/sda
1777 - /dev/sdb
1778 backends:
1779 - ibm_storwize
1780
1781Multipath with multiple backends
1782
1783.. code-block:: yaml
1784
1785 parameters:
1786 linux:
1787 storage:
1788 multipath:
1789 enabled: true
1790 blacklist_devices:
1791 - /dev/sda
1792 - /dev/sdb
1793 - /dev/sdc
1794 - /dev/sdd
1795 backends:
1796 - ibm_storwize
1797 - fujitsu_eternus_dxl
1798 - hitachi_vsp1000
1799
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001800PAM LDAP integration
1801
1802.. code-block:: yaml
1803
1804 parameters:
1805 linux:
1806 system:
1807 auth:
1808 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02001809 mkhomedir:
1810 enabled: true
1811 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001812 ldap:
1813 enabled: true
1814 binddn: cn=bind,ou=service_users,dc=example,dc=com
1815 bindpw: secret
1816 uri: ldap://127.0.0.1
1817 base: ou=users,dc=example,dc=com
1818 ldap_version: 3
1819 pagesize: 65536
1820 referrals: off
1821 filter:
1822 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1823 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1824 group: (&(objectClass=group)(gidNumber=*))
1825
Ales Komareka634f4b2016-10-02 13:11:04 +02001826Disabled multipath (the default setup)
1827
1828.. code-block:: yaml
1829
1830 parameters:
1831 linux:
1832 storage:
1833 multipath:
1834 enabled: false
1835
Simon Pasquier375001e2017-01-26 13:22:33 +01001836Linux with local loopback device
1837
1838.. code-block:: yaml
1839
1840 linux:
1841 storage:
1842 loopback:
1843 disk1:
1844 file: /srv/disk1
1845 size: 50G
1846
Filip Pytlounb2c8f852016-11-21 17:03:43 +01001847External config generation
1848--------------------------
1849
1850You are able to use config support metadata between formulas and only generate
1851config files for external use, eg. docker, etc.
1852
1853.. code-block:: yaml
1854
1855 parameters:
1856 linux:
1857 system:
1858 config:
1859 pillar:
1860 jenkins:
1861 master:
1862 home: /srv/volumes/jenkins
1863 approved_scripts:
1864 - method java.net.URL openConnection
1865 credentials:
1866 - type: username_password
1867 scope: global
1868 id: test
1869 desc: Testing credentials
1870 username: test
1871 password: test
1872
Vladimir Ereminccf28842017-04-10 23:52:10 +03001873Netconsole Remote Kernel Logging
1874--------------------------------
1875
1876Netconsole logger could be configured for configfs-enabled kernels
1877(`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in
1878runtime (if network is already configured), and on-boot after interface
1879initialization. Notes:
1880
1881 * receiver could be located only in same L3 domain
1882 (or you need to configure gateway MAC manually)
1883 * receiver's MAC is detected only on configuration time
1884 * using broadcast MAC is not recommended
1885
1886.. code-block:: yaml
1887
1888 parameters:
1889 linux:
1890 system:
1891 netconsole:
1892 enabled: true
1893 port: 514 (optional)
1894 loglevel: debug (optional)
1895 target:
1896 192.168.0.1:
1897 interface: bond0
1898 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02001899
Filip Pytlounf5383a42015-10-06 16:28:32 +02001900Usage
1901=====
1902
1903Set mtu of network interface eth0 to 1400
1904
1905.. code-block:: bash
1906
1907 ip link set dev eth0 mtu 1400
1908
1909Read more
1910=========
1911
1912* https://www.archlinux.org/
1913* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
Filip Pytloun018f8712017-02-02 13:02:03 +01001914
1915Documentation and Bugs
1916======================
1917
1918To learn how to install and update salt-formulas, consult the documentation
1919available online at:
1920
1921 http://salt-formulas.readthedocs.io/
1922
1923In the unfortunate event that bugs are discovered, they should be reported to
1924the appropriate issue tracker. Use Github issue tracker for specific salt
1925formula:
1926
1927 https://github.com/salt-formulas/salt-formula-linux/issues
1928
1929For feature requests, bug reports or blueprints affecting entire ecosystem,
1930use Launchpad salt-formulas project:
1931
1932 https://launchpad.net/salt-formulas
1933
1934You can also join salt-formulas-users team and subscribe to mailing list:
1935
1936 https://launchpad.net/~salt-formulas-users
1937
1938Developers wishing to work on the salt-formulas projects should always base
1939their work on master branch and submit pull request against specific formula.
1940
1941 https://github.com/salt-formulas/salt-formula-linux
1942
1943Any questions or feedback is always welcome so feel free to join our IRC
1944channel:
1945
1946 #salt-formulas @ irc.freenode.net