blob: a99449884450b6f3c6671a642899312821e76553 [file] [log] [blame]
Aleš Komárek63572992017-04-11 13:16:44 +02001============
2Linux Fomula
3============
Filip Pytlounf5383a42015-10-06 16:28:32 +02004
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03005Linux Operating Systems:
Filip Pytlounf5383a42015-10-06 16:28:32 +02006
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 +020016Linux System
Filip Pytlounf5383a42015-10-06 16:28:32 +020017------------
18
19Basic Linux box
20
21.. code-block:: yaml
22
23 linux:
24 system:
25 enabled: true
26 name: 'node1'
27 domain: 'domain.com'
28 cluster: 'system'
29 environment: prod
30 timezone: 'Europe/Prague'
31 utc: true
32
azvyagintsev967af132017-06-12 12:25:24 +030033Linux with system users, some with password set:
OlgaGusarenko2828f5f2018-07-30 19:37:05 +030034
35.. warning:: If no ``password`` variable is passed,
36 any predifined password will be removed.
Filip Pytlounf5383a42015-10-06 16:28:32 +020037
38.. code-block:: yaml
39
40 linux:
41 system:
42 ...
43 user:
44 jdoe:
45 name: 'jdoe'
46 enabled: true
47 sudo: true
48 shell: /bin/bash
49 full_name: 'Jonh Doe'
50 home: '/home/jdoe'
Martin Polreich4fcd5c02018-07-16 09:41:51 +020051 home_dir_mode: 755
Filip Pytlounf5383a42015-10-06 16:28:32 +020052 email: 'jonh@doe.com'
Dzmitry Stremkouskia0d8b2d2018-10-22 14:12:05 +020053 unique: false
Dzmitry Stremkouskifae59fb2018-11-21 10:10:10 +010054 groups:
55 - db-ops
56 - salt-ops
57 optional_groups:
58 - docker
Filip Pytlounf5383a42015-10-06 16:28:32 +020059 jsmith:
60 name: 'jsmith'
61 enabled: true
azvyagintsev967af132017-06-12 12:25:24 +030062 full_name: 'With clear password'
Filip Pytlounf5383a42015-10-06 16:28:32 +020063 home: '/home/jsmith'
azvyagintsev967af132017-06-12 12:25:24 +030064 hash_password: true
65 password: "userpassword"
66 mark:
67 name: 'mark'
68 enabled: true
69 full_name: "unchange password'
70 home: '/home/mark'
71 password: false
72 elizabeth:
73 name: 'elizabeth'
74 enabled: true
75 full_name: 'With hased password'
76 home: '/home/elizabeth'
77 password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10"
Filip Pytlounf5383a42015-10-06 16:28:32 +020078
Martin Polreichb6e6fbc2019-10-22 15:08:01 +020079Remove users data completely and terminate all user's processes:
Dzmitry Stremkouski6839f542019-09-04 14:15:09 +020080
81.. code-block:: yaml
82
83 linux:
84 system:
85 user:
86 example:
87 email: disabled
88 enabled: false
89 full_name: disabled
90 name: example
91 force_delete: True
92
Dmitry Teselkin8e903562019-02-21 16:40:23 +030093Setting user defaults
94---------------------
95Default parameters that will be used by `useradd` command could be configured
96the following way:
97
98.. code-block:: yaml
99
100 linux:
101 system:
102 ...
103 defaults:
104 user:
105 shell: <SHELL>
106 gid: <GROUP>
107 home: <HOME>
108 inactdays: <INACTIVE>
109 expire: <EXPIRE>
110 skeleton: <SKEL>
111 create_mail_spool: <CREATE_MAIL_SPOOL>
112
113Other parameters that are used when creating user profile could be configured
114as well, acting as global defaults:
115
116.. code-block:: yaml
117
118 linux:
119 system:
120 ...
121 defaults:
122 user:
123 ...
124 maxdays: <PASS_MAX_DAYS>
125 mindays: <PASS_MIN_DAYS>
126 warndays: <PASS_WARN_AGE>
127
128.. note::
129
130 The three options above ('maxdays', 'mindays', 'warndays') could be
131 overriden in linux:system:login_defs using their 'real' names.
132 The reason they could be defined here is that it's quite logical to
133 have these parameters related to configuration of user account
134 behaviour in one place.
135
136
Dmitry Teselkin47e41f42018-09-27 14:10:09 +0300137Configure password expiration parameters
138----------------------------------------
139The following login.defs parameters can be overridden per-user:
140
141* PASS_MAX_DAYS
142* PASS_MIN_DAYS
143* PASS_WARN_DAYS
Dmitry Teselkin47e41f42018-09-27 14:10:09 +0300144
145.. code-block:: yaml
146
147 linux:
148 system:
149 ...
150 user:
151 jdoe:
152 name: 'jdoe'
153 enabled: true
154 ...
155 maxdays: <PASS_MAX_DAYS>
156 mindays: <PASS_MIN_DAYS>
Dmitry Teselkin8e903562019-02-21 16:40:23 +0300157 warndays: <PASS_WARN_AGE>
Dmitry Teselkin47e41f42018-09-27 14:10:09 +0300158
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100159Configure sudo for users and groups under ``/etc/sudoers.d/``.
160This ways ``linux.system.sudo`` pillar map to actual sudo attributes:
161
162.. code-block:: jinja
Aleš Komárek63572992017-04-11 13:16:44 +0200163
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100164 # simplified template:
165 Cmds_Alias {{ alias }}={{ commands }}
166 {{ user }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
167 %{{ group }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
168
169 # when rendered:
170 saltuser1 ALL=(ALL) NOPASSWD: ALL
171
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100172.. code-block:: yaml
Aleš Komárek63572992017-04-11 13:16:44 +0200173
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100174 linux:
175 system:
176 sudo:
177 enabled: true
Tomas Kammd8eb3002017-05-08 19:30:29 +0200178 aliases:
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100179 host:
180 LOCAL:
181 - localhost
182 PRODUCTION:
183 - db1
184 - db2
185 runas:
186 DBA:
187 - postgres
188 - mysql
189 SALT:
190 - root
191 command:
192 # Note: This is not 100% safe when ALL keyword is used, user still may modify configs and hide his actions.
193 # Best practice is to specify full list of commands user is allowed to run.
194 SUPPORT_RESTRICTED:
195 - /bin/vi /etc/sudoers*
196 - /bin/vim /etc/sudoers*
197 - /bin/nano /etc/sudoers*
198 - /bin/emacs /etc/sudoers*
199 - /bin/su - root
200 - /bin/su -
201 - /bin/su
202 - /usr/sbin/visudo
203 SUPPORT_SHELLS:
204 - /bin/sh
205 - /bin/ksh
206 - /bin/bash
207 - /bin/rbash
208 - /bin/dash
209 - /bin/zsh
210 - /bin/csh
211 - /bin/fish
212 - /bin/tcsh
213 - /usr/bin/login
214 - /usr/bin/su
215 - /usr/su
216 ALL_SALT_SAFE:
217 - /usr/bin/salt state*
218 - /usr/bin/salt service*
219 - /usr/bin/salt pillar*
220 - /usr/bin/salt grains*
221 - /usr/bin/salt saltutil*
222 - /usr/bin/salt-call state*
223 - /usr/bin/salt-call service*
224 - /usr/bin/salt-call pillar*
225 - /usr/bin/salt-call grains*
226 - /usr/bin/salt-call saltutil*
227 SALT_TRUSTED:
228 - /usr/bin/salt*
229 users:
230 # saltuser1 with default values: saltuser1 ALL=(ALL) NOPASSWD: ALL
231 saltuser1: {}
232 saltuser2:
233 hosts:
234 - LOCAL
235 # User Alias DBA
236 DBA:
237 hosts:
238 - ALL
239 commands:
240 - ALL_SALT_SAFE
241 groups:
242 db-ops:
243 hosts:
244 - ALL
245 - '!PRODUCTION'
246 runas:
247 - DBA
248 commands:
249 - /bin/cat *
250 - /bin/less *
251 - /bin/ls *
252 salt-ops:
253 hosts:
254 - 'ALL'
255 runas:
256 - SALT
257 commands:
258 - SUPPORT_SHELLS
259 salt-ops-2nd:
260 name: salt-ops
261 nopasswd: false
Jakub Josef7a9d9b92017-05-16 11:39:01 +0200262 setenv: true # Enable sudo -E option
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100263 runas:
264 - DBA
265 commands:
266 - ALL
267 - '!SUPPORT_SHELLS'
268 - '!SUPPORT_RESTRICTED'
269
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300270Linux with package, latest version:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200271
272.. code-block:: yaml
273
274 linux:
275 system:
276 ...
277 package:
278 package-name:
279 version: latest
280
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300281Linux with package from certail repo, version with no upgrades:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200282
283.. code-block:: yaml
284
285 linux:
286 system:
287 ...
288 package:
289 package-name:
290 version: 2132.323
291 repo: 'custom-repo'
292 hold: true
293
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300294Linux with package from certail repo, version with no GPG
295verification:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200296
297.. code-block:: yaml
298
299 linux:
300 system:
301 ...
302 package:
303 package-name:
304 version: 2132.323
305 repo: 'custom-repo'
306 verify: false
307
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300308Linux with autoupdates (automatically install security package
309updates):
Bruno Binet69a9d8d2017-02-16 22:34:32 +0100310
311.. code-block:: yaml
312
313 linux:
314 system:
315 ...
316 autoupdates:
317 enabled: true
318 mail: root@localhost
319 mail_only_on_error: true
320 remove_unused_dependencies: false
321 automatic_reboot: true
322 automatic_reboot_time: "02:00"
323
Dmitry Teselkin0f084a02018-08-29 14:46:38 +0300324Managing cron tasks
325-------------------
326
327There are two data structures that are related to managing cron itself and
328cron tasks:
329
330.. code-block:: yaml
331
332 linux:
333 system:
334 cron:
335
336and
337
338.. code-block:: yaml
339
340 linux:
341 system:
342 job:
343
344`linux:system:cron` manages cron packages, services, and '/etc/cron.allow' file.
345
346'deny' files are managed the only way - we're ensuring they are absent, that's
347a requirement from CIS 5.1.8
348
349'cron' pillar structure is the following:
350
351.. code-block:: yaml
352
353 linux:
354 system:
355 cron:
356 enabled: true
357 pkgs: [ <cron packages> ]
358 services: [ <cron services> ]
359 user:
360 <username>:
361 enabled: true
362
363To add user to '/etc/cron.allow' use 'enabled' key as shown above.
364
365'/etc/cron.deny' is not managed as CIS 5.1.8 requires it was removed.
366
367A user would be ignored if any of the following is true:
368* user is disabled in `linux:system:user:<username>`
369* user is disabled in `linux:system:cron:user:<username>`
370
371`linux:system:job` manages individual cron tasks.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300372
373By default, it will use name as an identifier, unless identifier key is
Filip Pytloun91222222017-08-04 10:55:27 +0200374explicitly set or False (then it will use Salt's default behavior which is
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300375identifier same as command resulting in not being able to change it):
Filip Pytlounf5383a42015-10-06 16:28:32 +0200376
377.. code-block:: yaml
378
379 linux:
380 system:
381 ...
382 job:
383 cmd1:
384 command: '/cmd/to/run'
Filip Pytloun91222222017-08-04 10:55:27 +0200385 identifier: cmd1
Filip Pytlounf5383a42015-10-06 16:28:32 +0200386 enabled: true
387 user: 'root'
388 hour: 2
389 minute: 0
390
Dmitry Teselkin0f084a02018-08-29 14:46:38 +0300391Managing 'at' tasks
392-------------------
393
394Pillar for managing `at` tasks is similar to one for `cron` tasks:
395
396.. code-block:: yaml
397
398 linux:
399 system:
400 at:
401 enabled: true
402 pkgs: [ <at packages> ]
403 services: [ <at services> ]
404 user:
405 <username>:
406 enabled: true
407
408To add a user to '/etc/at.allow' use 'enabled' key as shown above.
409
410'/etc/at.deny' is not managed as CIS 5.1.8 requires it was removed.
411
412A user will be ignored if any of the following is true:
413* user is disabled in `linux:system:user:<username>`
414* user is disabled in `linux:system:at:user:<username>`
415
416
Filip Pytlound0a29e72015-11-30 15:23:34 +0100417Linux security limits (limit sensu user memory usage to max 1GB):
418
419.. code-block:: yaml
420
421 linux:
422 system:
423 ...
424 limit:
425 sensu:
426 enabled: true
427 domain: sensu
428 limits:
429 - type: hard
430 item: as
431 value: 1000000
432
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300433Enable autologin on ``tty1`` (may work only for Ubuntu 14.04):
Filip Pytloun7fee0542015-10-15 11:19:24 +0200434
435.. code-block:: yaml
436
437 linux:
438 system:
439 console:
440 tty1:
441 autologin: root
Filip Pytloun281d0202016-01-29 14:03:51 +0100442 # Enable serial console
443 ttyS0:
444 autologin: root
445 rate: 115200
446 term: xterm
Filip Pytloun7fee0542015-10-15 11:19:24 +0200447
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300448To disable set autologin to ``false``.
Filip Pytloun7fee0542015-10-15 11:19:24 +0200449
Filip Pytloun7731b852016-02-01 11:13:47 +0100450Set ``policy-rc.d`` on Debian-based systems. Action can be any available
451command in ``while true`` loop and ``case`` context.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300452Following will disallow dpkg to stop/start services for the Cassandra
453package automatically:
Filip Pytloun7731b852016-02-01 11:13:47 +0100454
455.. code-block:: yaml
456
457 linux:
458 system:
459 policyrcd:
460 - package: cassandra
461 action: exit 101
462 - package: '*'
463 action: switch
464
Filip Pytlounc49445a2016-04-04 14:23:20 +0200465Set system locales:
466
467.. code-block:: yaml
468
469 linux:
470 system:
471 locale:
472 en_US.UTF-8:
473 default: true
Filip Pytlounee1745f2016-04-04 17:39:41 +0200474 "cs_CZ.UTF-8 UTF-8":
Filip Pytlounc49445a2016-04-04 14:23:20 +0200475 enabled: true
476
Andrey Shestakove7cca052017-05-24 23:06:24 +0300477Systemd settings:
478
479.. code-block:: yaml
480
481 linux:
482 system:
483 ...
484 systemd:
485 system:
486 Manager:
487 DefaultLimitNOFILE: 307200
488 DefaultLimitNPROC: 307200
489 user:
490 Manager:
491 DefaultLimitCPU: 2
492 DefaultLimitNPROC: 4
493
Filip Pytloun8b2131e2017-11-08 13:29:03 +0100494Ensure presence of directory:
495
496.. code-block:: yaml
497
498 linux:
499 system:
500 directory:
501 /tmp/test:
502 user: root
503 group: root
504 mode: 700
505 makedirs: true
506
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300507Ensure presence of file by specifying its source:
Richard Felkl2e07d652018-01-19 10:19:06 +0100508
509.. code-block:: yaml
510
511 linux:
512 system:
513 file:
514 /tmp/test.txt:
515 source: http://example.com/test.txt
Richard Felklf40599a2018-02-06 22:56:41 +0100516 user: root #optional
517 group: root #optional
518 mode: 700 #optional
519 dir_mode: 700 #optional
520 encoding: utf-8 #optional
521 hash: <<hash>> or <<URI to hash>> #optional
522 makedirs: true #optional
523
524 linux:
525 system:
526 file:
527 test.txt:
528 name: /tmp/test.txt
529 source: http://example.com/test.txt
Richard Felkl2e07d652018-01-19 10:19:06 +0100530
Gabor Orosz35815c02018-09-07 17:31:05 +0200531 linux:
532 system:
533 file:
534 test2:
535 name: /tmp/test2.txt
536 source: http://example.com/test2.jinja
537 template: jinja
538
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300539Ensure presence of file by specifying its contents:
Richard Felkl2e07d652018-01-19 10:19:06 +0100540
541.. code-block:: yaml
542
543 linux:
544 system:
545 file:
546 /tmp/test.txt:
547 contents: |
548 line1
549 line2
Richard Felklf40599a2018-02-06 22:56:41 +0100550
551 linux:
552 system:
553 file:
554 /tmp/test.txt:
555 contents_pillar: linux:network:hostname
556
557 linux:
558 system:
559 file:
560 /tmp/test.txt:
561 contents_grains: motd
562
Ivan Berezovskiyf9301e12019-07-22 13:14:14 +0400563Ensure presence of file by specifying its secured source:
564
565.. code-block:: yaml
566
567 linux:
568 system:
569 file:
570 /tmp/test.txt:
571 secured_source:
572 protocol: http #optional
573 user: foo
574 password: bar
575 url: example.com/test.txt
576 secured_hash: #optional
577 url: example.com/test.txt.md5
578 user: root #optional
579 group: root #optional
580 mode: 700 #optional
581 dir_mode: 700 #optional
582 encoding: utf-8 #optional
583 makedirs: true #optional
584
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300585Ensure presence of file to be serialized through one of the
586serializer modules (see:
587https://docs.saltstack.com/en/latest/ref/serializers/all/index.html):
Bruno Binet9c2fe222018-06-08 16:57:32 +0200588
589.. code-block:: yaml
590
591 linux:
592 system:
593 file:
594 /tmp/test.json:
595 serialize: json
596 contents:
597 foo: 1
598 bar: 'bar'
599
agoriunovd7b19ce2019-02-18 11:37:32 +0200600Ensure presence of file to be decoded through file.decode module (see:
601https://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html#salt.states.file.decode):
602
603.. code-block:: yaml
604
605 linux:
606 system:
607 file:
608 /tmp/test4.txt:
609 decode: True
610 encoded_data: |
611 dGVzdDQK
612
Filip Pytloun281034a2016-01-04 18:06:22 +0100613Kernel
614~~~~~~
615
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300616Install always up to date LTS kernel and headers from Ubuntu Trusty:
Filip Pytloun281034a2016-01-04 18:06:22 +0100617
618.. code-block:: yaml
619
620 linux:
621 system:
622 kernel:
623 type: generic
624 lts: trusty
625 headers: true
626
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300627Load kernel modules and add them to ``/etc/modules``:
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100628
629.. code-block:: yaml
630
631 linux:
632 system:
633 kernel:
634 modules:
635 - nf_conntrack
636 - tp_smapi
637 - 8021q
638
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300639Configure or blacklist kernel modules with additional options to
640``/etc/modprobe.d`` following example will add
641``/etc/modprobe.d/nf_conntrack.conf`` file with line
642``options nf_conntrack hashsize=262144``:
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300643
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300644'option' can be a mapping (with 'enabled' and 'value' keys) or a scalar.
645
646Example for 'scalar' option value:
647
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300648.. code-block:: yaml
649
650 linux:
651 system:
652 kernel:
653 module:
654 nf_conntrack:
655 option:
656 hashsize: 262144
657
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300658Example for 'mapping' option value:
659
660.. code-block:: yaml
661
662 linux:
663 system:
664 kernel:
665 module:
666 nf_conntrack:
667 option:
668 hashsize:
669 enabled: true
670 value: 262144
671
672NOTE: 'enabled' key is optional and is True by default.
673
674Blacklist a module:
675
676.. code-block:: yaml
677
678 linux:
679 system:
680 kernel:
681 module:
682 nf_conntrack:
683 blacklist: true
684
685A module can have a number of aliases, wildcards are allowed.
686Define an alias for a module:
687
688.. code-block:: yaml
689
690 linux:
691 system:
692 kernel:
693 module:
694 nf_conntrack:
695 alias:
696 nfct:
697 enabled: true
698 "nf_conn*":
699 enabled: true
700
701NOTE: 'enabled' key is mandatory as there are no other keys exist.
702
703Execute custom command instead of 'insmod' when inserting a module:
704
705.. code-block:: yaml
706
707 linux:
708 system:
709 kernel:
710 module:
711 nf_conntrack:
712 install:
713 enabled: true
714 command: /bin/true
715
716NOTE: 'enabled' key is optional and is True by default.
717
718Execute custom command instead of 'rmmod' when removing a module:
719
720.. code-block:: yaml
721
722 linux:
723 system:
724 kernel:
725 module:
726 nf_conntrack:
727 remove:
728 enabled: true
729 command: /bin/true
730
731NOTE: 'enabled' key is optional and is True by default.
732
733Define module dependencies:
734
735.. code-block:: yaml
736
737 linux:
738 system:
739 kernel:
740 module:
741 nf_conntrack:
742 softdep:
743 pre:
744 1:
745 enabled: true
746 value: a
747 2:
748 enabled: true
749 value: b
750 3:
751 enabled: true
752 value: c
753 post:
754 1:
755 enabled: true
756 value: x
757 2:
758 enabled: true
759 value: y
760 3:
761 enabled: true
762 value: z
763
764NOTE: 'enabled' key is optional and is True by default.
765
766
Filip Pytloun281034a2016-01-04 18:06:22 +0100767Install specific kernel version and ensure all other kernel packages are
768not present. Also install extra modules and headers for this kernel:
769
770.. code-block:: yaml
771
772 linux:
773 system:
774 kernel:
775 type: generic
776 extra: true
777 headers: true
778 version: 4.2.0-22
779
Denis Egorenkofa2ee422019-11-06 14:02:00 +0400780Also it is possible to install Kernel with Hardware Enablement or virtual
781kernel packages. For example, for Xenial:
782
783.. code-block:: yaml
784
785 linux:
786 system:
787 kernel:
788 type: generic
789 extra: true
790 headers: true
791 version: 4.15.0-65
792 hwe:
793 type: hwe
794 version: 16.04
795 kernel_version: 4.15.0.65
796
797Set `linux:system:kernel:hwe:type:virtual` if you need Virtual kernel packages.
798
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300799Systcl kernel parameters:
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100800
801.. code-block:: yaml
802
803 linux:
804 system:
805 kernel:
806 sysctl:
807 net.ipv4.tcp_keepalive_intvl: 3
808 net.ipv4.tcp_keepalive_time: 30
809 net.ipv4.tcp_keepalive_probes: 8
810
Michael Polenchukebf55522018-01-25 13:22:39 +0400811Configure kernel boot options:
812
813.. code-block:: yaml
814
815 linux:
816 system:
817 kernel:
818 boot_options:
819 - elevator=deadline
820 - spectre_v2=off
821 - nopti
822
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100823CPU
824~~~
825
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300826Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100827
828.. code-block:: yaml
829
830 linux:
831 system:
832 cpu:
833 governor: performance
834
Nick Metzf04f5f32018-01-08 15:25:04 +0100835
Jiri Broulik303905d2018-01-11 14:12:48 +0100836CGROUPS
837~~~~~~~
838
839Setup linux cgroups:
840
841.. code-block:: yaml
842
843 linux:
844 system:
845 cgroup:
846 enabled: true
847 group:
848 ceph_group_1:
849 controller:
850 cpu:
851 shares:
852 value: 250
853 cpuacct:
854 usage:
855 value: 0
856 cpuset:
857 cpus:
858 value: 1,2,3
859 memory:
860 limit_in_bytes:
861 value: 2G
862 memsw.limit_in_bytes:
863 value: 3G
864 mapping:
865 subjects:
866 - '@ceph'
867 generic_group_1:
868 controller:
869 cpu:
870 shares:
871 value: 250
872 cpuacct:
873 usage:
874 value: 0
875 mapping:
876 subjects:
877 - '*:firefox'
878 - 'student:cp'
879
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300880Shared libraries
Nick Metzf04f5f32018-01-08 15:25:04 +0100881~~~~~~~~~~~~~~~~
882
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300883Set additional shared library to Linux system library path:
Nick Metzf04f5f32018-01-08 15:25:04 +0100884
885.. code-block:: yaml
886
887 linux:
888 system:
889 ld:
890 library:
891 java:
892 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
893 - /opt/java/jre/lib/amd64/server
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200894
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200895Certificates
896~~~~~~~~~~~~
897
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300898Add certificate authority into system trusted CA bundle:
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200899
900.. code-block:: yaml
901
902 linux:
903 system:
904 ca_certificates:
905 mycert: |
906 -----BEGIN CERTIFICATE-----
907 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
908 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
909 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
910 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
911 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
912 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
913 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
914 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
915 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
916 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
917 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
918 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
919 -----END CERTIFICATE-----
920
Filip Pytloun361096c2017-08-23 10:57:20 +0200921Sysfs
922~~~~~
923
924Install sysfsutils and set sysfs attributes:
925
926.. code-block:: yaml
927
928 linux:
929 system:
930 sysfs:
931 scheduler:
932 block/sda/queue/scheduler: deadline
933 power:
934 mode:
935 power/state: 0660
936 owner:
937 power/state: "root:power"
938 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
939
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200940Optional: You can also use list that will ensure order of items.
941
942.. code-block:: yaml
943
944 linux:
945 system:
946 sysfs:
947 scheduler:
948 block/sda/queue/scheduler: deadline
949 power:
950 - mode:
951 power/state: 0660
952 - owner:
953 power/state: "root:power"
954 - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
955
Martin Polreich148e1b82018-09-13 15:54:25 +0200956Sysfs definition with disabled automatic write. Attributes are saved
957to configuration, but are not applied during the run.
958Thay will be applied automatically after the reboot.
959
960
961.. code-block:: yaml
962
963 linux:
964 system:
965 sysfs:
966 enable_apply: false
967 scheduler:
968 block/sda/queue/scheduler: deadline
969
970.. note:: The `enable_apply` parameter defaults to `True` if not defined.
971
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100972Huge Pages
973~~~~~~~~~~~~
974
975Huge Pages give a performance boost to applications that intensively deal
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300976with memory allocation/deallocation by decreasing memory fragmentation:
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100977
978.. code-block:: yaml
979
980 linux:
981 system:
982 kernel:
983 hugepages:
984 small:
985 size: 2M
986 count: 107520
987 mount_point: /mnt/hugepages_2MB
Michael Polenchukd9369fe2018-05-08 17:53:08 +0400988 mount: false/true # default is true (mount immediately) / false (just save in the fstab)
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100989 large:
990 default: true # default automatically mounted
991 size: 1G
992 count: 210
993 mount_point: /mnt/hugepages_1GB
994
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300995.. note:: Not recommended to use both pagesizes concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100996
Jakub Pavlik5398d872017-02-13 22:30:47 +0100997Intel SR-IOV
998~~~~~~~~~~~~
999
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001000PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV)
1001specification defines a standardized mechanism to virtualize
1002PCIe devices. The mechanism can virtualize a single PCIe
1003Ethernet controller to appear as multiple PCIe devices:
Jakub Pavlik5398d872017-02-13 22:30:47 +01001004
1005.. code-block:: yaml
1006
1007 linux:
1008 system:
1009 kernel:
1010 sriov: True
1011 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
1012 rc:
1013 local: |
1014 #!/bin/sh -e
1015 # Enable 7 VF on eth1
1016 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
1017 exit 0
1018
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001019Isolate CPU options
1020~~~~~~~~~~~~~~~~~~~
1021
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001022Remove the specified CPUs, as defined by the cpu_number values, from
1023the general kernel SMP balancing and scheduler algroithms. The only
1024way to move a process onto or off an *isolated* CPU is via the CPU
1025affinity syscalls. ``cpu_number begins`` at ``0``, so the
1026maximum value is ``1`` less than the number of CPUs on the system.:
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001027
1028.. code-block:: yaml
1029
1030 linux:
1031 system:
1032 kernel:
1033 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +01001034
Filip Pytlounf5383a42015-10-06 16:28:32 +02001035Repositories
1036~~~~~~~~~~~~
1037
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001038RedHat-based Linux with additional OpenStack repo:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001039
1040.. code-block:: yaml
1041
1042 linux:
1043 system:
1044 ...
1045 repo:
1046 rdo-icehouse:
1047 enabled: true
1048 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
1049 pgpcheck: 0
1050
1051Ensure system repository to use czech Debian mirror (``default: true``)
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001052Also pin it's packages with priority ``900``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001053
1054.. code-block:: yaml
1055
1056 linux:
1057 system:
1058 repo:
1059 debian:
1060 default: true
1061 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
1062 # Import signing key from URL if needed
1063 key_url: "http://dummy.com/public.gpg"
1064 pin:
1065 - pin: 'origin "ftp.cz.debian.org"'
1066 priority: 900
1067 package: '*'
1068
azvyagintseva3a73d02018-12-06 14:49:58 +02001069Sometimes better to use one pining rule file, to decrease mistaken
1070ordering. You can use those option ``system:apt:preferences``, which would add opts into
1071``/etc/apt/preferences`` file:
1072
1073.. code-block:: yaml
1074
1075 parameters:
1076 linux:
1077 system:
1078 apt:
1079 preferences:
1080 enabled: true
1081 rules:
1082 100:
1083 enabled: true
1084 name: 'some origin pin'
1085 pin: 'release o=Debian'
1086 priority: 1100
1087 package: '*'
1088
1089
azvyagintsev4494a472018-09-14 19:19:23 +03001090If you need to add multiple pin rules for one repo, please use new,ordered definition format
1091('pinning' definition will be in priotity to use):
1092
1093.. code-block:: yaml
1094
1095 linux:
1096 system:
1097 repo:
1098 mcp_saltstack:
1099 source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main"
1100 architectures: amd64
1101 clean_file: true
1102 pinning:
1103 10:
1104 enabled: true
1105 pin: 'release o=SaltStack'
1106 priority: 50
1107 package: 'libsodium18'
1108 20:
1109 enabled: true
1110 pin: 'release o=SaltStack'
1111 priority: 1100
1112 package: '*'
1113
1114
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001115.. note:: For old Ubuntu releases (<xenial)
azvyagintsevff089d22018-07-27 16:52:34 +02001116 extra packages for apt transport, like ``apt-transport-https``
1117 may be required to be installed manually.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001118 (Chicken-eggs issue: we need to install packages to
azvyagintsevff089d22018-07-27 16:52:34 +02001119 reach repo from where they should be installed)
1120 Otherwise, you still can try 'fortune' and install prereq.packages before
1121 any repo configuration, using list of requires in map.jinja.
1122
1123
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001124Disabling any prerequisite packages installation:
1125
azvyagintsevff089d22018-07-27 16:52:34 +02001126You can simply drop any package pre-installation (before system.linux.repo
1127will be processed) via cluster lvl:
1128
1129.. code-block:: yaml
1130
1131 linux:
1132 system:
1133 pkgs: ~
1134
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001135Package manager proxy global setup:
Petr Michalec10462bb2017-03-23 19:18:08 +01001136
1137.. code-block:: yaml
1138
1139 linux:
1140 system:
1141 ...
1142 repo:
1143 apt-mk:
1144 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1145 ...
1146 proxy:
1147 pkg:
1148 enabled: true
1149 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1150 ...
1151 # NOTE: Global defaults for any other componet that configure proxy on the system.
1152 # If your environment has just one simple proxy, set it on linux:system:proxy.
1153 #
1154 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1155 # as for https and http
1156 ftp: ftp://proxy.host.local:2121
1157 http: http://proxy.host.local:3142
1158 https: https://proxy.host.local:3143
1159
1160Package manager proxy setup per repository:
1161
1162.. code-block:: yaml
1163
1164 linux:
1165 system:
1166 ...
1167 repo:
1168 debian:
1169 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1170 ...
1171 apt-mk:
1172 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1173 # per repository proxy
1174 proxy:
1175 enabled: true
1176 http: http://maas-01:8080
1177 https: http://maas-01:8080
1178 ...
1179 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001180 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +01001181 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
1182 pkg:
1183 enabled: true
1184 ftp: ftp://proxy.host.local:2121
1185 #http: http://proxy.host.local:3142
1186 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001187 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001188 # global system fallback system defaults
1189 ftp: ftp://proxy.host.local:2121
1190 http: http://proxy.host.local:3142
1191 https: https://proxy.host.local:3143
1192
Ivan Berezovskiy6335da52019-06-25 20:15:51 +04001193
1194Add secured apt repository:
1195
1196.. code-block:: yaml
1197
1198 linux:
1199 system:
1200 ...
1201 repo:
1202 test:
1203 secure: true
1204 url: example.org/ubuntu
1205 arch: deb
1206 protocol: http
1207 user: foo
1208 password: bar
1209 distribution: stable
1210 component: main
1211
1212Add multiply secured apt repositories with same credentials:
1213
1214.. code-block:: yaml
1215
1216 linux:
1217 system:
1218 ...
1219 common_repo_secured:
1220 arch: deb
1221 protocol: http
1222 user: foo
1223 password: bar
1224 distribution: stable
1225 component: main
1226 repo:
1227 test1:
1228 secure: true
1229 url: example1.org/ubuntu
1230 test2:
1231 secure: true
1232 url: example2.org/ubuntu
1233
Jiri Broulik34a29b42017-04-25 14:42:54 +02001234Remove all repositories:
1235
1236.. code-block:: yaml
1237
1238 linux:
1239 system:
1240 purge_repos: true
1241
azvyagintsevff089d22018-07-27 16:52:34 +02001242Refresh repositories metada, after configuration:
1243
1244.. code-block:: yaml
1245
1246 linux:
1247 system:
1248 refresh_repos_meta: true
1249
Filip Pytlounc512e6c2017-11-22 14:28:10 +01001250Setup custom apt config options:
1251
1252.. code-block:: yaml
1253
1254 linux:
1255 system:
1256 apt:
1257 config:
1258 compression-workaround:
1259 "Acquire::CompressionTypes::Order": "gz"
1260 docker-clean:
1261 "DPkg::Post-Invoke":
1262 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
1263 "APT::Update::Post-Invoke":
1264 - "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 +02001265
Petr Michalec10462bb2017-03-23 19:18:08 +01001266RC
1267~~
1268
Jakub Pavlik78859382016-01-21 11:26:39 +01001269rc.local example
1270
1271.. code-block:: yaml
1272
1273 linux:
1274 system:
1275 rc:
1276 local: |
1277 #!/bin/sh -e
1278 #
1279 # rc.local
1280 #
1281 # This script is executed at the end of each multiuser runlevel.
1282 # Make sure that the script will "exit 0" on success or any other
1283 # value on error.
1284 #
1285 # In order to enable or disable this script just change the execution
1286 # bits.
1287 #
1288 # By default this script does nothing.
1289 exit 0
1290
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001291Prompt
1292~~~~~~
1293
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001294Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``.
1295Every user can have different prompt:
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001296
1297.. code-block:: yaml
1298
1299 linux:
1300 system:
1301 prompt:
1302 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\\]
1303 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
1304
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001305On Debian systems, to set prompt system-wide, it's necessary to
1306remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``,
1307which comes from ``/etc/skel/.bashrc``. This formula will do
1308this automatically, but will not touch existing user's
1309``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +01001310
Filip Pytlouneef11c12016-03-25 11:00:23 +01001311Bash
1312~~~~
1313
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001314Fix bash configuration to preserve history across sessions
1315like ZSH does by default:
Filip Pytlouneef11c12016-03-25 11:00:23 +01001316
1317.. code-block:: yaml
1318
1319 linux:
1320 system:
1321 bash:
1322 preserve_history: true
1323
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001324Login banner message
1325~~~~~~~~~~~~~~~~~~~~
1326
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001327``/etc/issue`` is a text file which contains a message or system
1328identification to be printed before the login prompt. It may contain
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001329various @char and \char sequences, if supported by the getty-type
1330program employed on the system.
1331
1332Setting logon banner message is easy:
1333
1334.. code-block:: yaml
1335
1336 liunx:
1337 system:
1338 banner:
1339 enabled: true
1340 contents: |
1341 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1342
1343 You must have explicit, authorized permission to access or configure this
1344 device. Unauthorized attempts and actions to access or use this system may
1345 result in civil and/or criminal penalties.
1346 All activities performed on this system are logged and monitored.
1347
Filip Pytloune874dfb2016-01-22 16:57:34 +01001348Message of the day
1349~~~~~~~~~~~~~~~~~~
1350
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001351``pam_motd`` from package ``libpam-modules`` is used for dynamic
1352messages of the day. Setting custom ``motd`` will clean up existing ones.
Filip Pytloune874dfb2016-01-22 16:57:34 +01001353
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001354Setting static ``motd`` will replace existing ``/etc/motd`` and remove
1355scripts from ``/etc/update-motd.d``.
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001356
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001357Setting static ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001358
1359.. code-block:: yaml
1360
1361 linux:
1362 system:
1363 motd: |
1364 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1365
1366 You must have explicit, authorized permission to access or configure this
1367 device. Unauthorized attempts and actions to access or use this system may
1368 result in civil and/or criminal penalties.
1369 All activities performed on this system are logged and monitored.
1370
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001371Setting dynamic ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001372
Filip Pytloune874dfb2016-01-22 16:57:34 +01001373.. code-block:: yaml
1374
1375 linux:
1376 system:
1377 motd:
1378 - release: |
1379 #!/bin/sh
1380 [ -r /etc/lsb-release ] && . /etc/lsb-release
1381
1382 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
1383 # Fall back to using the very slow lsb_release utility
1384 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
1385 fi
1386
1387 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
1388 - warning: |
1389 #!/bin/sh
1390 printf "This is [company name] network.\n"
1391 printf "Unauthorized access strictly prohibited.\n"
1392
Marek Celoud713e9072017-05-18 15:20:25 +02001393Services
1394~~~~~~~~
1395
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001396Stop and disable the ``linux`` service:
Marek Celoud713e9072017-05-18 15:20:25 +02001397
1398.. code-block:: yaml
1399
1400 linux:
1401 system:
1402 service:
1403 apt-daily.timer:
1404 status: dead
1405
Dzmitry Stremkouski70d09782018-11-30 16:04:59 +01001406Override systemd service unit:
1407
1408.. code-block:: yaml
1409
1410 parameters:
1411
1412 linux:
1413 system:
1414 service:
1415 tgt:
1416 name: tgt
1417 status: running
1418 enabled: True
1419 override:
1420 50:
1421 target: tgt.service.d
1422 name: bind
1423 content: |
1424 [Service]
1425 ExecStart=
1426 ExecStart=/usr/sbin/tgtd -f --iscsi portal=${_param:single_address}:3260
1427
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001428Possible statuses are ``dead`` (disable service by default), ``running``
1429(enable service by default), ``enabled``, ``disabled``:
Marek Celoud713e9072017-05-18 15:20:25 +02001430
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001431Linux with the ``atop`` service:
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +03001432
1433.. code-block:: yaml
1434
1435 linux:
1436 system:
1437 atop:
1438 enabled: true
1439 interval: 20
1440 logpath: "/var/log/atop"
1441 outfile: "/var/log/atop/daily.log"
1442
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001443Linux with the ``mcelog`` service:
Oleksii Chupryn144432b2018-05-22 10:34:48 +03001444
1445.. code-block:: yaml
1446
1447 linux:
1448 system:
1449 mcelog:
1450 enabled: true
1451 logging:
1452 syslog: true
1453 syslog_error: true
1454
Filip Pytloun2f70b492016-02-19 15:55:25 +01001455RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +01001456^^^^^^^^^^^^^
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001457Currently, ``update-motd`` is not available
1458for RHEL. So there is no native support for dynamic ``motd``.
1459You can still set a static one, with a different pillar structure:
Filip Pytloun2f70b492016-02-19 15:55:25 +01001460
1461.. code-block:: yaml
1462
1463 linux:
1464 system:
1465 motd: |
1466 This is [company name] network.
1467 Unauthorized access strictly prohibited.
1468
Filip Pytloun8296bb92016-02-19 18:42:09 +01001469Haveged
1470~~~~~~~
1471
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001472If you are running headless server and are low on entropy,
1473you may set up Haveged:
Filip Pytloun8296bb92016-02-19 18:42:09 +01001474
1475.. code-block:: yaml
1476
1477 linux:
1478 system:
1479 haveged:
1480 enabled: true
1481
Filip Pytlounf5383a42015-10-06 16:28:32 +02001482Linux network
1483-------------
1484
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001485Linux with network manager:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001486
1487.. code-block:: yaml
1488
1489 linux:
1490 network:
1491 enabled: true
1492 network_manager: true
1493
Dzmitry Stremkouski00cdbe62018-10-31 16:41:54 +01001494Execute linux.network.interface state without ifupdown activity:
1495
1496.. code-block:: bash
1497
1498 salt-call linux.network.interface pillar='{"linux":{"network":{"noifupdown":True}}}'
1499
1500
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001501Linux with default static network interfaces, default gateway
1502interface and DNS servers:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001503
1504.. code-block:: yaml
1505
1506 linux:
1507 network:
1508 enabled: true
1509 interface:
1510 eth0:
1511 enabled: true
1512 type: eth
1513 address: 192.168.0.102
1514 netmask: 255.255.255.0
1515 gateway: 192.168.0.1
1516 name_servers:
1517 - 8.8.8.8
1518 - 8.8.4.4
1519 mtu: 1500
1520
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001521Linux with bonded interfaces and disabled ``NetworkManager``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001522
1523.. code-block:: yaml
1524
1525 linux:
1526 network:
1527 enabled: true
1528 interface:
1529 eth0:
1530 type: eth
1531 ...
1532 eth1:
1533 type: eth
1534 ...
1535 bond0:
1536 enabled: true
1537 type: bond
1538 address: 192.168.0.102
1539 netmask: 255.255.255.0
Dzmitry Stremkouskif6fb7212019-08-26 16:48:05 +02001540 proto: manual
1541 mtu: 9000
1542 name: ${_param:vlan_bond_name}
1543 slaves: ${_param:vlan_nic1} ${_param:vlan_nic2}
1544 mode: 802.3ad
1545 lacp_rate: slow
1546 downdelay: 200
1547 xmit_hash_policy: layer3+4
1548 miimon: 100
1549 use_interfaces:
1550 - ${_param:vlan_nic1}
1551 - ${_param:vlan_nic2}
1552 require_interfaces:
1553 - ${_param:vlan_nic1}
1554 - ${_param:vlan_nic2}
jan kaufman6d30adf2016-01-18 17:30:12 +01001555 network_manager:
1556 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001557
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001558Linux with VLAN ``interface_params``:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001559
1560.. code-block:: yaml
1561
1562 linux:
1563 network:
1564 enabled: true
1565 interface:
1566 vlan69:
1567 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001568 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001569 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001570
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001571Linux with wireless interface parameters:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001572
1573.. code-block:: yaml
1574
1575 linux:
1576 network:
1577 enabled: true
1578 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001579 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001580 interface:
1581 wlan0:
1582 type: eth
1583 wireless:
1584 essid: example
1585 key: example_key
1586 security: wpa
1587 priority: 1
1588
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001589Linux networks with routes defined:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001590
1591.. code-block:: yaml
1592
1593 linux:
1594 network:
1595 enabled: true
1596 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001597 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001598 interface:
1599 eth0:
1600 type: eth
1601 route:
1602 default:
1603 address: 192.168.0.123
1604 netmask: 255.255.255.0
1605 gateway: 192.168.0.1
1606
ivcc4730b12019-01-23 07:56:53 +03001607Linux networks with implicit routes definition:
1608
1609- on node 1:
1610
1611.. code-block:: yaml
1612
1613 linux:
1614 network:
1615 enabled: true
1616 router:
1617 ctl:
1618 # router that connects 10.0.1.0/24 and 10.0.2.0/24
1619 addresses:
1620 - 10.0.1.1/24
1621 - 10.0.2.1/24
1622 test:
1623 addresses:
1624 - 10.0.1.2/24
1625 networks:
1626 - 10.100.0.0/16
1627 interface:
1628 ctl:
1629 name: eth0
1630 address: 10.0.1.101
1631 netmask: 255.255.255.0
1632
1633- on node2:
1634
1635.. code-block:: yaml
1636
1637 linux:
1638 network:
1639 enabled: true
1640 router:
1641 ctl:
1642 # equivalent of node1's ctl router with 'implicit_routes = false'
1643 options:
1644 implicit_routes: false
1645 addresses:
1646 - 10.0.1.1/24
1647 - 10.0.2.1/24
1648 networks:
1649 - 10.0.1.0/24
1650 - 10.0.2.0/24
1651 interface:
1652 ctl:
1653 name: eth0
1654 address: 10.0.2.101
1655 netmask: 255.255.255.0
1656
1657
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001658Native Linux Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001659
1660.. code-block:: yaml
1661
1662 linux:
1663 network:
1664 interface:
1665 eth1:
1666 enabled: true
1667 type: eth
1668 proto: manual
1669 up_cmds:
1670 - ip address add 0/0 dev $IFACE
1671 - ip link set $IFACE up
1672 down_cmds:
1673 - ip link set $IFACE down
1674 br-ex:
1675 enabled: true
1676 type: bridge
1677 address: ${linux:network:host:public_local:address}
1678 netmask: 255.255.255.0
1679 use_interfaces:
1680 - eth1
1681
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001682Open vSwitch Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001683
1684.. code-block:: yaml
1685
1686 linux:
1687 network:
1688 bridge: openvswitch
1689 interface:
1690 eth1:
1691 enabled: true
1692 type: eth
1693 proto: manual
1694 up_cmds:
1695 - ip address add 0/0 dev $IFACE
1696 - ip link set $IFACE up
1697 down_cmds:
1698 - ip link set $IFACE down
1699 br-ex:
1700 enabled: true
1701 type: bridge
1702 address: ${linux:network:host:public_local:address}
1703 netmask: 255.255.255.0
1704 use_interfaces:
1705 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001706 br-prv:
1707 enabled: true
1708 type: ovs_bridge
1709 mtu: 65000
1710 br-ens7:
1711 enabled: true
1712 name: br-ens7
1713 type: ovs_bridge
1714 proto: manual
1715 mtu: 9000
1716 use_interfaces:
1717 - ens7
1718 patch-br-ens7-br-prv:
1719 enabled: true
1720 name: ens7-prv
1721 ovs_type: ovs_port
1722 type: ovs_port
1723 bridge: br-ens7
1724 port_type: patch
1725 peer: prv-ens7
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001726 tag: 109 # [] to unset a tag
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001727 mtu: 65000
1728 patch-br-prv-br-ens7:
1729 enabled: true
1730 name: prv-ens7
1731 bridge: br-prv
1732 ovs_type: ovs_port
1733 type: ovs_port
1734 port_type: patch
1735 peer: ens7-prv
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001736 tag: 109
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001737 mtu: 65000
1738 ens7:
1739 enabled: true
1740 name: ens7
1741 proto: manual
1742 ovs_port_type: OVSPort
1743 type: ovs_port
1744 ovs_bridge: br-ens7
1745 bridge: br-ens7
Oleg Gelbukh52f9f762019-07-01 15:26:16 -07001746 ens6:
1747 enabled: true
1748 proto: manual
1749 type: eth
1750 ovs_bridge: br-ctl
1751 br-ctl:
1752 enabled: true
1753 type: ovs_bridge
1754 internal-br-ctl-port:
1755 enabled: true
1756 proto: static
1757 address: 172.172.0.10
1758 netmask: 255.255.0.0
1759 name_servers:
1760 - 8.8.8.8
1761 - 172.172.172.172
1762 name: port-br-ctl
1763 bridge: br-ctl
1764 ovs_type: ovs_port
1765 type: ovs_port
1766 port_type: internal
1767 mtu: 65000
Filip Pytlounf5383a42015-10-06 16:28:32 +02001768
Petr Jediný8f8ae542017-07-13 16:19:12 +02001769Debian manual proto interfaces
1770
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001771When you are changing interface proto from static in up state
1772to manual, you may need to flush ip addresses. For example,
1773if you want to use the interface and the ip on the bridge.
1774This can be done by setting the ``ipflush_onchange`` to true.
Petr Jediný8f8ae542017-07-13 16:19:12 +02001775
1776.. code-block:: yaml
1777
1778 linux:
1779 network:
1780 interface:
1781 eth1:
1782 enabled: true
1783 type: eth
1784 proto: manual
1785 mtu: 9100
1786 ipflush_onchange: true
1787
Jiri Broulik1a191e32018-01-15 15:54:21 +01001788Debian static proto interfaces
1789
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001790When you are changing interface proto from dhcp in up state to
1791static, you may need to flush ip addresses and restart interface
1792to assign ip address from a managed file. For example, if you wantto
1793use the interface and the ip on the bridge. This can be done by
1794setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
1795param set to true.
Jiri Broulik1a191e32018-01-15 15:54:21 +01001796
1797.. code-block:: yaml
1798
1799 linux:
1800 network:
1801 interface:
1802 eth1:
1803 enabled: true
1804 type: eth
1805 proto: static
1806 address: 10.1.0.22
1807 netmask: 255.255.255.0
1808 ipflush_onchange: true
1809 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001810
Petr Jedinýd577cb52017-06-28 20:17:49 +02001811Concatinating and removing interface files
1812
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001813Debian based distributions have ``/etc/network/interfaces.d/``
1814directory, where you can store configuration of network
1815interfaces in separate files. You can concatinate the files
1816to the defined destination when needed, this operation removes
1817the file from the ``/etc/network/interfaces.d/``. If you just need
1818to remove iface files, you can use the ``remove_iface_files`` key.
Petr Jedinýd577cb52017-06-28 20:17:49 +02001819
1820.. code-block:: yaml
1821
1822 linux:
1823 network:
1824 concat_iface_files:
1825 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1826 dst: '/etc/network/interfaces'
1827 remove_iface_files:
1828 - '/etc/network/interfaces.d/90-custom.cfg'
1829
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001830Configure DHCP client
Petr Jedinýd577cb52017-06-28 20:17:49 +02001831
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001832None of the keys is mandatory, include only those you really need.
1833For full list of available options under send, supersede, prepend,
1834append refer to dhcp-options(5).
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001835
1836.. code-block:: yaml
1837
1838 linux:
1839 network:
1840 dhclient:
1841 enabled: true
1842 backoff_cutoff: 15
1843 initial_interval: 10
1844 reboot: 10
1845 retry: 60
1846 select_timeout: 0
1847 timeout: 120
1848 send:
1849 - option: host-name
1850 declaration: "= gethostname()"
1851 supersede:
1852 - option: host-name
1853 declaration: "spaceship"
1854 - option: domain-name
1855 declaration: "domain.home"
1856 #- option: arp-cache-timeout
1857 # declaration: 20
1858 prepend:
1859 - option: domain-name-servers
1860 declaration:
1861 - 8.8.8.8
1862 - 8.8.4.4
1863 - option: domain-search
1864 declaration:
1865 - example.com
1866 - eng.example.com
1867 #append:
1868 #- option: domain-name-servers
1869 # declaration: 127.0.0.1
1870 # ip or subnet to reject dhcp offer from
1871 reject:
1872 - 192.33.137.209
1873 - 10.0.2.0/24
1874 request:
1875 - subnet-mask
1876 - broadcast-address
1877 - time-offset
1878 - routers
1879 - domain-name
1880 - domain-name-servers
1881 - domain-search
1882 - host-name
1883 - dhcp6.name-servers
1884 - dhcp6.domain-search
1885 - dhcp6.fqdn
1886 - dhcp6.sntp-servers
1887 - netbios-name-servers
1888 - netbios-scope
1889 - interface-mtu
1890 - rfc3442-classless-static-routes
1891 - ntp-servers
1892 require:
1893 - subnet-mask
1894 - domain-name-servers
1895 # if per interface configuration required add below
1896 interface:
1897 ens2:
1898 initial_interval: 11
1899 reject:
1900 - 192.33.137.210
1901 ens3:
1902 initial_interval: 12
1903 reject:
1904 - 192.33.137.211
1905
Petr Michaleceb14b552017-06-01 10:27:05 +02001906Linux network systemd settings:
1907
1908.. code-block:: yaml
1909
1910 linux:
1911 network:
1912 ...
1913 systemd:
1914 link:
1915 10-iface-dmz:
1916 Match:
1917 MACAddress: c8:5b:67:fa:1a:af
1918 OriginalName: eth0
1919 Link:
1920 Name: dmz0
1921 netdev:
1922 20-bridge-dmz:
1923 match:
1924 name: dmz0
1925 network:
1926 mescription: bridge
1927 bridge: br-dmz0
1928 network:
1929 # works with lowercase, keys are by default capitalized
1930 40-dhcp:
1931 match:
1932 name: '*'
1933 network:
1934 DHCP: yes
1935
Petr Michalec10462bb2017-03-23 19:18:08 +01001936Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001937
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001938Use ``/etc/environment`` for static system wide variable assignment
1939after boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001940
1941.. code-block:: yaml
1942
1943 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001944 system:
1945 env:
1946 BOB_VARIABLE: Alice
1947 ...
1948 BOB_PATH:
1949 - /srv/alice/bin
1950 - /srv/bob/bin
1951 ...
1952 ftp_proxy: none
1953 http_proxy: http://global-http-proxy.host.local:8080
1954 https_proxy: ${linux:system:proxy:https}
1955 no_proxy:
1956 - 192.168.0.80
1957 - 192.168.1.80
1958 - .domain.com
1959 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02001960 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001961 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001962 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01001963 ftp: ftp://proxy.host.local:2121
1964 http: http://proxy.host.local:3142
1965 https: https://proxy.host.local:3143
1966 noproxy:
1967 - .domain.com
1968 - .local
1969
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001970Configure the ``profile.d`` scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01001971
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001972The ``profile.d`` scripts are being sourced during ``.sh`` execution
1973and support variable expansion in opposite to /etc/environment global
1974settings in ``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01001975
1976.. code-block:: yaml
1977
1978 linux:
1979 system:
1980 profile:
1981 locales: |
1982 export LANG=C
1983 export LC_ALL=C
1984 ...
1985 vi_flavors.sh: |
1986 export PAGER=view
1987 export EDITOR=vim
1988 alias vi=vim
1989 shell_locales.sh: |
1990 export LANG=en_US
1991 export LC_ALL=en_US.UTF-8
1992 shell_proxies.sh: |
1993 export FTP_PROXY=ftp://127.0.3.3:2121
1994 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02001995
Dmitry Teselkina0d31d12018-09-04 14:43:09 +03001996
1997Configure login.defs parameters
1998-------------------------------
1999
2000.. code-block:: yaml
2001
2002 linux:
2003 system:
2004 login_defs:
2005 <opt_name>:
2006 enabled: true
2007 value: <opt_value>
2008
2009<opt_name> is a configurational option defined in 'man login.defs'.
2010<opt_name> is case sensitive, should be UPPERCASE only!
2011
2012
Filip Pytlounf5383a42015-10-06 16:28:32 +02002013Linux with hosts
2014
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002015Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
2016removing entries that are not defined in model except defaults
2017for both IPv4 and IPv6 localhost and hostname as well as FQDN.
Ales Komarek417e8c52017-08-25 15:10:29 +02002018
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002019We recommend using this option to verify that ``/etc/hosts``
2020is always in a clean state. However it is not enabled by default
2021for security reasons.
Filip Pytloun86506fe2017-01-26 14:36:16 +01002022
Filip Pytlounf5383a42015-10-06 16:28:32 +02002023.. code-block:: yaml
2024
2025 linux:
2026 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002027 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002028 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002029 # No need to define this one if purge_hosts is true
2030 hostname:
2031 address: 127.0.1.1
2032 names:
2033 - ${linux:network:fqdn}
2034 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02002035 node1:
2036 address: 192.168.10.200
2037 names:
2038 - node2.domain.com
2039 - service2.domain.com
2040 node2:
2041 address: 192.168.10.201
2042 names:
2043 - node2.domain.com
2044 - service2.domain.com
2045
Ales Komarek417e8c52017-08-25 15:10:29 +02002046Linux with hosts collected from mine
2047
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002048All DNS records defined within infrastrucuture
2049are passed to the local hosts records or any DNS server. Only
2050hosts with the ``grain`` parameter set to ``true`` will be propagated
2051to the mine.
Ales Komarek417e8c52017-08-25 15:10:29 +02002052
2053.. code-block:: yaml
2054
2055 linux:
2056 network:
2057 purge_hosts: true
2058 mine_dns_records: true
2059 host:
2060 node1:
2061 address: 192.168.10.200
2062 grain: true
2063 names:
2064 - node2.domain.com
2065 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01002066
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002067Set up ``resolvconf's basic resolver info``, e.g. nameservers, search/domain and options:
Filip Pytlounde9bea52016-01-11 15:39:10 +01002068
2069.. code-block:: yaml
2070
2071 linux:
2072 network:
2073 resolv:
2074 dns:
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002075 - 8.8.4.4
2076 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01002077 domain: my.example.com
2078 search:
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002079 - my.example.com
2080 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01002081 options:
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002082 - ndots:5
2083 - timeout:2
2084 - attempts:2
Filip Pytlounde9bea52016-01-11 15:39:10 +01002085
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002086Set up custom TX queue length for tap interfaces:
Andrii Petrenko735761d2017-03-21 17:17:35 -07002087
2088.. code-block:: yaml
2089
2090 linux:
2091 network:
2092 tap_custom_txqueuelen: 10000
2093
Michael Polenchuk6e3042b2019-04-22 15:20:03 +04002094Auto repair/re-attach libvirt's vnet interfaces:
2095
2096.. code-block:: yaml
2097
2098 linux:
2099 network:
2100 libvirt_vnet_repair: true
2101
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002102DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002103
2104**DPDK OVS NIC**
2105
2106.. code-block:: yaml
2107
2108 linux:
2109 network:
2110 bridge: openvswitch
2111 dpdk:
2112 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002113 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002114 openvswitch:
2115 pmd_cpu_mask: "0x6"
2116 dpdk_socket_mem: "1024,1024"
2117 dpdk_lcore_mask: "0x400"
2118 memory_channels: 2
2119 interface:
2120 dpkd0:
2121 name: ${_param:dpdk_nic}
2122 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002123 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002124 enabled: true
2125 type: dpdk_ovs_port
2126 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002127 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002128 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01002129 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002130 br-prv:
2131 enabled: true
2132 type: dpdk_ovs_bridge
Michael Polenchukd3378db2018-12-29 16:46:50 +04002133 br-floating:
2134 enabled: true
2135 type: ovs_bridge
2136 name_servers:
2137 - 1.1.1.1
2138 - 9.9.9.9
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002139
2140**DPDK OVS Bond**
2141
2142.. code-block:: yaml
2143
2144 linux:
2145 network:
2146 bridge: openvswitch
2147 dpdk:
2148 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002149 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002150 openvswitch:
2151 pmd_cpu_mask: "0x6"
2152 dpdk_socket_mem: "1024,1024"
2153 dpdk_lcore_mask: "0x400"
2154 memory_channels: 2
2155 interface:
2156 dpdk_second_nic:
2157 name: ${_param:primary_second_nic}
2158 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002159 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002160 bond: dpdkbond0
2161 enabled: true
2162 type: dpdk_ovs_port
2163 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002164 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002165 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002166 dpdk_first_nic:
2167 name: ${_param:primary_first_nic}
2168 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002169 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002170 bond: dpdkbond0
2171 enabled: true
2172 type: dpdk_ovs_port
2173 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002174 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002175 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002176 dpdkbond0:
2177 enabled: true
2178 bridge: br-prv
2179 type: dpdk_ovs_bond
2180 mode: active-backup
2181 br-prv:
2182 enabled: true
2183 type: dpdk_ovs_bridge
2184
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01002185**DPDK OVS LACP Bond with vlan tag**
2186
2187.. code-block:: yaml
2188
2189 linux:
2190 network:
2191 bridge: openvswitch
2192 dpdk:
2193 enabled: true
2194 driver: uio
2195 openvswitch:
2196 pmd_cpu_mask: "0x6"
2197 dpdk_socket_mem: "1024,1024"
2198 dpdk_lcore_mask: "0x400"
2199 memory_channels: "2"
2200 interface:
2201 eth3:
2202 enabled: true
2203 type: eth
2204 proto: manual
2205 name: ${_param:tenant_first_nic}
2206 eth4:
2207 enabled: true
2208 type: eth
2209 proto: manual
2210 name: ${_param:tenant_second_nic}
2211 dpdk0:
2212 name: ${_param:tenant_first_nic}
2213 pci: "0000:81:00.0"
2214 driver: igb_uio
2215 bond: bond1
2216 enabled: true
2217 type: dpdk_ovs_port
2218 n_rxq: 2
2219 dpdk1:
2220 name: ${_param:tenant_second_nic}
2221 pci: "0000:81:00.1"
2222 driver: igb_uio
2223 bond: bond1
2224 enabled: true
2225 type: dpdk_ovs_port
2226 n_rxq: 2
2227 bond1:
2228 enabled: true
2229 bridge: br-prv
2230 type: dpdk_ovs_bond
2231 mode: balance-slb
2232 br-prv:
2233 enabled: true
2234 type: dpdk_ovs_bridge
2235 tag: ${_param:tenant_vlan}
2236 address: ${_param:tenant_address}
2237 netmask: ${_param:tenant_network_netmask}
2238
Jakub Pavlikaa759062017-03-13 15:57:26 +01002239**DPDK OVS bridge for VXLAN**
2240
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002241If VXLAN is used as tenant segmentation, IP address must
2242be set on ``br-prv``.
Jakub Pavlikaa759062017-03-13 15:57:26 +01002243
2244.. code-block:: yaml
2245
2246 linux:
2247 network:
2248 ...
2249 interface:
2250 br-prv:
2251 enabled: true
2252 type: dpdk_ovs_bridge
2253 address: 192.168.50.0
2254 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04002255 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01002256 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002257
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02002258**DPDK OVS bridge with Linux network interface**
2259
2260.. code-block:: yaml
2261
2262 linux:
2263 network:
2264 ...
2265 interface:
2266 eth0:
2267 type: eth
2268 ovs_bridge: br-prv
2269 ...
2270 br-prv:
2271 enabled: true
2272 type: dpdk_ovs_bridge
2273 ...
2274
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002275Linux storage
2276-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02002277
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002278Linux with mounted Samba:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002279
2280.. code-block:: yaml
2281
2282 linux:
2283 storage:
2284 enabled: true
2285 mount:
2286 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01002287 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002288 - path: /media/myuser/public/
2289 - device: //192.168.0.1/storage
2290 - file_system: cifs
2291 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
2292
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002293NFS mount:
Jiri Broulikb017f932017-03-31 13:55:36 +02002294
2295.. code-block:: yaml
2296
2297 linux:
2298 storage:
2299 enabled: true
2300 mount:
2301 nfs_glance:
2302 enabled: true
2303 path: /var/lib/glance/images
2304 device: 172.16.10.110:/var/nfs/glance
2305 file_system: nfs
2306 opts: rw,sync
2307
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002308File swap configuration:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002309
2310.. code-block:: yaml
2311
2312 linux:
2313 storage:
2314 enabled: true
2315 swap:
2316 file:
2317 enabled: true
2318 engine: file
2319 device: /swapfile
2320 size: 1024
2321
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002322Partition swap configuration:
Lachlan Evenson30676512016-01-22 15:43:28 -08002323
2324.. code-block:: yaml
2325
2326 linux:
2327 storage:
2328 enabled: true
2329 swap:
2330 partition:
2331 enabled: true
2332 engine: partition
2333 device: /dev/vg0/swap
2334
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002335LVM group ``vg1`` with one device and ``data`` volume mounted
2336into ``/mnt/data``.
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002337
2338.. code-block:: yaml
2339
2340 parameters:
2341 linux:
2342 storage:
2343 mount:
2344 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01002345 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002346 device: /dev/vg1/data
2347 file_system: ext4
2348 path: /mnt/data
2349 lvm:
2350 vg1:
2351 enabled: true
2352 devices:
2353 - /dev/sdb
2354 volume:
2355 data:
2356 size: 40G
2357 mount: ${linux:storage:mount:data}
root40bb5e72019-01-11 08:55:32 +00002358 # When set they will take precedence over filters aget from volume groups.
2359 lvm_filters:
2360 10:
2361 enabled: True
2362 value: "a|loop|"
2363 20:
2364 enabled: True
2365 value: "r|/dev/hdc|"
2366 30:
2367 enabled: True
2368 value: "a|/dev/ide|"
2369 40:
2370 enabled: True
2371 value: "r|.*|"
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002372
Jakub Pavlik4f742142017-08-08 15:05:50 +02002373Create partitions on disk. Specify size in MB. It expects empty
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002374disk without any existing partitions.
2375Set ``startsector=1`` if you want to start partitions from ``2048``.
Jakub Pavlik4f742142017-08-08 15:05:50 +02002376
2377.. code-block:: yaml
2378
2379 linux:
2380 storage:
2381 disk:
2382 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01002383 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02002384 name: /dev/loop1
2385 type: gpt
2386 partitions:
2387 - size: 200 #size in MB
2388 type: fat32
2389 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02002390 mkfs: True
2391 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02002392 /dev/vda1:
2393 partitions:
2394 - size: 5
2395 type: ext2
2396 - size: 10
2397 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02002398
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002399Multipath with Fujitsu Eternus DXL:
Ales Komareka634f4b2016-10-02 13:11:04 +02002400
2401.. code-block:: yaml
2402
2403 parameters:
2404 linux:
2405 storage:
2406 multipath:
2407 enabled: true
2408 blacklist_devices:
2409 - /dev/sda
2410 - /dev/sdb
2411 backends:
2412 - fujitsu_eternus_dxl
2413
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002414Multipath with Hitachi VSP 1000:
Ales Komareka634f4b2016-10-02 13:11:04 +02002415
2416.. code-block:: yaml
2417
2418 parameters:
2419 linux:
2420 storage:
2421 multipath:
2422 enabled: true
2423 blacklist_devices:
2424 - /dev/sda
2425 - /dev/sdb
2426 backends:
2427 - hitachi_vsp1000
2428
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002429Multipath with IBM Storwize:
Ales Komareka634f4b2016-10-02 13:11:04 +02002430
2431.. code-block:: yaml
2432
2433 parameters:
2434 linux:
2435 storage:
2436 multipath:
2437 enabled: true
2438 blacklist_devices:
2439 - /dev/sda
2440 - /dev/sdb
2441 backends:
2442 - ibm_storwize
2443
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002444Multipath with multiple backends:
Ales Komareka634f4b2016-10-02 13:11:04 +02002445
2446.. code-block:: yaml
2447
2448 parameters:
2449 linux:
2450 storage:
2451 multipath:
2452 enabled: true
2453 blacklist_devices:
2454 - /dev/sda
2455 - /dev/sdb
2456 - /dev/sdc
2457 - /dev/sdd
2458 backends:
2459 - ibm_storwize
2460 - fujitsu_eternus_dxl
2461 - hitachi_vsp1000
2462
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002463PAM LDAP integration:
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002464
2465.. code-block:: yaml
2466
2467 parameters:
2468 linux:
2469 system:
2470 auth:
2471 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02002472 mkhomedir:
2473 enabled: true
2474 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002475 ldap:
2476 enabled: true
2477 binddn: cn=bind,ou=service_users,dc=example,dc=com
2478 bindpw: secret
2479 uri: ldap://127.0.0.1
2480 base: ou=users,dc=example,dc=com
2481 ldap_version: 3
2482 pagesize: 65536
2483 referrals: off
2484 filter:
2485 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2486 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2487 group: (&(objectClass=group)(gidNumber=*))
2488
Gleb Galkin93b9ae92018-10-18 13:57:30 +03002489PAM duo 2FA integration
2490
2491.. code-block:: yaml
2492
2493 parameters:
2494 linux:
2495 system:
2496 auth:
2497 enabled: true
2498 duo:
2499 enabled: true
2500 duo_host: localhost
2501 duo_ikey: DUO-INTEGRATION-KEY
2502 duo_skey: DUO-SECRET-KEY
2503
2504duo package version may be specified (optional)
2505
2506.. code-block:: yaml
2507
2508 linux:
2509 system:
2510 package:
2511 duo-unix:
2512 version: 1.10.1-0
2513
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002514Disabled multipath (the default setup):
Ales Komareka634f4b2016-10-02 13:11:04 +02002515
2516.. code-block:: yaml
2517
2518 parameters:
2519 linux:
2520 storage:
2521 multipath:
2522 enabled: false
2523
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002524Linux with local loopback device:
Simon Pasquier375001e2017-01-26 13:22:33 +01002525
2526.. code-block:: yaml
2527
2528 linux:
2529 storage:
2530 loopback:
2531 disk1:
2532 file: /srv/disk1
2533 size: 50G
2534
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002535External config generation
2536--------------------------
2537
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002538You are able to use config support metadata between formulas
2539and only generate configuration files for external use, for example, Docker, and so on.
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002540
2541.. code-block:: yaml
2542
2543 parameters:
2544 linux:
2545 system:
2546 config:
2547 pillar:
2548 jenkins:
2549 master:
2550 home: /srv/volumes/jenkins
2551 approved_scripts:
2552 - method java.net.URL openConnection
2553 credentials:
2554 - type: username_password
2555 scope: global
2556 id: test
2557 desc: Testing credentials
2558 username: test
2559 password: test
2560
Vladimir Ereminccf28842017-04-10 23:52:10 +03002561Netconsole Remote Kernel Logging
2562--------------------------------
2563
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002564Netconsole logger can be configured for the configfs-enabled kernels
2565(``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
2566applies both in runtime (if network is already configured),
2567and on-boot after an interface initialization.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002568
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002569.. note::
2570
2571 * Receiver can be located only on the same L3 domain
2572 (or you need to configure gateway MAC manually).
2573 * The Receiver MAC is detected only on configuration time.
2574 * Using broadcast MAC is not recommended.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002575
2576.. code-block:: yaml
2577
2578 parameters:
2579 linux:
2580 system:
2581 netconsole:
2582 enabled: true
2583 port: 514 (optional)
2584 loglevel: debug (optional)
2585 target:
2586 192.168.0.1:
2587 interface: bond0
2588 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02002589
Dzmitry Stremkouskid1a268b2018-10-03 16:36:04 +02002590Check network params on the environment
2591---------------------------------------
2592
2593Grab nics and nics states
2594
2595.. code-block:: bash
2596
2597 salt osd001\* net_checks.get_nics
2598
2599**Example of system output:**
2600
2601.. code-block:: bash
2602
2603 osd001.domain.com:
2604 |_
2605 - bond0
2606 - None
2607 - 1e:c8:64:42:23:b9
2608 - 0
2609 - 1500
2610 |_
2611 - bond1
2612 - None
2613 - 3c:fd:fe:27:3b:00
2614 - 1
2615 - 9100
2616 |_
2617 - fourty1
2618 - None
2619 - 3c:fd:fe:27:3b:00
2620 - 1
2621 - 9100
2622 |_
2623 - fourty2
2624 - None
2625 - 3c:fd:fe:27:3b:02
2626 - 1
2627 - 9100
2628
2629Grab 10G nics PCI addresses for hugepages setup
2630
2631.. code-block:: bash
2632
2633 salt cmp001\* net_checks.get_ten_pci
2634
2635**Example of system output:**
2636
2637.. code-block:: bash
2638
2639 cmp001.domain.com:
2640 |_
2641 - ten1
2642 - 0000:19:00.0
2643 |_
2644 - ten2
2645 - 0000:19:00.1
2646 |_
2647 - ten3
2648 - 0000:19:00.2
2649 |_
2650 - ten4
2651 - 0000:19:00.3
2652
2653Grab ip address for an interface
2654
2655.. code-block:: bash
2656
2657 salt cmp001\* net_checks.get_ip iface=one4
2658
2659**Example of system output:**
2660
2661.. code-block:: bash
2662
2663 cmp001.domain.com:
2664 10.200.177.101
2665
2666Grab ip addresses map
2667
2668.. code-block:: bash
2669
2670 salt-call net_checks.nodes_addresses
2671
2672**Example of system output:**
2673
2674.. code-block:: bash
2675
2676 local:
2677 |_
2678 - cid01.domain.com
2679 |_
2680 |_
2681 - pxe
2682 - 10.200.177.91
2683 |_
2684 - control
2685 - 10.200.178.91
2686 |_
2687 - cmn02.domain.com
2688 |_
2689 |_
2690 - storage_access
2691 - 10.200.181.67
2692 |_
2693 - pxe
2694 - 10.200.177.67
2695 |_
2696 - control
2697 - 10.200.178.67
2698 |_
2699 - cmp010.domain.com
2700 |_
2701 |_
2702 - pxe
2703 - 10.200.177.110
2704 |_
2705 - storage_access
2706 - 10.200.181.110
2707 |_
2708 - control
2709 - 10.200.178.110
2710 |_
2711 - vxlan
2712 - 10.200.179.110
2713
2714Verify full mesh connectivity
2715
2716.. code-block:: bash
2717
2718 salt-call net_checks.ping_check
2719
2720**Example of positive system output:**
2721
2722.. code-block:: bash
2723
2724 ['PASSED']
2725 [INFO ] ['PASSED']
2726 local:
2727 True
2728
2729**Example of system output in case of failure:**
2730
2731.. code-block:: bash
2732
2733 FAILED
2734 [ERROR ] FAILED
2735 ['control: 10.0.1.92 -> 10.0.1.224: Failed']
2736 ['control: 10.0.1.93 -> 10.0.1.224: Failed']
2737 ['control: 10.0.1.51 -> 10.0.1.224: Failed']
2738 ['control: 10.0.1.102 -> 10.0.1.224: Failed']
2739 ['control: 10.0.1.13 -> 10.0.1.224: Failed']
2740 ['control: 10.0.1.81 -> 10.0.1.224: Failed']
2741 local:
2742 False
2743
2744For this feature to work, please mark addresses with some role.
2745Otherwise 'default' role is assumed and mesh would consist of all
2746addresses on the environment.
2747
2748Mesh mark is needed only for interfaces which are enabled and have
2749ip address assigned.
2750
2751Checking dhcp pxe network meaningless, as it is used for salt
2752master vs minion communications, therefore treated as checked.
2753
2754.. code-block:: yaml
2755
2756 parameters:
2757 linux:
2758 network:
2759 interface:
2760 ens3:
2761 enabled: true
2762 type: eth
2763 proto: static
2764 address: ${_param:deploy_address}
2765 netmask: ${_param:deploy_network_netmask}
2766 gateway: ${_param:deploy_network_gateway}
2767 mesh: pxe
2768
2769Check pillars for ip address duplicates
2770
2771.. code-block:: bash
2772
2773 salt-call net_checks.verify_addresses
2774
2775**Example of positive system output:**
2776
2777.. code-block:: bash
2778
2779 ['PASSED']
2780 [INFO ] ['PASSED']
2781 local:
2782 True
2783
2784**Example of system output in case of failure:**
2785
2786.. code-block:: bash
2787
2788 FAILED. Duplicates found
2789 [ERROR ] FAILED. Duplicates found
2790 ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2791 [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2792 local:
2793 False
2794
2795Generate csv report for the env
2796
2797.. code-block:: bash
2798
2799 salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
2800 | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
2801 | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
2802
2803**Example of system output:**
2804
2805.. code-block:: bash
2806
2807 server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
2808 cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
2809 cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
2810 cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
2811 cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
2812 cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
2813 cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
2814 cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
2815 cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
2816 cmp010.domain.com,one2,None,b4:96:91:10:5b:39,1,1500,f0:4b:3a:8f:75:40,exnfvaa18-20,548,ge-0/0/22
2817 cmp010.domain.com,one3,None,b4:96:91:10:5b:3a,1,1500,f0:4b:3a:8f:75:40,exnfvaa18-20,547,ge-0/0/21
2818 cmp010.domain.com,one4,10.200.177.110,b4:96:91:10:5b:3b,1,1500,f0:4b:3a:8f:75:40,exnfvaa18-20,546,ge-0/0/20
2819 cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
2820 cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
2821 cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
2822 ...
2823
Filip Pytlounf5383a42015-10-06 16:28:32 +02002824Usage
2825=====
2826
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002827Set MTU of the eth0 network interface to 1400:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002828
2829.. code-block:: bash
2830
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002831 ip link set dev eth0 mtu 1400
Filip Pytlounf5383a42015-10-06 16:28:32 +02002832
Denis Egorenko4e45a702019-10-02 14:57:10 +04002833Switch Kernel from non-HWE to HWE
2834==================================
2835
2836It is possible to switch Kernel from non-HWE to HWE by using module
2837linux_kernel_switch. It has few methods:
2838
2839* check_hwe_kernel
2840* switch_kernel
2841* rollback_switch_kernel
2842
2843Method ``check_hwe_kernel`` allows to check whether HWE kernel installed
2844or not:
2845
2846.. code-block:: bash
2847
2848 salt <target> linux_kernel_switch.check_hwe_kernel
2849
2850Output for case HWE is installed:
2851
2852.. code-bloc:: bash
2853
2854 kvm02.cluster-env.local:
2855 ----------
2856 linux-image-extra-virtual-hwe-16.04:
2857 ----------
2858 linux-image-extra-virtual-hwe-16.04:
2859 ----------
2860 architecture:
2861 amd64
2862 description:
2863 Extra drivers for Virtual Linux kernel image
2864 This package will always depend on linux-image-generic.
2865 group:
2866 kernel
2867 install_date:
2868 2019-10-01T11:50:15Z
2869 name:
2870 linux-image-extra-virtual-hwe-16.04
2871 packager:
2872 Ubuntu Kernel Team <kernel-team@lists.ubuntu.com>
2873 source:
2874 linux-meta-hwe
2875 version:
2876 4.15.0.54.75
2877 ...
2878
2879Output for case HWE is not installed:
2880
2881.. code-bloc:: bash
2882
2883 kvm02.cluster-env.local:
2884 ----------
2885 linux-image-extra-virtual-hwe-16.04:
2886 Not installed!
2887 linux-image-generic-hwe-16.04:
2888 Not installed!
2889
2890Method ``switch_kernel`` allows you to switch from non-HWE to HWE. It has
2891two options: ``dry_run`` - to check what packages are going to be installed or
2892removed and ``only_kernel`` - install only Kernel image packages without other
2893HWE packages.
2894
2895Method ``rollback_switch_kernel`` allows you to rollback method
2896``switch_kernel`` which was executed successfully previously. Option
2897``dry_run`` - to check what packages are going to be installed/removed.
2898
Filip Pytlounf5383a42015-10-06 16:28:32 +02002899Read more
2900=========
2901
2902* https://www.archlinux.org/
2903* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu