blob: ebccec8d76c4065063caca564def3156e1a9a39d [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 Polreich4aa3c282019-10-22 15:08:01 +020079Remove users data completely and terminate all user's processes:
Dzmitry Stremkouskia2960ad2019-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 Teselkinc7814732019-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 Teselkinc7814732019-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 Berezovskiy25e177d2019-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
Filip Pytloun281034a2016-01-04 18:06:22 +0100600Kernel
601~~~~~~
602
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300603Install always up to date LTS kernel and headers from Ubuntu Trusty:
Filip Pytloun281034a2016-01-04 18:06:22 +0100604
605.. code-block:: yaml
606
607 linux:
608 system:
609 kernel:
610 type: generic
611 lts: trusty
612 headers: true
613
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300614Load kernel modules and add them to ``/etc/modules``:
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100615
616.. code-block:: yaml
617
618 linux:
619 system:
620 kernel:
621 modules:
622 - nf_conntrack
623 - tp_smapi
624 - 8021q
625
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300626Configure or blacklist kernel modules with additional options to
627``/etc/modprobe.d`` following example will add
628``/etc/modprobe.d/nf_conntrack.conf`` file with line
629``options nf_conntrack hashsize=262144``:
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300630
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300631'option' can be a mapping (with 'enabled' and 'value' keys) or a scalar.
632
633Example for 'scalar' option value:
634
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300635.. code-block:: yaml
636
637 linux:
638 system:
639 kernel:
640 module:
641 nf_conntrack:
642 option:
643 hashsize: 262144
644
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300645Example for 'mapping' option value:
646
647.. code-block:: yaml
648
649 linux:
650 system:
651 kernel:
652 module:
653 nf_conntrack:
654 option:
655 hashsize:
656 enabled: true
657 value: 262144
658
659NOTE: 'enabled' key is optional and is True by default.
660
661Blacklist a module:
662
663.. code-block:: yaml
664
665 linux:
666 system:
667 kernel:
668 module:
669 nf_conntrack:
670 blacklist: true
671
672A module can have a number of aliases, wildcards are allowed.
673Define an alias for a module:
674
675.. code-block:: yaml
676
677 linux:
678 system:
679 kernel:
680 module:
681 nf_conntrack:
682 alias:
683 nfct:
684 enabled: true
685 "nf_conn*":
686 enabled: true
687
688NOTE: 'enabled' key is mandatory as there are no other keys exist.
689
690Execute custom command instead of 'insmod' when inserting a module:
691
692.. code-block:: yaml
693
694 linux:
695 system:
696 kernel:
697 module:
698 nf_conntrack:
699 install:
700 enabled: true
701 command: /bin/true
702
703NOTE: 'enabled' key is optional and is True by default.
704
705Execute custom command instead of 'rmmod' when removing a module:
706
707.. code-block:: yaml
708
709 linux:
710 system:
711 kernel:
712 module:
713 nf_conntrack:
714 remove:
715 enabled: true
716 command: /bin/true
717
718NOTE: 'enabled' key is optional and is True by default.
719
720Define module dependencies:
721
722.. code-block:: yaml
723
724 linux:
725 system:
726 kernel:
727 module:
728 nf_conntrack:
729 softdep:
730 pre:
731 1:
732 enabled: true
733 value: a
734 2:
735 enabled: true
736 value: b
737 3:
738 enabled: true
739 value: c
740 post:
741 1:
742 enabled: true
743 value: x
744 2:
745 enabled: true
746 value: y
747 3:
748 enabled: true
749 value: z
750
751NOTE: 'enabled' key is optional and is True by default.
752
753
Filip Pytloun281034a2016-01-04 18:06:22 +0100754Install specific kernel version and ensure all other kernel packages are
755not present. Also install extra modules and headers for this kernel:
756
757.. code-block:: yaml
758
759 linux:
760 system:
761 kernel:
762 type: generic
763 extra: true
764 headers: true
765 version: 4.2.0-22
766
Denis Egorenko567aa202019-11-06 14:02:00 +0400767Also it is possible to install Kernel with Hardware Enablement or virtual
768kernel packages. For example, for Xenial:
769
770.. code-block:: yaml
771
772 linux:
773 system:
774 kernel:
775 type: generic
776 extra: true
777 headers: true
778 version: 4.15.0-65
779 hwe:
780 type: hwe
781 version: 16.04
782 kernel_version: 4.15.0.65
783
784Set `linux:system:kernel:hwe:type:virtual` if you need Virtual kernel packages.
785
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300786Systcl kernel parameters:
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100787
788.. code-block:: yaml
789
790 linux:
791 system:
792 kernel:
793 sysctl:
794 net.ipv4.tcp_keepalive_intvl: 3
795 net.ipv4.tcp_keepalive_time: 30
796 net.ipv4.tcp_keepalive_probes: 8
797
Michael Polenchukebf55522018-01-25 13:22:39 +0400798Configure kernel boot options:
799
800.. code-block:: yaml
801
802 linux:
803 system:
804 kernel:
805 boot_options:
806 - elevator=deadline
807 - spectre_v2=off
808 - nopti
809
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100810CPU
811~~~
812
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300813Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100814
815.. code-block:: yaml
816
817 linux:
818 system:
819 cpu:
820 governor: performance
821
Nick Metzf04f5f32018-01-08 15:25:04 +0100822
Jiri Broulik303905d2018-01-11 14:12:48 +0100823CGROUPS
824~~~~~~~
825
826Setup linux cgroups:
827
828.. code-block:: yaml
829
830 linux:
831 system:
832 cgroup:
833 enabled: true
834 group:
835 ceph_group_1:
836 controller:
837 cpu:
838 shares:
839 value: 250
840 cpuacct:
841 usage:
842 value: 0
843 cpuset:
844 cpus:
845 value: 1,2,3
846 memory:
847 limit_in_bytes:
848 value: 2G
849 memsw.limit_in_bytes:
850 value: 3G
851 mapping:
852 subjects:
853 - '@ceph'
854 generic_group_1:
855 controller:
856 cpu:
857 shares:
858 value: 250
859 cpuacct:
860 usage:
861 value: 0
862 mapping:
863 subjects:
864 - '*:firefox'
865 - 'student:cp'
866
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300867Shared libraries
Nick Metzf04f5f32018-01-08 15:25:04 +0100868~~~~~~~~~~~~~~~~
869
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300870Set additional shared library to Linux system library path:
Nick Metzf04f5f32018-01-08 15:25:04 +0100871
872.. code-block:: yaml
873
874 linux:
875 system:
876 ld:
877 library:
878 java:
879 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
880 - /opt/java/jre/lib/amd64/server
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200881
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200882Certificates
883~~~~~~~~~~~~
884
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300885Add certificate authority into system trusted CA bundle:
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200886
887.. code-block:: yaml
888
889 linux:
890 system:
891 ca_certificates:
892 mycert: |
893 -----BEGIN CERTIFICATE-----
894 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
895 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
896 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
897 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
898 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
899 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
900 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
901 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
902 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
903 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
904 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
905 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
906 -----END CERTIFICATE-----
907
Filip Pytloun361096c2017-08-23 10:57:20 +0200908Sysfs
909~~~~~
910
911Install sysfsutils and set sysfs attributes:
912
913.. code-block:: yaml
914
915 linux:
916 system:
917 sysfs:
918 scheduler:
919 block/sda/queue/scheduler: deadline
920 power:
921 mode:
922 power/state: 0660
923 owner:
924 power/state: "root:power"
925 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
926
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200927Optional: You can also use list that will ensure order of items.
928
929.. code-block:: yaml
930
931 linux:
932 system:
933 sysfs:
934 scheduler:
935 block/sda/queue/scheduler: deadline
936 power:
937 - mode:
938 power/state: 0660
939 - owner:
940 power/state: "root:power"
941 - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
942
Martin Polreich148e1b82018-09-13 15:54:25 +0200943Sysfs definition with disabled automatic write. Attributes are saved
944to configuration, but are not applied during the run.
945Thay will be applied automatically after the reboot.
946
947
948.. code-block:: yaml
949
950 linux:
951 system:
952 sysfs:
953 enable_apply: false
954 scheduler:
955 block/sda/queue/scheduler: deadline
956
957.. note:: The `enable_apply` parameter defaults to `True` if not defined.
958
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100959Huge Pages
960~~~~~~~~~~~~
961
962Huge Pages give a performance boost to applications that intensively deal
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300963with memory allocation/deallocation by decreasing memory fragmentation:
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100964
965.. code-block:: yaml
966
967 linux:
968 system:
969 kernel:
970 hugepages:
971 small:
972 size: 2M
973 count: 107520
974 mount_point: /mnt/hugepages_2MB
Michael Polenchukd9369fe2018-05-08 17:53:08 +0400975 mount: false/true # default is true (mount immediately) / false (just save in the fstab)
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100976 large:
977 default: true # default automatically mounted
978 size: 1G
979 count: 210
980 mount_point: /mnt/hugepages_1GB
981
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300982.. note:: Not recommended to use both pagesizes concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100983
Jakub Pavlik5398d872017-02-13 22:30:47 +0100984Intel SR-IOV
985~~~~~~~~~~~~
986
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300987PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV)
988specification defines a standardized mechanism to virtualize
989PCIe devices. The mechanism can virtualize a single PCIe
990Ethernet controller to appear as multiple PCIe devices:
Jakub Pavlik5398d872017-02-13 22:30:47 +0100991
992.. code-block:: yaml
993
994 linux:
995 system:
996 kernel:
997 sriov: True
998 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
999 rc:
1000 local: |
1001 #!/bin/sh -e
1002 # Enable 7 VF on eth1
1003 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
1004 exit 0
1005
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001006Isolate CPU options
1007~~~~~~~~~~~~~~~~~~~
1008
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001009Remove the specified CPUs, as defined by the cpu_number values, from
1010the general kernel SMP balancing and scheduler algroithms. The only
1011way to move a process onto or off an *isolated* CPU is via the CPU
1012affinity syscalls. ``cpu_number begins`` at ``0``, so the
1013maximum value is ``1`` less than the number of CPUs on the system.:
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001014
1015.. code-block:: yaml
1016
1017 linux:
1018 system:
1019 kernel:
1020 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +01001021
Filip Pytlounf5383a42015-10-06 16:28:32 +02001022Repositories
1023~~~~~~~~~~~~
1024
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001025RedHat-based Linux with additional OpenStack repo:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001026
1027.. code-block:: yaml
1028
1029 linux:
1030 system:
1031 ...
1032 repo:
1033 rdo-icehouse:
1034 enabled: true
1035 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
1036 pgpcheck: 0
1037
1038Ensure system repository to use czech Debian mirror (``default: true``)
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001039Also pin it's packages with priority ``900``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001040
1041.. code-block:: yaml
1042
1043 linux:
1044 system:
1045 repo:
1046 debian:
1047 default: true
1048 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
1049 # Import signing key from URL if needed
1050 key_url: "http://dummy.com/public.gpg"
1051 pin:
1052 - pin: 'origin "ftp.cz.debian.org"'
1053 priority: 900
1054 package: '*'
1055
azvyagintseva3a73d02018-12-06 14:49:58 +02001056Sometimes better to use one pining rule file, to decrease mistaken
1057ordering. You can use those option ``system:apt:preferences``, which would add opts into
1058``/etc/apt/preferences`` file:
1059
1060.. code-block:: yaml
1061
1062 parameters:
1063 linux:
1064 system:
1065 apt:
1066 preferences:
1067 enabled: true
1068 rules:
1069 100:
1070 enabled: true
1071 name: 'some origin pin'
1072 pin: 'release o=Debian'
1073 priority: 1100
1074 package: '*'
1075
1076
azvyagintsev4494a472018-09-14 19:19:23 +03001077If you need to add multiple pin rules for one repo, please use new,ordered definition format
1078('pinning' definition will be in priotity to use):
1079
1080.. code-block:: yaml
1081
1082 linux:
1083 system:
1084 repo:
1085 mcp_saltstack:
1086 source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main"
1087 architectures: amd64
1088 clean_file: true
1089 pinning:
1090 10:
1091 enabled: true
1092 pin: 'release o=SaltStack'
1093 priority: 50
1094 package: 'libsodium18'
1095 20:
1096 enabled: true
1097 pin: 'release o=SaltStack'
1098 priority: 1100
1099 package: '*'
1100
1101
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001102.. note:: For old Ubuntu releases (<xenial)
azvyagintsevff089d22018-07-27 16:52:34 +02001103 extra packages for apt transport, like ``apt-transport-https``
1104 may be required to be installed manually.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001105 (Chicken-eggs issue: we need to install packages to
azvyagintsevff089d22018-07-27 16:52:34 +02001106 reach repo from where they should be installed)
1107 Otherwise, you still can try 'fortune' and install prereq.packages before
1108 any repo configuration, using list of requires in map.jinja.
1109
1110
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001111Disabling any prerequisite packages installation:
1112
azvyagintsevff089d22018-07-27 16:52:34 +02001113You can simply drop any package pre-installation (before system.linux.repo
1114will be processed) via cluster lvl:
1115
1116.. code-block:: yaml
1117
1118 linux:
1119 system:
1120 pkgs: ~
1121
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001122Package manager proxy global setup:
Petr Michalec10462bb2017-03-23 19:18:08 +01001123
1124.. code-block:: yaml
1125
1126 linux:
1127 system:
1128 ...
1129 repo:
1130 apt-mk:
1131 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1132 ...
1133 proxy:
1134 pkg:
1135 enabled: true
1136 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1137 ...
1138 # NOTE: Global defaults for any other componet that configure proxy on the system.
1139 # If your environment has just one simple proxy, set it on linux:system:proxy.
1140 #
1141 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1142 # as for https and http
1143 ftp: ftp://proxy.host.local:2121
1144 http: http://proxy.host.local:3142
1145 https: https://proxy.host.local:3143
1146
1147Package manager proxy setup per repository:
1148
1149.. code-block:: yaml
1150
1151 linux:
1152 system:
1153 ...
1154 repo:
1155 debian:
1156 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1157 ...
1158 apt-mk:
1159 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1160 # per repository proxy
1161 proxy:
1162 enabled: true
1163 http: http://maas-01:8080
1164 https: http://maas-01:8080
1165 ...
1166 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001167 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +01001168 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
1169 pkg:
1170 enabled: true
1171 ftp: ftp://proxy.host.local:2121
1172 #http: http://proxy.host.local:3142
1173 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001174 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001175 # global system fallback system defaults
1176 ftp: ftp://proxy.host.local:2121
1177 http: http://proxy.host.local:3142
1178 https: https://proxy.host.local:3143
1179
Ivan Berezovskiycfd58a22019-06-25 20:15:51 +04001180
1181Add secured apt repository:
1182
1183.. code-block:: yaml
1184
1185 linux:
1186 system:
1187 ...
1188 repo:
1189 test:
1190 secure: true
1191 url: example.org/ubuntu
1192 arch: deb
1193 protocol: http
1194 user: foo
1195 password: bar
1196 distribution: stable
1197 component: main
1198
1199Add multiply secured apt repositories with same credentials:
1200
1201.. code-block:: yaml
1202
1203 linux:
1204 system:
1205 ...
1206 common_repo_secured:
1207 arch: deb
1208 protocol: http
1209 user: foo
1210 password: bar
1211 distribution: stable
1212 component: main
1213 repo:
1214 test1:
1215 secure: true
1216 url: example1.org/ubuntu
1217 test2:
1218 secure: true
1219 url: example2.org/ubuntu
1220
Jiri Broulik34a29b42017-04-25 14:42:54 +02001221Remove all repositories:
1222
1223.. code-block:: yaml
1224
1225 linux:
1226 system:
1227 purge_repos: true
1228
azvyagintsevff089d22018-07-27 16:52:34 +02001229Refresh repositories metada, after configuration:
1230
1231.. code-block:: yaml
1232
1233 linux:
1234 system:
1235 refresh_repos_meta: true
1236
Filip Pytlounc512e6c2017-11-22 14:28:10 +01001237Setup custom apt config options:
1238
1239.. code-block:: yaml
1240
1241 linux:
1242 system:
1243 apt:
1244 config:
1245 compression-workaround:
1246 "Acquire::CompressionTypes::Order": "gz"
1247 docker-clean:
1248 "DPkg::Post-Invoke":
1249 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
1250 "APT::Update::Post-Invoke":
1251 - "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 +02001252
Petr Michalec10462bb2017-03-23 19:18:08 +01001253RC
1254~~
1255
Jakub Pavlik78859382016-01-21 11:26:39 +01001256rc.local example
1257
1258.. code-block:: yaml
1259
1260 linux:
1261 system:
1262 rc:
1263 local: |
1264 #!/bin/sh -e
1265 #
1266 # rc.local
1267 #
1268 # This script is executed at the end of each multiuser runlevel.
1269 # Make sure that the script will "exit 0" on success or any other
1270 # value on error.
1271 #
1272 # In order to enable or disable this script just change the execution
1273 # bits.
1274 #
1275 # By default this script does nothing.
1276 exit 0
1277
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001278Prompt
1279~~~~~~
1280
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001281Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``.
1282Every user can have different prompt:
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001283
1284.. code-block:: yaml
1285
1286 linux:
1287 system:
1288 prompt:
1289 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\\]
1290 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
1291
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001292On Debian systems, to set prompt system-wide, it's necessary to
1293remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``,
1294which comes from ``/etc/skel/.bashrc``. This formula will do
1295this automatically, but will not touch existing user's
1296``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +01001297
Filip Pytlouneef11c12016-03-25 11:00:23 +01001298Bash
1299~~~~
1300
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001301Fix bash configuration to preserve history across sessions
1302like ZSH does by default:
Filip Pytlouneef11c12016-03-25 11:00:23 +01001303
1304.. code-block:: yaml
1305
1306 linux:
1307 system:
1308 bash:
1309 preserve_history: true
1310
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001311Login banner message
1312~~~~~~~~~~~~~~~~~~~~
1313
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001314``/etc/issue`` is a text file which contains a message or system
1315identification to be printed before the login prompt. It may contain
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001316various @char and \char sequences, if supported by the getty-type
1317program employed on the system.
1318
1319Setting logon banner message is easy:
1320
1321.. code-block:: yaml
1322
1323 liunx:
1324 system:
1325 banner:
1326 enabled: true
1327 contents: |
1328 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1329
1330 You must have explicit, authorized permission to access or configure this
1331 device. Unauthorized attempts and actions to access or use this system may
1332 result in civil and/or criminal penalties.
1333 All activities performed on this system are logged and monitored.
1334
Filip Pytloune874dfb2016-01-22 16:57:34 +01001335Message of the day
1336~~~~~~~~~~~~~~~~~~
1337
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001338``pam_motd`` from package ``libpam-modules`` is used for dynamic
1339messages of the day. Setting custom ``motd`` will clean up existing ones.
Filip Pytloune874dfb2016-01-22 16:57:34 +01001340
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001341Setting static ``motd`` will replace existing ``/etc/motd`` and remove
1342scripts from ``/etc/update-motd.d``.
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001343
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001344Setting static ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001345
1346.. code-block:: yaml
1347
1348 linux:
1349 system:
1350 motd: |
1351 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1352
1353 You must have explicit, authorized permission to access or configure this
1354 device. Unauthorized attempts and actions to access or use this system may
1355 result in civil and/or criminal penalties.
1356 All activities performed on this system are logged and monitored.
1357
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001358Setting dynamic ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001359
Filip Pytloune874dfb2016-01-22 16:57:34 +01001360.. code-block:: yaml
1361
1362 linux:
1363 system:
1364 motd:
1365 - release: |
1366 #!/bin/sh
1367 [ -r /etc/lsb-release ] && . /etc/lsb-release
1368
1369 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
1370 # Fall back to using the very slow lsb_release utility
1371 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
1372 fi
1373
1374 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
1375 - warning: |
1376 #!/bin/sh
1377 printf "This is [company name] network.\n"
1378 printf "Unauthorized access strictly prohibited.\n"
1379
Marek Celoud713e9072017-05-18 15:20:25 +02001380Services
1381~~~~~~~~
1382
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001383Stop and disable the ``linux`` service:
Marek Celoud713e9072017-05-18 15:20:25 +02001384
1385.. code-block:: yaml
1386
1387 linux:
1388 system:
1389 service:
1390 apt-daily.timer:
1391 status: dead
1392
Dzmitry Stremkouski70d09782018-11-30 16:04:59 +01001393Override systemd service unit:
1394
1395.. code-block:: yaml
1396
1397 parameters:
1398
1399 linux:
1400 system:
1401 service:
1402 tgt:
1403 name: tgt
1404 status: running
1405 enabled: True
1406 override:
1407 50:
1408 target: tgt.service.d
1409 name: bind
1410 content: |
1411 [Service]
1412 ExecStart=
1413 ExecStart=/usr/sbin/tgtd -f --iscsi portal=${_param:single_address}:3260
1414
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001415Possible statuses are ``dead`` (disable service by default), ``running``
1416(enable service by default), ``enabled``, ``disabled``:
Marek Celoud713e9072017-05-18 15:20:25 +02001417
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001418Linux with the ``atop`` service:
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +03001419
1420.. code-block:: yaml
1421
1422 linux:
1423 system:
1424 atop:
1425 enabled: true
1426 interval: 20
1427 logpath: "/var/log/atop"
1428 outfile: "/var/log/atop/daily.log"
1429
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001430Linux with the ``mcelog`` service:
Oleksii Chupryn144432b2018-05-22 10:34:48 +03001431
1432.. code-block:: yaml
1433
1434 linux:
1435 system:
1436 mcelog:
1437 enabled: true
1438 logging:
1439 syslog: true
1440 syslog_error: true
1441
Denis Egorenko394ae072019-11-22 17:26:30 +04001442Linux Sosreport
1443^^^^^^^^^^^^^^^
1444
1445Sosreport is an extensible, portable, support data collection tool
1446primarily aimed at Linux distributions and other UNIX-like operating systems,
1447which allows to create diagnostic snapshot of system.
1448
1449Works out of box and additional pillars are not needed by default:
1450
1451.. code-block:: bash
1452
1453 salt-call state.sls linux.system.sosreport.report
1454
1455or from Salt Master:
1456
1457.. code-block:: bash
1458
1459 salt -C '<target>' state.sls linux.system.sosreport.report
1460
1461Sosreport configuration may be extended with next pillar data:
1462
1463.. code-block:: yaml
1464
1465 linux:
1466 system:
1467 sosreport:
1468 cmd_options:
1469 tmp-dir: /root/reportdir
1470 no_arg_opts: [ '-q' ]
1471 config_options:
1472 general:
1473 all-logs: true
1474 plugins:
1475 disabled: [ docker ]
1476 tunables:
1477 apache.log: true
1478
1479Where is ``cmd_options`` additional provided arguments for cli cmd call,
1480``general`` desribes parameters for sos.conf ``general`` section,
1481``plugins`` desribes which plugins should be ``enabled`` or ``disabled``
1482and ``tunables`` has custom plugin options which can be additionally set.
1483
1484Also it is possible to pass cmd_options through pillar override:
1485
1486.. code-block:: bash
1487
1488 salt -C '<target>' state.sls linux.system.sosreport.report pillar='{ "sosreport" : { "ticket-number": 12345, "tmp-dir": "/root/reportdir2" } }'
1489
1490Run ``sosreport --help`` to get full list of possible options.
1491
1492Once state ``linux.system.sosreport.report`` is executed on targets, it is
1493possible to collect all reports by using next command on Salt Master:
1494
1495.. code-block:: bash
1496
1497 salt -C 'I@salt:master' state.sls linux.system.sosreport.collect pillar='{ "sosreport_collect" : { "target": "<target>", "archiveName": "sosreport_<env_name>_<customer>_<ticket>" } }'
1498
1499This will generate one common archive for all ``<target>`` nodes with name
1500``sosreport_<env_name>_<customer>_<ticket>.tar.gz``. It is required to specify
1501target nodes through model (``linux.system.sosreport.collect``) or pillar
1502override. Also possible options are: ``nodeIp`` which allows you to use IP from another
1503interface on node (should be available from minions), ``port`` for NetCat if
1504you see that default port is busy, ``archiveName`` for your archive and
1505``reportWorkDir`` directory to keeping all reports for current case.
1506
Filip Pytloun2f70b492016-02-19 15:55:25 +01001507RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +01001508^^^^^^^^^^^^^
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001509Currently, ``update-motd`` is not available
1510for RHEL. So there is no native support for dynamic ``motd``.
1511You can still set a static one, with a different pillar structure:
Filip Pytloun2f70b492016-02-19 15:55:25 +01001512
1513.. code-block:: yaml
1514
1515 linux:
1516 system:
1517 motd: |
1518 This is [company name] network.
1519 Unauthorized access strictly prohibited.
1520
Filip Pytloun8296bb92016-02-19 18:42:09 +01001521Haveged
1522~~~~~~~
1523
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001524If you are running headless server and are low on entropy,
1525you may set up Haveged:
Filip Pytloun8296bb92016-02-19 18:42:09 +01001526
1527.. code-block:: yaml
1528
1529 linux:
1530 system:
1531 haveged:
1532 enabled: true
1533
Filip Pytlounf5383a42015-10-06 16:28:32 +02001534Linux network
1535-------------
1536
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001537Linux with network manager:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001538
1539.. code-block:: yaml
1540
1541 linux:
1542 network:
1543 enabled: true
1544 network_manager: true
1545
Dzmitry Stremkouski00cdbe62018-10-31 16:41:54 +01001546Execute linux.network.interface state without ifupdown activity:
1547
1548.. code-block:: bash
1549
1550 salt-call linux.network.interface pillar='{"linux":{"network":{"noifupdown":True}}}'
1551
1552
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001553Linux with default static network interfaces, default gateway
1554interface and DNS servers:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001555
1556.. code-block:: yaml
1557
1558 linux:
1559 network:
1560 enabled: true
1561 interface:
1562 eth0:
1563 enabled: true
1564 type: eth
1565 address: 192.168.0.102
1566 netmask: 255.255.255.0
1567 gateway: 192.168.0.1
1568 name_servers:
1569 - 8.8.8.8
1570 - 8.8.4.4
1571 mtu: 1500
1572
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001573Linux with bonded interfaces and disabled ``NetworkManager``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001574
1575.. code-block:: yaml
1576
1577 linux:
1578 network:
1579 enabled: true
1580 interface:
1581 eth0:
1582 type: eth
1583 ...
1584 eth1:
1585 type: eth
1586 ...
1587 bond0:
1588 enabled: true
1589 type: bond
1590 address: 192.168.0.102
1591 netmask: 255.255.255.0
1592 mtu: 1500
1593 use_in:
1594 - interface: ${linux:interface:eth0}
1595 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +01001596 network_manager:
1597 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001598
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001599Linux with VLAN ``interface_params``:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001600
1601.. code-block:: yaml
1602
1603 linux:
1604 network:
1605 enabled: true
1606 interface:
1607 vlan69:
1608 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001609 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001610 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001611
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001612Linux with wireless interface parameters:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001613
1614.. code-block:: yaml
1615
1616 linux:
1617 network:
1618 enabled: true
1619 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001620 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001621 interface:
1622 wlan0:
1623 type: eth
1624 wireless:
1625 essid: example
1626 key: example_key
1627 security: wpa
1628 priority: 1
1629
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001630Linux networks with routes defined:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001631
1632.. code-block:: yaml
1633
1634 linux:
1635 network:
1636 enabled: true
1637 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001638 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001639 interface:
1640 eth0:
1641 type: eth
1642 route:
1643 default:
1644 address: 192.168.0.123
1645 netmask: 255.255.255.0
1646 gateway: 192.168.0.1
1647
ivce5011da2019-01-23 07:56:53 +03001648Linux networks with implicit routes definition:
1649
1650- on node 1:
1651
1652.. code-block:: yaml
1653
1654 linux:
1655 network:
1656 enabled: true
1657 router:
1658 ctl:
1659 # router that connects 10.0.1.0/24 and 10.0.2.0/24
1660 addresses:
1661 - 10.0.1.1/24
1662 - 10.0.2.1/24
1663 test:
1664 addresses:
1665 - 10.0.1.2/24
1666 networks:
1667 - 10.100.0.0/16
1668 interface:
1669 ctl:
1670 name: eth0
1671 address: 10.0.1.101
1672 netmask: 255.255.255.0
1673
1674- on node2:
1675
1676.. code-block:: yaml
1677
1678 linux:
1679 network:
1680 enabled: true
1681 router:
1682 ctl:
1683 # equivalent of node1's ctl router with 'implicit_routes = false'
1684 options:
1685 implicit_routes: false
1686 addresses:
1687 - 10.0.1.1/24
1688 - 10.0.2.1/24
1689 networks:
1690 - 10.0.1.0/24
1691 - 10.0.2.0/24
1692 interface:
1693 ctl:
1694 name: eth0
1695 address: 10.0.2.101
1696 netmask: 255.255.255.0
1697
1698
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001699Native Linux Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001700
1701.. code-block:: yaml
1702
1703 linux:
1704 network:
1705 interface:
1706 eth1:
1707 enabled: true
1708 type: eth
1709 proto: manual
1710 up_cmds:
1711 - ip address add 0/0 dev $IFACE
1712 - ip link set $IFACE up
1713 down_cmds:
1714 - ip link set $IFACE down
1715 br-ex:
1716 enabled: true
1717 type: bridge
1718 address: ${linux:network:host:public_local:address}
1719 netmask: 255.255.255.0
1720 use_interfaces:
1721 - eth1
1722
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001723Open vSwitch Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001724
1725.. code-block:: yaml
1726
1727 linux:
1728 network:
1729 bridge: openvswitch
1730 interface:
1731 eth1:
1732 enabled: true
1733 type: eth
1734 proto: manual
1735 up_cmds:
1736 - ip address add 0/0 dev $IFACE
1737 - ip link set $IFACE up
1738 down_cmds:
1739 - ip link set $IFACE down
1740 br-ex:
1741 enabled: true
1742 type: bridge
1743 address: ${linux:network:host:public_local:address}
1744 netmask: 255.255.255.0
1745 use_interfaces:
1746 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001747 br-prv:
1748 enabled: true
1749 type: ovs_bridge
1750 mtu: 65000
1751 br-ens7:
1752 enabled: true
1753 name: br-ens7
1754 type: ovs_bridge
1755 proto: manual
1756 mtu: 9000
1757 use_interfaces:
1758 - ens7
1759 patch-br-ens7-br-prv:
1760 enabled: true
1761 name: ens7-prv
1762 ovs_type: ovs_port
1763 type: ovs_port
1764 bridge: br-ens7
1765 port_type: patch
1766 peer: prv-ens7
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001767 tag: 109 # [] to unset a tag
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001768 mtu: 65000
1769 patch-br-prv-br-ens7:
1770 enabled: true
1771 name: prv-ens7
1772 bridge: br-prv
1773 ovs_type: ovs_port
1774 type: ovs_port
1775 port_type: patch
1776 peer: ens7-prv
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001777 tag: 109
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001778 mtu: 65000
1779 ens7:
1780 enabled: true
1781 name: ens7
1782 proto: manual
1783 ovs_port_type: OVSPort
1784 type: ovs_port
1785 ovs_bridge: br-ens7
1786 bridge: br-ens7
Oleg Gelbukh36f01072019-07-01 15:26:16 -07001787 ens6:
1788 enabled: true
1789 proto: manual
1790 type: eth
1791 ovs_bridge: br-ctl
1792 br-ctl:
1793 enabled: true
1794 type: ovs_bridge
1795 internal-br-ctl-port:
1796 enabled: true
1797 proto: static
1798 address: 172.172.0.10
1799 netmask: 255.255.0.0
1800 name_servers:
1801 - 8.8.8.8
1802 - 172.172.172.172
1803 name: port-br-ctl
1804 bridge: br-ctl
1805 ovs_type: ovs_port
1806 type: ovs_port
1807 port_type: internal
1808 mtu: 65000
Filip Pytlounf5383a42015-10-06 16:28:32 +02001809
Petr Jediný8f8ae542017-07-13 16:19:12 +02001810Debian manual proto interfaces
1811
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001812When you are changing interface proto from static in up state
1813to manual, you may need to flush ip addresses. For example,
1814if you want to use the interface and the ip on the bridge.
1815This can be done by setting the ``ipflush_onchange`` to true.
Petr Jediný8f8ae542017-07-13 16:19:12 +02001816
1817.. code-block:: yaml
1818
1819 linux:
1820 network:
1821 interface:
1822 eth1:
1823 enabled: true
1824 type: eth
1825 proto: manual
1826 mtu: 9100
1827 ipflush_onchange: true
1828
Jiri Broulik1a191e32018-01-15 15:54:21 +01001829Debian static proto interfaces
1830
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001831When you are changing interface proto from dhcp in up state to
1832static, you may need to flush ip addresses and restart interface
1833to assign ip address from a managed file. For example, if you wantto
1834use the interface and the ip on the bridge. This can be done by
1835setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
1836param set to true.
Jiri Broulik1a191e32018-01-15 15:54:21 +01001837
1838.. code-block:: yaml
1839
1840 linux:
1841 network:
1842 interface:
1843 eth1:
1844 enabled: true
1845 type: eth
1846 proto: static
1847 address: 10.1.0.22
1848 netmask: 255.255.255.0
1849 ipflush_onchange: true
1850 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001851
Petr Jedinýd577cb52017-06-28 20:17:49 +02001852Concatinating and removing interface files
1853
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001854Debian based distributions have ``/etc/network/interfaces.d/``
1855directory, where you can store configuration of network
1856interfaces in separate files. You can concatinate the files
1857to the defined destination when needed, this operation removes
1858the file from the ``/etc/network/interfaces.d/``. If you just need
1859to remove iface files, you can use the ``remove_iface_files`` key.
Petr Jedinýd577cb52017-06-28 20:17:49 +02001860
1861.. code-block:: yaml
1862
1863 linux:
1864 network:
1865 concat_iface_files:
1866 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1867 dst: '/etc/network/interfaces'
1868 remove_iface_files:
1869 - '/etc/network/interfaces.d/90-custom.cfg'
1870
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001871Configure DHCP client
Petr Jedinýd577cb52017-06-28 20:17:49 +02001872
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001873None of the keys is mandatory, include only those you really need.
1874For full list of available options under send, supersede, prepend,
1875append refer to dhcp-options(5).
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001876
1877.. code-block:: yaml
1878
1879 linux:
1880 network:
1881 dhclient:
1882 enabled: true
1883 backoff_cutoff: 15
1884 initial_interval: 10
1885 reboot: 10
1886 retry: 60
1887 select_timeout: 0
1888 timeout: 120
1889 send:
1890 - option: host-name
1891 declaration: "= gethostname()"
1892 supersede:
1893 - option: host-name
1894 declaration: "spaceship"
1895 - option: domain-name
1896 declaration: "domain.home"
1897 #- option: arp-cache-timeout
1898 # declaration: 20
1899 prepend:
1900 - option: domain-name-servers
1901 declaration:
1902 - 8.8.8.8
1903 - 8.8.4.4
1904 - option: domain-search
1905 declaration:
1906 - example.com
1907 - eng.example.com
1908 #append:
1909 #- option: domain-name-servers
1910 # declaration: 127.0.0.1
1911 # ip or subnet to reject dhcp offer from
1912 reject:
1913 - 192.33.137.209
1914 - 10.0.2.0/24
1915 request:
1916 - subnet-mask
1917 - broadcast-address
1918 - time-offset
1919 - routers
1920 - domain-name
1921 - domain-name-servers
1922 - domain-search
1923 - host-name
1924 - dhcp6.name-servers
1925 - dhcp6.domain-search
1926 - dhcp6.fqdn
1927 - dhcp6.sntp-servers
1928 - netbios-name-servers
1929 - netbios-scope
1930 - interface-mtu
1931 - rfc3442-classless-static-routes
1932 - ntp-servers
1933 require:
1934 - subnet-mask
1935 - domain-name-servers
1936 # if per interface configuration required add below
1937 interface:
1938 ens2:
1939 initial_interval: 11
1940 reject:
1941 - 192.33.137.210
1942 ens3:
1943 initial_interval: 12
1944 reject:
1945 - 192.33.137.211
1946
Petr Michaleceb14b552017-06-01 10:27:05 +02001947Linux network systemd settings:
1948
1949.. code-block:: yaml
1950
1951 linux:
1952 network:
1953 ...
1954 systemd:
1955 link:
1956 10-iface-dmz:
1957 Match:
1958 MACAddress: c8:5b:67:fa:1a:af
1959 OriginalName: eth0
1960 Link:
1961 Name: dmz0
1962 netdev:
1963 20-bridge-dmz:
1964 match:
1965 name: dmz0
1966 network:
1967 mescription: bridge
1968 bridge: br-dmz0
1969 network:
1970 # works with lowercase, keys are by default capitalized
1971 40-dhcp:
1972 match:
1973 name: '*'
1974 network:
1975 DHCP: yes
1976
Petr Michalec10462bb2017-03-23 19:18:08 +01001977Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001978
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001979Use ``/etc/environment`` for static system wide variable assignment
1980after boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001981
1982.. code-block:: yaml
1983
1984 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001985 system:
1986 env:
1987 BOB_VARIABLE: Alice
1988 ...
1989 BOB_PATH:
1990 - /srv/alice/bin
1991 - /srv/bob/bin
1992 ...
1993 ftp_proxy: none
1994 http_proxy: http://global-http-proxy.host.local:8080
1995 https_proxy: ${linux:system:proxy:https}
1996 no_proxy:
1997 - 192.168.0.80
1998 - 192.168.1.80
1999 - .domain.com
2000 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02002001 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01002002 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002003 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01002004 ftp: ftp://proxy.host.local:2121
2005 http: http://proxy.host.local:3142
2006 https: https://proxy.host.local:3143
2007 noproxy:
2008 - .domain.com
2009 - .local
2010
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002011Configure the ``profile.d`` scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01002012
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002013The ``profile.d`` scripts are being sourced during ``.sh`` execution
2014and support variable expansion in opposite to /etc/environment global
2015settings in ``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01002016
2017.. code-block:: yaml
2018
2019 linux:
2020 system:
2021 profile:
2022 locales: |
2023 export LANG=C
2024 export LC_ALL=C
2025 ...
2026 vi_flavors.sh: |
2027 export PAGER=view
2028 export EDITOR=vim
2029 alias vi=vim
2030 shell_locales.sh: |
2031 export LANG=en_US
2032 export LC_ALL=en_US.UTF-8
2033 shell_proxies.sh: |
2034 export FTP_PROXY=ftp://127.0.3.3:2121
2035 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02002036
Dmitry Teselkina0d31d12018-09-04 14:43:09 +03002037
2038Configure login.defs parameters
2039-------------------------------
2040
2041.. code-block:: yaml
2042
2043 linux:
2044 system:
2045 login_defs:
2046 <opt_name>:
2047 enabled: true
2048 value: <opt_value>
2049
2050<opt_name> is a configurational option defined in 'man login.defs'.
2051<opt_name> is case sensitive, should be UPPERCASE only!
2052
2053
Filip Pytlounf5383a42015-10-06 16:28:32 +02002054Linux with hosts
2055
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002056Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
2057removing entries that are not defined in model except defaults
2058for both IPv4 and IPv6 localhost and hostname as well as FQDN.
Ales Komarek417e8c52017-08-25 15:10:29 +02002059
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002060We recommend using this option to verify that ``/etc/hosts``
2061is always in a clean state. However it is not enabled by default
2062for security reasons.
Filip Pytloun86506fe2017-01-26 14:36:16 +01002063
Filip Pytlounf5383a42015-10-06 16:28:32 +02002064.. code-block:: yaml
2065
2066 linux:
2067 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002068 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002069 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002070 # No need to define this one if purge_hosts is true
2071 hostname:
2072 address: 127.0.1.1
2073 names:
2074 - ${linux:network:fqdn}
2075 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02002076 node1:
2077 address: 192.168.10.200
2078 names:
2079 - node2.domain.com
2080 - service2.domain.com
2081 node2:
2082 address: 192.168.10.201
2083 names:
2084 - node2.domain.com
2085 - service2.domain.com
2086
Ales Komarek417e8c52017-08-25 15:10:29 +02002087Linux with hosts collected from mine
2088
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002089All DNS records defined within infrastrucuture
2090are passed to the local hosts records or any DNS server. Only
2091hosts with the ``grain`` parameter set to ``true`` will be propagated
2092to the mine.
Ales Komarek417e8c52017-08-25 15:10:29 +02002093
2094.. code-block:: yaml
2095
2096 linux:
2097 network:
2098 purge_hosts: true
2099 mine_dns_records: true
2100 host:
2101 node1:
2102 address: 192.168.10.200
2103 grain: true
2104 names:
2105 - node2.domain.com
2106 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01002107
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002108Set up ``resolvconf's basic resolver info``, e.g. nameservers, search/domain and options:
Filip Pytlounde9bea52016-01-11 15:39:10 +01002109
2110.. code-block:: yaml
2111
2112 linux:
2113 network:
2114 resolv:
2115 dns:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002116 - 8.8.4.4
2117 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01002118 domain: my.example.com
2119 search:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002120 - my.example.com
2121 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01002122 options:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002123 - ndots:5
2124 - timeout:2
2125 - attempts:2
Filip Pytlounde9bea52016-01-11 15:39:10 +01002126
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002127Set up custom TX queue length for tap interfaces:
Andrii Petrenko735761d2017-03-21 17:17:35 -07002128
2129.. code-block:: yaml
2130
2131 linux:
2132 network:
2133 tap_custom_txqueuelen: 10000
2134
Michael Polenchukc37bd4a2019-04-22 15:20:03 +04002135Auto repair/re-attach libvirt's vnet interfaces:
2136
2137.. code-block:: yaml
2138
2139 linux:
2140 network:
2141 libvirt_vnet_repair: true
2142
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002143DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002144
2145**DPDK OVS NIC**
2146
2147.. code-block:: yaml
2148
2149 linux:
2150 network:
2151 bridge: openvswitch
2152 dpdk:
2153 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002154 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002155 openvswitch:
2156 pmd_cpu_mask: "0x6"
2157 dpdk_socket_mem: "1024,1024"
2158 dpdk_lcore_mask: "0x400"
2159 memory_channels: 2
2160 interface:
2161 dpkd0:
2162 name: ${_param:dpdk_nic}
2163 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002164 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002165 enabled: true
2166 type: dpdk_ovs_port
2167 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002168 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002169 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01002170 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002171 br-prv:
2172 enabled: true
2173 type: dpdk_ovs_bridge
2174
2175**DPDK OVS Bond**
2176
2177.. code-block:: yaml
2178
2179 linux:
2180 network:
2181 bridge: openvswitch
2182 dpdk:
2183 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002184 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002185 openvswitch:
2186 pmd_cpu_mask: "0x6"
2187 dpdk_socket_mem: "1024,1024"
2188 dpdk_lcore_mask: "0x400"
2189 memory_channels: 2
2190 interface:
2191 dpdk_second_nic:
2192 name: ${_param:primary_second_nic}
2193 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002194 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002195 bond: dpdkbond0
2196 enabled: true
2197 type: dpdk_ovs_port
2198 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002199 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002200 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002201 dpdk_first_nic:
2202 name: ${_param:primary_first_nic}
2203 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002204 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002205 bond: dpdkbond0
2206 enabled: true
2207 type: dpdk_ovs_port
2208 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002209 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002210 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002211 dpdkbond0:
2212 enabled: true
2213 bridge: br-prv
2214 type: dpdk_ovs_bond
2215 mode: active-backup
2216 br-prv:
2217 enabled: true
2218 type: dpdk_ovs_bridge
2219
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01002220**DPDK OVS LACP Bond with vlan tag**
2221
2222.. code-block:: yaml
2223
2224 linux:
2225 network:
2226 bridge: openvswitch
2227 dpdk:
2228 enabled: true
2229 driver: uio
2230 openvswitch:
2231 pmd_cpu_mask: "0x6"
2232 dpdk_socket_mem: "1024,1024"
2233 dpdk_lcore_mask: "0x400"
2234 memory_channels: "2"
2235 interface:
2236 eth3:
2237 enabled: true
2238 type: eth
2239 proto: manual
2240 name: ${_param:tenant_first_nic}
2241 eth4:
2242 enabled: true
2243 type: eth
2244 proto: manual
2245 name: ${_param:tenant_second_nic}
2246 dpdk0:
2247 name: ${_param:tenant_first_nic}
2248 pci: "0000:81:00.0"
2249 driver: igb_uio
2250 bond: bond1
2251 enabled: true
2252 type: dpdk_ovs_port
2253 n_rxq: 2
2254 dpdk1:
2255 name: ${_param:tenant_second_nic}
2256 pci: "0000:81:00.1"
2257 driver: igb_uio
2258 bond: bond1
2259 enabled: true
2260 type: dpdk_ovs_port
2261 n_rxq: 2
2262 bond1:
2263 enabled: true
2264 bridge: br-prv
2265 type: dpdk_ovs_bond
2266 mode: balance-slb
2267 br-prv:
2268 enabled: true
2269 type: dpdk_ovs_bridge
2270 tag: ${_param:tenant_vlan}
2271 address: ${_param:tenant_address}
2272 netmask: ${_param:tenant_network_netmask}
2273
Jakub Pavlikaa759062017-03-13 15:57:26 +01002274**DPDK OVS bridge for VXLAN**
2275
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002276If VXLAN is used as tenant segmentation, IP address must
2277be set on ``br-prv``.
Jakub Pavlikaa759062017-03-13 15:57:26 +01002278
2279.. code-block:: yaml
2280
2281 linux:
2282 network:
2283 ...
2284 interface:
2285 br-prv:
2286 enabled: true
2287 type: dpdk_ovs_bridge
2288 address: 192.168.50.0
2289 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04002290 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01002291 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002292
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02002293**DPDK OVS bridge with Linux network interface**
2294
2295.. code-block:: yaml
2296
2297 linux:
2298 network:
2299 ...
2300 interface:
2301 eth0:
2302 type: eth
2303 ovs_bridge: br-prv
2304 ...
2305 br-prv:
2306 enabled: true
2307 type: dpdk_ovs_bridge
2308 ...
2309
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002310Linux storage
2311-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02002312
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002313Linux with mounted Samba:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002314
2315.. code-block:: yaml
2316
2317 linux:
2318 storage:
2319 enabled: true
2320 mount:
2321 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01002322 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002323 - path: /media/myuser/public/
2324 - device: //192.168.0.1/storage
2325 - file_system: cifs
2326 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
2327
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002328NFS mount:
Jiri Broulikb017f932017-03-31 13:55:36 +02002329
2330.. code-block:: yaml
2331
2332 linux:
2333 storage:
2334 enabled: true
2335 mount:
2336 nfs_glance:
2337 enabled: true
2338 path: /var/lib/glance/images
2339 device: 172.16.10.110:/var/nfs/glance
2340 file_system: nfs
2341 opts: rw,sync
2342
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002343File swap configuration:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002344
2345.. code-block:: yaml
2346
2347 linux:
2348 storage:
2349 enabled: true
2350 swap:
2351 file:
2352 enabled: true
2353 engine: file
2354 device: /swapfile
2355 size: 1024
2356
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002357Partition swap configuration:
Lachlan Evenson30676512016-01-22 15:43:28 -08002358
2359.. code-block:: yaml
2360
2361 linux:
2362 storage:
2363 enabled: true
2364 swap:
2365 partition:
2366 enabled: true
2367 engine: partition
2368 device: /dev/vg0/swap
2369
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002370LVM group ``vg1`` with one device and ``data`` volume mounted
2371into ``/mnt/data``.
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002372
2373.. code-block:: yaml
2374
2375 parameters:
2376 linux:
2377 storage:
2378 mount:
2379 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01002380 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002381 device: /dev/vg1/data
2382 file_system: ext4
2383 path: /mnt/data
2384 lvm:
2385 vg1:
2386 enabled: true
2387 devices:
2388 - /dev/sdb
2389 volume:
2390 data:
2391 size: 40G
2392 mount: ${linux:storage:mount:data}
root3387f332019-01-11 08:55:32 +00002393 # When set they will take precedence over filters aget from volume groups.
2394 lvm_filters:
2395 10:
2396 enabled: True
2397 value: "a|loop|"
2398 20:
2399 enabled: True
2400 value: "r|/dev/hdc|"
2401 30:
2402 enabled: True
2403 value: "a|/dev/ide|"
2404 40:
2405 enabled: True
2406 value: "r|.*|"
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002407
Jakub Pavlik4f742142017-08-08 15:05:50 +02002408Create partitions on disk. Specify size in MB. It expects empty
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002409disk without any existing partitions.
2410Set ``startsector=1`` if you want to start partitions from ``2048``.
Jakub Pavlik4f742142017-08-08 15:05:50 +02002411
2412.. code-block:: yaml
2413
2414 linux:
2415 storage:
2416 disk:
2417 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01002418 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02002419 name: /dev/loop1
2420 type: gpt
2421 partitions:
2422 - size: 200 #size in MB
2423 type: fat32
2424 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02002425 mkfs: True
2426 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02002427 /dev/vda1:
2428 partitions:
2429 - size: 5
2430 type: ext2
2431 - size: 10
2432 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02002433
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002434Multipath with Fujitsu Eternus DXL:
Ales Komareka634f4b2016-10-02 13:11:04 +02002435
2436.. code-block:: yaml
2437
2438 parameters:
2439 linux:
2440 storage:
2441 multipath:
2442 enabled: true
2443 blacklist_devices:
2444 - /dev/sda
2445 - /dev/sdb
2446 backends:
2447 - fujitsu_eternus_dxl
2448
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002449Multipath with Hitachi VSP 1000:
Ales Komareka634f4b2016-10-02 13:11:04 +02002450
2451.. code-block:: yaml
2452
2453 parameters:
2454 linux:
2455 storage:
2456 multipath:
2457 enabled: true
2458 blacklist_devices:
2459 - /dev/sda
2460 - /dev/sdb
2461 backends:
2462 - hitachi_vsp1000
2463
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002464Multipath with IBM Storwize:
Ales Komareka634f4b2016-10-02 13:11:04 +02002465
2466.. code-block:: yaml
2467
2468 parameters:
2469 linux:
2470 storage:
2471 multipath:
2472 enabled: true
2473 blacklist_devices:
2474 - /dev/sda
2475 - /dev/sdb
2476 backends:
2477 - ibm_storwize
2478
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002479Multipath with multiple backends:
Ales Komareka634f4b2016-10-02 13:11:04 +02002480
2481.. code-block:: yaml
2482
2483 parameters:
2484 linux:
2485 storage:
2486 multipath:
2487 enabled: true
2488 blacklist_devices:
2489 - /dev/sda
2490 - /dev/sdb
2491 - /dev/sdc
2492 - /dev/sdd
2493 backends:
2494 - ibm_storwize
2495 - fujitsu_eternus_dxl
2496 - hitachi_vsp1000
2497
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002498PAM LDAP integration:
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002499
2500.. code-block:: yaml
2501
2502 parameters:
2503 linux:
2504 system:
2505 auth:
2506 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02002507 mkhomedir:
2508 enabled: true
2509 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002510 ldap:
2511 enabled: true
2512 binddn: cn=bind,ou=service_users,dc=example,dc=com
2513 bindpw: secret
2514 uri: ldap://127.0.0.1
2515 base: ou=users,dc=example,dc=com
2516 ldap_version: 3
2517 pagesize: 65536
2518 referrals: off
2519 filter:
2520 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2521 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2522 group: (&(objectClass=group)(gidNumber=*))
2523
Gleb Galkin93b9ae92018-10-18 13:57:30 +03002524PAM duo 2FA integration
2525
2526.. code-block:: yaml
2527
2528 parameters:
2529 linux:
2530 system:
2531 auth:
2532 enabled: true
2533 duo:
2534 enabled: true
2535 duo_host: localhost
2536 duo_ikey: DUO-INTEGRATION-KEY
2537 duo_skey: DUO-SECRET-KEY
2538
2539duo package version may be specified (optional)
2540
2541.. code-block:: yaml
2542
2543 linux:
2544 system:
2545 package:
2546 duo-unix:
2547 version: 1.10.1-0
2548
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002549Disabled multipath (the default setup):
Ales Komareka634f4b2016-10-02 13:11:04 +02002550
2551.. code-block:: yaml
2552
2553 parameters:
2554 linux:
2555 storage:
2556 multipath:
2557 enabled: false
2558
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002559Linux with local loopback device:
Simon Pasquier375001e2017-01-26 13:22:33 +01002560
2561.. code-block:: yaml
2562
2563 linux:
2564 storage:
2565 loopback:
2566 disk1:
2567 file: /srv/disk1
2568 size: 50G
2569
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002570External config generation
2571--------------------------
2572
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002573You are able to use config support metadata between formulas
2574and only generate configuration files for external use, for example, Docker, and so on.
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002575
2576.. code-block:: yaml
2577
2578 parameters:
2579 linux:
2580 system:
2581 config:
2582 pillar:
2583 jenkins:
2584 master:
2585 home: /srv/volumes/jenkins
2586 approved_scripts:
2587 - method java.net.URL openConnection
2588 credentials:
2589 - type: username_password
2590 scope: global
2591 id: test
2592 desc: Testing credentials
2593 username: test
2594 password: test
2595
Vladimir Ereminccf28842017-04-10 23:52:10 +03002596Netconsole Remote Kernel Logging
2597--------------------------------
2598
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002599Netconsole logger can be configured for the configfs-enabled kernels
2600(``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
2601applies both in runtime (if network is already configured),
2602and on-boot after an interface initialization.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002603
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002604.. note::
2605
2606 * Receiver can be located only on the same L3 domain
2607 (or you need to configure gateway MAC manually).
2608 * The Receiver MAC is detected only on configuration time.
2609 * Using broadcast MAC is not recommended.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002610
2611.. code-block:: yaml
2612
2613 parameters:
2614 linux:
2615 system:
2616 netconsole:
2617 enabled: true
2618 port: 514 (optional)
2619 loglevel: debug (optional)
2620 target:
2621 192.168.0.1:
2622 interface: bond0
2623 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02002624
Dzmitry Stremkouskid1a268b2018-10-03 16:36:04 +02002625Check network params on the environment
2626---------------------------------------
2627
2628Grab nics and nics states
2629
2630.. code-block:: bash
2631
2632 salt osd001\* net_checks.get_nics
2633
2634**Example of system output:**
2635
2636.. code-block:: bash
2637
2638 osd001.domain.com:
2639 |_
2640 - bond0
2641 - None
2642 - 1e:c8:64:42:23:b9
2643 - 0
2644 - 1500
2645 |_
2646 - bond1
2647 - None
2648 - 3c:fd:fe:27:3b:00
2649 - 1
2650 - 9100
2651 |_
2652 - fourty1
2653 - None
2654 - 3c:fd:fe:27:3b:00
2655 - 1
2656 - 9100
2657 |_
2658 - fourty2
2659 - None
2660 - 3c:fd:fe:27:3b:02
2661 - 1
2662 - 9100
2663
2664Grab 10G nics PCI addresses for hugepages setup
2665
2666.. code-block:: bash
2667
2668 salt cmp001\* net_checks.get_ten_pci
2669
2670**Example of system output:**
2671
2672.. code-block:: bash
2673
2674 cmp001.domain.com:
2675 |_
2676 - ten1
2677 - 0000:19:00.0
2678 |_
2679 - ten2
2680 - 0000:19:00.1
2681 |_
2682 - ten3
2683 - 0000:19:00.2
2684 |_
2685 - ten4
2686 - 0000:19:00.3
2687
2688Grab ip address for an interface
2689
2690.. code-block:: bash
2691
2692 salt cmp001\* net_checks.get_ip iface=one4
2693
2694**Example of system output:**
2695
2696.. code-block:: bash
2697
2698 cmp001.domain.com:
2699 10.200.177.101
2700
2701Grab ip addresses map
2702
2703.. code-block:: bash
2704
2705 salt-call net_checks.nodes_addresses
2706
2707**Example of system output:**
2708
2709.. code-block:: bash
2710
2711 local:
2712 |_
2713 - cid01.domain.com
2714 |_
2715 |_
2716 - pxe
2717 - 10.200.177.91
2718 |_
2719 - control
2720 - 10.200.178.91
2721 |_
2722 - cmn02.domain.com
2723 |_
2724 |_
2725 - storage_access
2726 - 10.200.181.67
2727 |_
2728 - pxe
2729 - 10.200.177.67
2730 |_
2731 - control
2732 - 10.200.178.67
2733 |_
2734 - cmp010.domain.com
2735 |_
2736 |_
2737 - pxe
2738 - 10.200.177.110
2739 |_
2740 - storage_access
2741 - 10.200.181.110
2742 |_
2743 - control
2744 - 10.200.178.110
2745 |_
2746 - vxlan
2747 - 10.200.179.110
2748
2749Verify full mesh connectivity
2750
2751.. code-block:: bash
2752
2753 salt-call net_checks.ping_check
2754
2755**Example of positive system output:**
2756
2757.. code-block:: bash
2758
2759 ['PASSED']
2760 [INFO ] ['PASSED']
2761 local:
2762 True
2763
2764**Example of system output in case of failure:**
2765
2766.. code-block:: bash
2767
2768 FAILED
2769 [ERROR ] FAILED
2770 ['control: 10.0.1.92 -> 10.0.1.224: Failed']
2771 ['control: 10.0.1.93 -> 10.0.1.224: Failed']
2772 ['control: 10.0.1.51 -> 10.0.1.224: Failed']
2773 ['control: 10.0.1.102 -> 10.0.1.224: Failed']
2774 ['control: 10.0.1.13 -> 10.0.1.224: Failed']
2775 ['control: 10.0.1.81 -> 10.0.1.224: Failed']
2776 local:
2777 False
2778
2779For this feature to work, please mark addresses with some role.
2780Otherwise 'default' role is assumed and mesh would consist of all
2781addresses on the environment.
2782
2783Mesh mark is needed only for interfaces which are enabled and have
2784ip address assigned.
2785
2786Checking dhcp pxe network meaningless, as it is used for salt
2787master vs minion communications, therefore treated as checked.
2788
2789.. code-block:: yaml
2790
2791 parameters:
2792 linux:
2793 network:
2794 interface:
2795 ens3:
2796 enabled: true
2797 type: eth
2798 proto: static
2799 address: ${_param:deploy_address}
2800 netmask: ${_param:deploy_network_netmask}
2801 gateway: ${_param:deploy_network_gateway}
2802 mesh: pxe
2803
2804Check pillars for ip address duplicates
2805
2806.. code-block:: bash
2807
2808 salt-call net_checks.verify_addresses
2809
2810**Example of positive system output:**
2811
2812.. code-block:: bash
2813
2814 ['PASSED']
2815 [INFO ] ['PASSED']
2816 local:
2817 True
2818
2819**Example of system output in case of failure:**
2820
2821.. code-block:: bash
2822
2823 FAILED. Duplicates found
2824 [ERROR ] FAILED. Duplicates found
2825 ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2826 [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2827 local:
2828 False
2829
2830Generate csv report for the env
2831
2832.. code-block:: bash
2833
2834 salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
2835 | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
2836 | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
2837
2838**Example of system output:**
2839
2840.. code-block:: bash
2841
2842 server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
2843 cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
2844 cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
2845 cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
2846 cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
2847 cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
2848 cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
2849 cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
2850 cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
2851 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
2852 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
2853 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
2854 cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
2855 cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
2856 cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
2857 ...
2858
Filip Pytlounf5383a42015-10-06 16:28:32 +02002859Usage
2860=====
2861
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002862Set MTU of the eth0 network interface to 1400:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002863
2864.. code-block:: bash
2865
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002866 ip link set dev eth0 mtu 1400
Filip Pytlounf5383a42015-10-06 16:28:32 +02002867
Denis Egorenko2e6ad0f2019-10-02 14:57:10 +04002868Switch Kernel from non-HWE to HWE
2869==================================
2870
2871It is possible to switch Kernel from non-HWE to HWE by using module
2872linux_kernel_switch. It has few methods:
2873
2874* check_hwe_kernel
2875* switch_kernel
2876* rollback_switch_kernel
2877
2878Method ``check_hwe_kernel`` allows to check whether HWE kernel installed
2879or not:
2880
2881.. code-block:: bash
2882
2883 salt <target> linux_kernel_switch.check_hwe_kernel
2884
2885Output for case HWE is installed:
2886
2887.. code-bloc:: bash
2888
2889 kvm02.cluster-env.local:
2890 ----------
2891 linux-image-extra-virtual-hwe-16.04:
2892 ----------
2893 linux-image-extra-virtual-hwe-16.04:
2894 ----------
2895 architecture:
2896 amd64
2897 description:
2898 Extra drivers for Virtual Linux kernel image
2899 This package will always depend on linux-image-generic.
2900 group:
2901 kernel
2902 install_date:
2903 2019-10-01T11:50:15Z
2904 name:
2905 linux-image-extra-virtual-hwe-16.04
2906 packager:
2907 Ubuntu Kernel Team <kernel-team@lists.ubuntu.com>
2908 source:
2909 linux-meta-hwe
2910 version:
2911 4.15.0.54.75
2912 ...
2913
2914Output for case HWE is not installed:
2915
2916.. code-bloc:: bash
2917
2918 kvm02.cluster-env.local:
2919 ----------
2920 linux-image-extra-virtual-hwe-16.04:
2921 Not installed!
2922 linux-image-generic-hwe-16.04:
2923 Not installed!
2924
2925Method ``switch_kernel`` allows you to switch from non-HWE to HWE. It has
2926two options: ``dry_run`` - to check what packages are going to be installed or
2927removed and ``only_kernel`` - install only Kernel image packages without other
2928HWE packages.
2929
2930Method ``rollback_switch_kernel`` allows you to rollback method
2931``switch_kernel`` which was executed successfully previously. Option
2932``dry_run`` - to check what packages are going to be installed/removed.
2933
Filip Pytlounf5383a42015-10-06 16:28:32 +02002934Read more
2935=========
2936
2937* https://www.archlinux.org/
2938* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu