blob: 4994fa76ad6e5cefd1d7b471cb93b5b02a90db39 [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
Denis Egorenkoe29a04f2019-12-05 15:46:06 +04001221Also it is possible to specify list of repos, which should be secured
1222within ``common_repo_secured`` block and without changing current
1223existing repo source parameter:
1224
1225.. code-block:: yaml
1226
1227 linux:
1228 system:
1229 ...
1230 common_repo_secured:
1231 user: foo
1232 password: bar
1233 secured_repos: [ 'test1', 'test2' ]
1234 repo:
1235 test1:
1236 ...
1237 test2:
1238 ...
1239 test3:
1240 ...
1241
1242Repos ``test1, test2`` will be secured. In case if you want secure all
1243available repos use ``secured_repos: [ 'all' ]``. But repo parameters have
1244precedence over parameters from ``common_repo_secured``. In next case:
1245
1246 linux:
1247 system:
1248 ...
1249 common_repo_secured:
1250 user: foo
1251 password: bar
1252 secured_repos: [ 'all' ]
1253 repo:
1254 test1:
1255 ...
1256 test2:
1257 ...
1258 test3:
1259 secure: False
1260 ...
1261
1262Repo ``test3`` will not be secured.
1263
Jiri Broulik34a29b42017-04-25 14:42:54 +02001264Remove all repositories:
1265
1266.. code-block:: yaml
1267
1268 linux:
1269 system:
1270 purge_repos: true
1271
azvyagintsevff089d22018-07-27 16:52:34 +02001272Refresh repositories metada, after configuration:
1273
1274.. code-block:: yaml
1275
1276 linux:
1277 system:
1278 refresh_repos_meta: true
1279
Filip Pytlounc512e6c2017-11-22 14:28:10 +01001280Setup custom apt config options:
1281
1282.. code-block:: yaml
1283
1284 linux:
1285 system:
1286 apt:
1287 config:
1288 compression-workaround:
1289 "Acquire::CompressionTypes::Order": "gz"
1290 docker-clean:
1291 "DPkg::Post-Invoke":
1292 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
1293 "APT::Update::Post-Invoke":
1294 - "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 +02001295
Petr Michalec10462bb2017-03-23 19:18:08 +01001296RC
1297~~
1298
Jakub Pavlik78859382016-01-21 11:26:39 +01001299rc.local example
1300
1301.. code-block:: yaml
1302
1303 linux:
1304 system:
1305 rc:
1306 local: |
1307 #!/bin/sh -e
1308 #
1309 # rc.local
1310 #
1311 # This script is executed at the end of each multiuser runlevel.
1312 # Make sure that the script will "exit 0" on success or any other
1313 # value on error.
1314 #
1315 # In order to enable or disable this script just change the execution
1316 # bits.
1317 #
1318 # By default this script does nothing.
1319 exit 0
1320
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001321Prompt
1322~~~~~~
1323
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001324Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``.
1325Every user can have different prompt:
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001326
1327.. code-block:: yaml
1328
1329 linux:
1330 system:
1331 prompt:
1332 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\\]
1333 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
1334
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001335On Debian systems, to set prompt system-wide, it's necessary to
1336remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``,
1337which comes from ``/etc/skel/.bashrc``. This formula will do
1338this automatically, but will not touch existing user's
1339``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +01001340
Filip Pytlouneef11c12016-03-25 11:00:23 +01001341Bash
1342~~~~
1343
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001344Fix bash configuration to preserve history across sessions
1345like ZSH does by default:
Filip Pytlouneef11c12016-03-25 11:00:23 +01001346
1347.. code-block:: yaml
1348
1349 linux:
1350 system:
1351 bash:
1352 preserve_history: true
1353
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001354Login banner message
1355~~~~~~~~~~~~~~~~~~~~
1356
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001357``/etc/issue`` is a text file which contains a message or system
1358identification to be printed before the login prompt. It may contain
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001359various @char and \char sequences, if supported by the getty-type
1360program employed on the system.
1361
1362Setting logon banner message is easy:
1363
1364.. code-block:: yaml
1365
1366 liunx:
1367 system:
1368 banner:
1369 enabled: true
1370 contents: |
1371 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1372
1373 You must have explicit, authorized permission to access or configure this
1374 device. Unauthorized attempts and actions to access or use this system may
1375 result in civil and/or criminal penalties.
1376 All activities performed on this system are logged and monitored.
1377
Filip Pytloune874dfb2016-01-22 16:57:34 +01001378Message of the day
1379~~~~~~~~~~~~~~~~~~
1380
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001381``pam_motd`` from package ``libpam-modules`` is used for dynamic
1382messages of the day. Setting custom ``motd`` will clean up existing ones.
Filip Pytloune874dfb2016-01-22 16:57:34 +01001383
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001384Setting static ``motd`` will replace existing ``/etc/motd`` and remove
1385scripts from ``/etc/update-motd.d``.
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001386
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001387Setting static ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001388
1389.. code-block:: yaml
1390
1391 linux:
1392 system:
1393 motd: |
1394 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1395
1396 You must have explicit, authorized permission to access or configure this
1397 device. Unauthorized attempts and actions to access or use this system may
1398 result in civil and/or criminal penalties.
1399 All activities performed on this system are logged and monitored.
1400
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001401Setting dynamic ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001402
Filip Pytloune874dfb2016-01-22 16:57:34 +01001403.. code-block:: yaml
1404
1405 linux:
1406 system:
1407 motd:
1408 - release: |
1409 #!/bin/sh
1410 [ -r /etc/lsb-release ] && . /etc/lsb-release
1411
1412 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
1413 # Fall back to using the very slow lsb_release utility
1414 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
1415 fi
1416
1417 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
1418 - warning: |
1419 #!/bin/sh
1420 printf "This is [company name] network.\n"
1421 printf "Unauthorized access strictly prohibited.\n"
1422
Marek Celoud713e9072017-05-18 15:20:25 +02001423Services
1424~~~~~~~~
1425
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001426Stop and disable the ``linux`` service:
Marek Celoud713e9072017-05-18 15:20:25 +02001427
1428.. code-block:: yaml
1429
1430 linux:
1431 system:
1432 service:
1433 apt-daily.timer:
1434 status: dead
1435
Dzmitry Stremkouski70d09782018-11-30 16:04:59 +01001436Override systemd service unit:
1437
1438.. code-block:: yaml
1439
1440 parameters:
1441
1442 linux:
1443 system:
1444 service:
1445 tgt:
1446 name: tgt
1447 status: running
1448 enabled: True
1449 override:
1450 50:
1451 target: tgt.service.d
1452 name: bind
1453 content: |
1454 [Service]
1455 ExecStart=
1456 ExecStart=/usr/sbin/tgtd -f --iscsi portal=${_param:single_address}:3260
1457
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001458Possible statuses are ``dead`` (disable service by default), ``running``
1459(enable service by default), ``enabled``, ``disabled``:
Marek Celoud713e9072017-05-18 15:20:25 +02001460
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001461Linux with the ``atop`` service:
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +03001462
1463.. code-block:: yaml
1464
1465 linux:
1466 system:
1467 atop:
1468 enabled: true
1469 interval: 20
1470 logpath: "/var/log/atop"
1471 outfile: "/var/log/atop/daily.log"
1472
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001473Linux with the ``mcelog`` service:
Oleksii Chupryn144432b2018-05-22 10:34:48 +03001474
1475.. code-block:: yaml
1476
1477 linux:
1478 system:
1479 mcelog:
1480 enabled: true
1481 logging:
1482 syslog: true
1483 syslog_error: true
1484
Denis Egorenko394ae072019-11-22 17:26:30 +04001485Linux Sosreport
1486^^^^^^^^^^^^^^^
1487
1488Sosreport is an extensible, portable, support data collection tool
1489primarily aimed at Linux distributions and other UNIX-like operating systems,
1490which allows to create diagnostic snapshot of system.
1491
1492Works out of box and additional pillars are not needed by default:
1493
1494.. code-block:: bash
1495
1496 salt-call state.sls linux.system.sosreport.report
1497
1498or from Salt Master:
1499
1500.. code-block:: bash
1501
1502 salt -C '<target>' state.sls linux.system.sosreport.report
1503
1504Sosreport configuration may be extended with next pillar data:
1505
1506.. code-block:: yaml
1507
1508 linux:
1509 system:
1510 sosreport:
1511 cmd_options:
1512 tmp-dir: /root/reportdir
1513 no_arg_opts: [ '-q' ]
1514 config_options:
1515 general:
1516 all-logs: true
1517 plugins:
1518 disabled: [ docker ]
1519 tunables:
1520 apache.log: true
1521
1522Where is ``cmd_options`` additional provided arguments for cli cmd call,
1523``general`` desribes parameters for sos.conf ``general`` section,
1524``plugins`` desribes which plugins should be ``enabled`` or ``disabled``
1525and ``tunables`` has custom plugin options which can be additionally set.
1526
1527Also it is possible to pass cmd_options through pillar override:
1528
1529.. code-block:: bash
1530
1531 salt -C '<target>' state.sls linux.system.sosreport.report pillar='{ "sosreport" : { "ticket-number": 12345, "tmp-dir": "/root/reportdir2" } }'
1532
1533Run ``sosreport --help`` to get full list of possible options.
1534
1535Once state ``linux.system.sosreport.report`` is executed on targets, it is
1536possible to collect all reports by using next command on Salt Master:
1537
1538.. code-block:: bash
1539
1540 salt -C 'I@salt:master' state.sls linux.system.sosreport.collect pillar='{ "sosreport_collect" : { "target": "<target>", "archiveName": "sosreport_<env_name>_<customer>_<ticket>" } }'
1541
1542This will generate one common archive for all ``<target>`` nodes with name
1543``sosreport_<env_name>_<customer>_<ticket>.tar.gz``. It is required to specify
1544target nodes through model (``linux.system.sosreport.collect``) or pillar
1545override. Also possible options are: ``nodeIp`` which allows you to use IP from another
1546interface on node (should be available from minions), ``port`` for NetCat if
1547you see that default port is busy, ``archiveName`` for your archive and
1548``reportWorkDir`` directory to keeping all reports for current case.
1549
Filip Pytloun2f70b492016-02-19 15:55:25 +01001550RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +01001551^^^^^^^^^^^^^
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001552Currently, ``update-motd`` is not available
1553for RHEL. So there is no native support for dynamic ``motd``.
1554You can still set a static one, with a different pillar structure:
Filip Pytloun2f70b492016-02-19 15:55:25 +01001555
1556.. code-block:: yaml
1557
1558 linux:
1559 system:
1560 motd: |
1561 This is [company name] network.
1562 Unauthorized access strictly prohibited.
1563
Filip Pytloun8296bb92016-02-19 18:42:09 +01001564Haveged
1565~~~~~~~
1566
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001567If you are running headless server and are low on entropy,
1568you may set up Haveged:
Filip Pytloun8296bb92016-02-19 18:42:09 +01001569
1570.. code-block:: yaml
1571
1572 linux:
1573 system:
1574 haveged:
1575 enabled: true
1576
Filip Pytlounf5383a42015-10-06 16:28:32 +02001577Linux network
1578-------------
1579
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001580Linux with network manager:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001581
1582.. code-block:: yaml
1583
1584 linux:
1585 network:
1586 enabled: true
1587 network_manager: true
1588
Dzmitry Stremkouski00cdbe62018-10-31 16:41:54 +01001589Execute linux.network.interface state without ifupdown activity:
1590
1591.. code-block:: bash
1592
1593 salt-call linux.network.interface pillar='{"linux":{"network":{"noifupdown":True}}}'
1594
1595
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001596Linux with default static network interfaces, default gateway
1597interface and DNS servers:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001598
1599.. code-block:: yaml
1600
1601 linux:
1602 network:
1603 enabled: true
1604 interface:
1605 eth0:
1606 enabled: true
1607 type: eth
1608 address: 192.168.0.102
1609 netmask: 255.255.255.0
1610 gateway: 192.168.0.1
1611 name_servers:
1612 - 8.8.8.8
1613 - 8.8.4.4
1614 mtu: 1500
1615
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001616Linux with bonded interfaces and disabled ``NetworkManager``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001617
1618.. code-block:: yaml
1619
1620 linux:
1621 network:
1622 enabled: true
1623 interface:
1624 eth0:
1625 type: eth
1626 ...
1627 eth1:
1628 type: eth
1629 ...
1630 bond0:
1631 enabled: true
1632 type: bond
1633 address: 192.168.0.102
1634 netmask: 255.255.255.0
1635 mtu: 1500
1636 use_in:
1637 - interface: ${linux:interface:eth0}
1638 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +01001639 network_manager:
1640 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001641
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001642Linux with VLAN ``interface_params``:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001643
1644.. code-block:: yaml
1645
1646 linux:
1647 network:
1648 enabled: true
1649 interface:
1650 vlan69:
1651 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001652 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001653 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001654
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001655Linux with wireless interface parameters:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001656
1657.. code-block:: yaml
1658
1659 linux:
1660 network:
1661 enabled: true
1662 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001663 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001664 interface:
1665 wlan0:
1666 type: eth
1667 wireless:
1668 essid: example
1669 key: example_key
1670 security: wpa
1671 priority: 1
1672
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001673Linux networks with routes defined:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001674
1675.. code-block:: yaml
1676
1677 linux:
1678 network:
1679 enabled: true
1680 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001681 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001682 interface:
1683 eth0:
1684 type: eth
1685 route:
1686 default:
1687 address: 192.168.0.123
1688 netmask: 255.255.255.0
1689 gateway: 192.168.0.1
1690
ivce5011da2019-01-23 07:56:53 +03001691Linux networks with implicit routes definition:
1692
1693- on node 1:
1694
1695.. code-block:: yaml
1696
1697 linux:
1698 network:
1699 enabled: true
1700 router:
1701 ctl:
1702 # router that connects 10.0.1.0/24 and 10.0.2.0/24
1703 addresses:
1704 - 10.0.1.1/24
1705 - 10.0.2.1/24
1706 test:
1707 addresses:
1708 - 10.0.1.2/24
1709 networks:
1710 - 10.100.0.0/16
1711 interface:
1712 ctl:
1713 name: eth0
1714 address: 10.0.1.101
1715 netmask: 255.255.255.0
1716
1717- on node2:
1718
1719.. code-block:: yaml
1720
1721 linux:
1722 network:
1723 enabled: true
1724 router:
1725 ctl:
1726 # equivalent of node1's ctl router with 'implicit_routes = false'
1727 options:
1728 implicit_routes: false
1729 addresses:
1730 - 10.0.1.1/24
1731 - 10.0.2.1/24
1732 networks:
1733 - 10.0.1.0/24
1734 - 10.0.2.0/24
1735 interface:
1736 ctl:
1737 name: eth0
1738 address: 10.0.2.101
1739 netmask: 255.255.255.0
1740
1741
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001742Native Linux Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001743
1744.. code-block:: yaml
1745
1746 linux:
1747 network:
1748 interface:
1749 eth1:
1750 enabled: true
1751 type: eth
1752 proto: manual
1753 up_cmds:
1754 - ip address add 0/0 dev $IFACE
1755 - ip link set $IFACE up
1756 down_cmds:
1757 - ip link set $IFACE down
1758 br-ex:
1759 enabled: true
1760 type: bridge
1761 address: ${linux:network:host:public_local:address}
1762 netmask: 255.255.255.0
1763 use_interfaces:
1764 - eth1
1765
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001766Open vSwitch Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001767
1768.. code-block:: yaml
1769
1770 linux:
1771 network:
1772 bridge: openvswitch
1773 interface:
1774 eth1:
1775 enabled: true
1776 type: eth
1777 proto: manual
1778 up_cmds:
1779 - ip address add 0/0 dev $IFACE
1780 - ip link set $IFACE up
1781 down_cmds:
1782 - ip link set $IFACE down
1783 br-ex:
1784 enabled: true
1785 type: bridge
1786 address: ${linux:network:host:public_local:address}
1787 netmask: 255.255.255.0
1788 use_interfaces:
1789 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001790 br-prv:
1791 enabled: true
1792 type: ovs_bridge
1793 mtu: 65000
1794 br-ens7:
1795 enabled: true
1796 name: br-ens7
1797 type: ovs_bridge
1798 proto: manual
1799 mtu: 9000
1800 use_interfaces:
1801 - ens7
1802 patch-br-ens7-br-prv:
1803 enabled: true
1804 name: ens7-prv
1805 ovs_type: ovs_port
1806 type: ovs_port
1807 bridge: br-ens7
1808 port_type: patch
1809 peer: prv-ens7
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001810 tag: 109 # [] to unset a tag
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001811 mtu: 65000
1812 patch-br-prv-br-ens7:
1813 enabled: true
1814 name: prv-ens7
1815 bridge: br-prv
1816 ovs_type: ovs_port
1817 type: ovs_port
1818 port_type: patch
1819 peer: ens7-prv
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001820 tag: 109
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001821 mtu: 65000
1822 ens7:
1823 enabled: true
1824 name: ens7
1825 proto: manual
1826 ovs_port_type: OVSPort
1827 type: ovs_port
1828 ovs_bridge: br-ens7
1829 bridge: br-ens7
Oleg Gelbukh36f01072019-07-01 15:26:16 -07001830 ens6:
1831 enabled: true
1832 proto: manual
1833 type: eth
1834 ovs_bridge: br-ctl
1835 br-ctl:
1836 enabled: true
1837 type: ovs_bridge
1838 internal-br-ctl-port:
1839 enabled: true
1840 proto: static
1841 address: 172.172.0.10
1842 netmask: 255.255.0.0
1843 name_servers:
1844 - 8.8.8.8
1845 - 172.172.172.172
1846 name: port-br-ctl
1847 bridge: br-ctl
1848 ovs_type: ovs_port
1849 type: ovs_port
1850 port_type: internal
1851 mtu: 65000
Filip Pytlounf5383a42015-10-06 16:28:32 +02001852
Petr Jediný8f8ae542017-07-13 16:19:12 +02001853Debian manual proto interfaces
1854
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001855When you are changing interface proto from static in up state
1856to manual, you may need to flush ip addresses. For example,
1857if you want to use the interface and the ip on the bridge.
1858This can be done by setting the ``ipflush_onchange`` to true.
Petr Jediný8f8ae542017-07-13 16:19:12 +02001859
1860.. code-block:: yaml
1861
1862 linux:
1863 network:
1864 interface:
1865 eth1:
1866 enabled: true
1867 type: eth
1868 proto: manual
1869 mtu: 9100
1870 ipflush_onchange: true
1871
Jiri Broulik1a191e32018-01-15 15:54:21 +01001872Debian static proto interfaces
1873
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001874When you are changing interface proto from dhcp in up state to
1875static, you may need to flush ip addresses and restart interface
1876to assign ip address from a managed file. For example, if you wantto
1877use the interface and the ip on the bridge. This can be done by
1878setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
1879param set to true.
Jiri Broulik1a191e32018-01-15 15:54:21 +01001880
1881.. code-block:: yaml
1882
1883 linux:
1884 network:
1885 interface:
1886 eth1:
1887 enabled: true
1888 type: eth
1889 proto: static
1890 address: 10.1.0.22
1891 netmask: 255.255.255.0
1892 ipflush_onchange: true
1893 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001894
Petr Jedinýd577cb52017-06-28 20:17:49 +02001895Concatinating and removing interface files
1896
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001897Debian based distributions have ``/etc/network/interfaces.d/``
1898directory, where you can store configuration of network
1899interfaces in separate files. You can concatinate the files
1900to the defined destination when needed, this operation removes
1901the file from the ``/etc/network/interfaces.d/``. If you just need
1902to remove iface files, you can use the ``remove_iface_files`` key.
Petr Jedinýd577cb52017-06-28 20:17:49 +02001903
1904.. code-block:: yaml
1905
1906 linux:
1907 network:
1908 concat_iface_files:
1909 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1910 dst: '/etc/network/interfaces'
1911 remove_iface_files:
1912 - '/etc/network/interfaces.d/90-custom.cfg'
1913
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001914Configure DHCP client
Petr Jedinýd577cb52017-06-28 20:17:49 +02001915
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001916None of the keys is mandatory, include only those you really need.
1917For full list of available options under send, supersede, prepend,
1918append refer to dhcp-options(5).
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001919
1920.. code-block:: yaml
1921
1922 linux:
1923 network:
1924 dhclient:
1925 enabled: true
1926 backoff_cutoff: 15
1927 initial_interval: 10
1928 reboot: 10
1929 retry: 60
1930 select_timeout: 0
1931 timeout: 120
1932 send:
1933 - option: host-name
1934 declaration: "= gethostname()"
1935 supersede:
1936 - option: host-name
1937 declaration: "spaceship"
1938 - option: domain-name
1939 declaration: "domain.home"
1940 #- option: arp-cache-timeout
1941 # declaration: 20
1942 prepend:
1943 - option: domain-name-servers
1944 declaration:
1945 - 8.8.8.8
1946 - 8.8.4.4
1947 - option: domain-search
1948 declaration:
1949 - example.com
1950 - eng.example.com
1951 #append:
1952 #- option: domain-name-servers
1953 # declaration: 127.0.0.1
1954 # ip or subnet to reject dhcp offer from
1955 reject:
1956 - 192.33.137.209
1957 - 10.0.2.0/24
1958 request:
1959 - subnet-mask
1960 - broadcast-address
1961 - time-offset
1962 - routers
1963 - domain-name
1964 - domain-name-servers
1965 - domain-search
1966 - host-name
1967 - dhcp6.name-servers
1968 - dhcp6.domain-search
1969 - dhcp6.fqdn
1970 - dhcp6.sntp-servers
1971 - netbios-name-servers
1972 - netbios-scope
1973 - interface-mtu
1974 - rfc3442-classless-static-routes
1975 - ntp-servers
1976 require:
1977 - subnet-mask
1978 - domain-name-servers
1979 # if per interface configuration required add below
1980 interface:
1981 ens2:
1982 initial_interval: 11
1983 reject:
1984 - 192.33.137.210
1985 ens3:
1986 initial_interval: 12
1987 reject:
1988 - 192.33.137.211
1989
Petr Michaleceb14b552017-06-01 10:27:05 +02001990Linux network systemd settings:
1991
1992.. code-block:: yaml
1993
1994 linux:
1995 network:
1996 ...
1997 systemd:
1998 link:
1999 10-iface-dmz:
2000 Match:
2001 MACAddress: c8:5b:67:fa:1a:af
2002 OriginalName: eth0
2003 Link:
2004 Name: dmz0
2005 netdev:
2006 20-bridge-dmz:
2007 match:
2008 name: dmz0
2009 network:
2010 mescription: bridge
2011 bridge: br-dmz0
2012 network:
2013 # works with lowercase, keys are by default capitalized
2014 40-dhcp:
2015 match:
2016 name: '*'
2017 network:
2018 DHCP: yes
2019
Petr Michalec10462bb2017-03-23 19:18:08 +01002020Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01002021
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002022Use ``/etc/environment`` for static system wide variable assignment
2023after boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002024
2025.. code-block:: yaml
2026
2027 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01002028 system:
2029 env:
2030 BOB_VARIABLE: Alice
2031 ...
2032 BOB_PATH:
2033 - /srv/alice/bin
2034 - /srv/bob/bin
2035 ...
2036 ftp_proxy: none
2037 http_proxy: http://global-http-proxy.host.local:8080
2038 https_proxy: ${linux:system:proxy:https}
2039 no_proxy:
2040 - 192.168.0.80
2041 - 192.168.1.80
2042 - .domain.com
2043 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02002044 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01002045 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002046 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01002047 ftp: ftp://proxy.host.local:2121
2048 http: http://proxy.host.local:3142
2049 https: https://proxy.host.local:3143
2050 noproxy:
2051 - .domain.com
2052 - .local
2053
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002054Configure the ``profile.d`` scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01002055
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002056The ``profile.d`` scripts are being sourced during ``.sh`` execution
2057and support variable expansion in opposite to /etc/environment global
2058settings in ``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01002059
2060.. code-block:: yaml
2061
2062 linux:
2063 system:
2064 profile:
2065 locales: |
2066 export LANG=C
2067 export LC_ALL=C
2068 ...
2069 vi_flavors.sh: |
2070 export PAGER=view
2071 export EDITOR=vim
2072 alias vi=vim
2073 shell_locales.sh: |
2074 export LANG=en_US
2075 export LC_ALL=en_US.UTF-8
2076 shell_proxies.sh: |
2077 export FTP_PROXY=ftp://127.0.3.3:2121
2078 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02002079
Dmitry Teselkina0d31d12018-09-04 14:43:09 +03002080
2081Configure login.defs parameters
2082-------------------------------
2083
2084.. code-block:: yaml
2085
2086 linux:
2087 system:
2088 login_defs:
2089 <opt_name>:
2090 enabled: true
2091 value: <opt_value>
2092
2093<opt_name> is a configurational option defined in 'man login.defs'.
2094<opt_name> is case sensitive, should be UPPERCASE only!
2095
2096
Filip Pytlounf5383a42015-10-06 16:28:32 +02002097Linux with hosts
2098
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002099Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
2100removing entries that are not defined in model except defaults
2101for both IPv4 and IPv6 localhost and hostname as well as FQDN.
Ales Komarek417e8c52017-08-25 15:10:29 +02002102
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002103We recommend using this option to verify that ``/etc/hosts``
2104is always in a clean state. However it is not enabled by default
2105for security reasons.
Filip Pytloun86506fe2017-01-26 14:36:16 +01002106
Filip Pytlounf5383a42015-10-06 16:28:32 +02002107.. code-block:: yaml
2108
2109 linux:
2110 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002111 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002112 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002113 # No need to define this one if purge_hosts is true
2114 hostname:
2115 address: 127.0.1.1
2116 names:
2117 - ${linux:network:fqdn}
2118 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02002119 node1:
2120 address: 192.168.10.200
2121 names:
2122 - node2.domain.com
2123 - service2.domain.com
2124 node2:
2125 address: 192.168.10.201
2126 names:
2127 - node2.domain.com
2128 - service2.domain.com
2129
Ales Komarek417e8c52017-08-25 15:10:29 +02002130Linux with hosts collected from mine
2131
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002132All DNS records defined within infrastrucuture
2133are passed to the local hosts records or any DNS server. Only
2134hosts with the ``grain`` parameter set to ``true`` will be propagated
2135to the mine.
Ales Komarek417e8c52017-08-25 15:10:29 +02002136
2137.. code-block:: yaml
2138
2139 linux:
2140 network:
2141 purge_hosts: true
2142 mine_dns_records: true
2143 host:
2144 node1:
2145 address: 192.168.10.200
2146 grain: true
2147 names:
2148 - node2.domain.com
2149 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01002150
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002151Set up ``resolvconf's basic resolver info``, e.g. nameservers, search/domain and options:
Filip Pytlounde9bea52016-01-11 15:39:10 +01002152
2153.. code-block:: yaml
2154
2155 linux:
2156 network:
2157 resolv:
2158 dns:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002159 - 8.8.4.4
2160 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01002161 domain: my.example.com
2162 search:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002163 - my.example.com
2164 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01002165 options:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002166 - ndots:5
2167 - timeout:2
2168 - attempts:2
Filip Pytlounde9bea52016-01-11 15:39:10 +01002169
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002170Set up custom TX queue length for tap interfaces:
Andrii Petrenko735761d2017-03-21 17:17:35 -07002171
2172.. code-block:: yaml
2173
2174 linux:
2175 network:
Dzmitry Stremkouskif76e8092020-09-14 17:41:49 +02002176 custom_txqueuelen
2177 tap:
2178 queue_length: 10000
2179 enabled: true
2180 device_filter: 'tap[0-9a-z\-]*'
2181 ten:
2182 enabled: false
2183 veth:
2184 queue_length: 20000
Andrii Petrenko735761d2017-03-21 17:17:35 -07002185
Michael Polenchukc37bd4a2019-04-22 15:20:03 +04002186Auto repair/re-attach libvirt's vnet interfaces:
2187
2188.. code-block:: yaml
2189
2190 linux:
2191 network:
2192 libvirt_vnet_repair: true
2193
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002194DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002195
2196**DPDK OVS NIC**
2197
2198.. code-block:: yaml
2199
2200 linux:
2201 network:
2202 bridge: openvswitch
2203 dpdk:
2204 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002205 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002206 openvswitch:
2207 pmd_cpu_mask: "0x6"
2208 dpdk_socket_mem: "1024,1024"
2209 dpdk_lcore_mask: "0x400"
2210 memory_channels: 2
2211 interface:
2212 dpkd0:
2213 name: ${_param:dpdk_nic}
2214 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002215 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002216 enabled: true
2217 type: dpdk_ovs_port
2218 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002219 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002220 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01002221 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002222 br-prv:
2223 enabled: true
2224 type: dpdk_ovs_bridge
2225
2226**DPDK OVS Bond**
2227
2228.. code-block:: yaml
2229
2230 linux:
2231 network:
2232 bridge: openvswitch
2233 dpdk:
2234 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002235 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002236 openvswitch:
2237 pmd_cpu_mask: "0x6"
2238 dpdk_socket_mem: "1024,1024"
2239 dpdk_lcore_mask: "0x400"
2240 memory_channels: 2
2241 interface:
2242 dpdk_second_nic:
2243 name: ${_param:primary_second_nic}
2244 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002245 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002246 bond: dpdkbond0
2247 enabled: true
2248 type: dpdk_ovs_port
2249 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002250 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002251 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002252 dpdk_first_nic:
2253 name: ${_param:primary_first_nic}
2254 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002255 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002256 bond: dpdkbond0
2257 enabled: true
2258 type: dpdk_ovs_port
2259 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002260 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002261 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002262 dpdkbond0:
2263 enabled: true
2264 bridge: br-prv
2265 type: dpdk_ovs_bond
2266 mode: active-backup
2267 br-prv:
2268 enabled: true
2269 type: dpdk_ovs_bridge
2270
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01002271**DPDK OVS LACP Bond with vlan tag**
2272
2273.. code-block:: yaml
2274
2275 linux:
2276 network:
2277 bridge: openvswitch
2278 dpdk:
2279 enabled: true
2280 driver: uio
2281 openvswitch:
2282 pmd_cpu_mask: "0x6"
2283 dpdk_socket_mem: "1024,1024"
2284 dpdk_lcore_mask: "0x400"
2285 memory_channels: "2"
2286 interface:
2287 eth3:
2288 enabled: true
2289 type: eth
2290 proto: manual
2291 name: ${_param:tenant_first_nic}
2292 eth4:
2293 enabled: true
2294 type: eth
2295 proto: manual
2296 name: ${_param:tenant_second_nic}
2297 dpdk0:
2298 name: ${_param:tenant_first_nic}
2299 pci: "0000:81:00.0"
2300 driver: igb_uio
2301 bond: bond1
2302 enabled: true
2303 type: dpdk_ovs_port
2304 n_rxq: 2
2305 dpdk1:
2306 name: ${_param:tenant_second_nic}
2307 pci: "0000:81:00.1"
2308 driver: igb_uio
2309 bond: bond1
2310 enabled: true
2311 type: dpdk_ovs_port
2312 n_rxq: 2
2313 bond1:
2314 enabled: true
2315 bridge: br-prv
2316 type: dpdk_ovs_bond
2317 mode: balance-slb
2318 br-prv:
2319 enabled: true
2320 type: dpdk_ovs_bridge
2321 tag: ${_param:tenant_vlan}
2322 address: ${_param:tenant_address}
2323 netmask: ${_param:tenant_network_netmask}
2324
Jakub Pavlikaa759062017-03-13 15:57:26 +01002325**DPDK OVS bridge for VXLAN**
2326
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002327If VXLAN is used as tenant segmentation, IP address must
2328be set on ``br-prv``.
Jakub Pavlikaa759062017-03-13 15:57:26 +01002329
2330.. code-block:: yaml
2331
2332 linux:
2333 network:
2334 ...
2335 interface:
2336 br-prv:
2337 enabled: true
2338 type: dpdk_ovs_bridge
2339 address: 192.168.50.0
2340 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04002341 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01002342 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002343
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02002344**DPDK OVS bridge with Linux network interface**
2345
2346.. code-block:: yaml
2347
2348 linux:
2349 network:
2350 ...
2351 interface:
2352 eth0:
2353 type: eth
2354 ovs_bridge: br-prv
2355 ...
2356 br-prv:
2357 enabled: true
2358 type: dpdk_ovs_bridge
2359 ...
2360
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002361Linux storage
2362-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02002363
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002364Linux with mounted Samba:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002365
2366.. code-block:: yaml
2367
2368 linux:
2369 storage:
2370 enabled: true
2371 mount:
2372 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01002373 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002374 - path: /media/myuser/public/
2375 - device: //192.168.0.1/storage
2376 - file_system: cifs
2377 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
2378
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002379NFS mount:
Jiri Broulikb017f932017-03-31 13:55:36 +02002380
2381.. code-block:: yaml
2382
2383 linux:
2384 storage:
2385 enabled: true
2386 mount:
2387 nfs_glance:
2388 enabled: true
2389 path: /var/lib/glance/images
2390 device: 172.16.10.110:/var/nfs/glance
2391 file_system: nfs
2392 opts: rw,sync
2393
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002394File swap configuration:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002395
2396.. code-block:: yaml
2397
2398 linux:
2399 storage:
2400 enabled: true
2401 swap:
2402 file:
2403 enabled: true
2404 engine: file
2405 device: /swapfile
2406 size: 1024
2407
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002408Partition swap configuration:
Lachlan Evenson30676512016-01-22 15:43:28 -08002409
2410.. code-block:: yaml
2411
2412 linux:
2413 storage:
2414 enabled: true
2415 swap:
2416 partition:
2417 enabled: true
2418 engine: partition
2419 device: /dev/vg0/swap
2420
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002421LVM group ``vg1`` with one device and ``data`` volume mounted
2422into ``/mnt/data``.
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002423
2424.. code-block:: yaml
2425
2426 parameters:
2427 linux:
2428 storage:
2429 mount:
2430 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01002431 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002432 device: /dev/vg1/data
2433 file_system: ext4
2434 path: /mnt/data
2435 lvm:
2436 vg1:
2437 enabled: true
2438 devices:
2439 - /dev/sdb
2440 volume:
2441 data:
2442 size: 40G
2443 mount: ${linux:storage:mount:data}
root3387f332019-01-11 08:55:32 +00002444 # When set they will take precedence over filters aget from volume groups.
2445 lvm_filters:
2446 10:
2447 enabled: True
2448 value: "a|loop|"
2449 20:
2450 enabled: True
2451 value: "r|/dev/hdc|"
2452 30:
2453 enabled: True
2454 value: "a|/dev/ide|"
2455 40:
2456 enabled: True
2457 value: "r|.*|"
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002458
Jakub Pavlik4f742142017-08-08 15:05:50 +02002459Create partitions on disk. Specify size in MB. It expects empty
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002460disk without any existing partitions.
2461Set ``startsector=1`` if you want to start partitions from ``2048``.
Jakub Pavlik4f742142017-08-08 15:05:50 +02002462
2463.. code-block:: yaml
2464
2465 linux:
2466 storage:
2467 disk:
2468 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01002469 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02002470 name: /dev/loop1
2471 type: gpt
2472 partitions:
2473 - size: 200 #size in MB
2474 type: fat32
2475 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02002476 mkfs: True
2477 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02002478 /dev/vda1:
2479 partitions:
2480 - size: 5
2481 type: ext2
2482 - size: 10
2483 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02002484
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002485Multipath with Fujitsu Eternus DXL:
Ales Komareka634f4b2016-10-02 13:11:04 +02002486
2487.. code-block:: yaml
2488
2489 parameters:
2490 linux:
2491 storage:
2492 multipath:
2493 enabled: true
2494 blacklist_devices:
2495 - /dev/sda
2496 - /dev/sdb
2497 backends:
2498 - fujitsu_eternus_dxl
2499
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002500Multipath with Hitachi VSP 1000:
Ales Komareka634f4b2016-10-02 13:11:04 +02002501
2502.. code-block:: yaml
2503
2504 parameters:
2505 linux:
2506 storage:
2507 multipath:
2508 enabled: true
2509 blacklist_devices:
2510 - /dev/sda
2511 - /dev/sdb
2512 backends:
2513 - hitachi_vsp1000
2514
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002515Multipath with IBM Storwize:
Ales Komareka634f4b2016-10-02 13:11:04 +02002516
2517.. code-block:: yaml
2518
2519 parameters:
2520 linux:
2521 storage:
2522 multipath:
2523 enabled: true
2524 blacklist_devices:
2525 - /dev/sda
2526 - /dev/sdb
2527 backends:
2528 - ibm_storwize
2529
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002530Multipath with multiple backends:
Ales Komareka634f4b2016-10-02 13:11:04 +02002531
2532.. code-block:: yaml
2533
2534 parameters:
2535 linux:
2536 storage:
2537 multipath:
2538 enabled: true
2539 blacklist_devices:
2540 - /dev/sda
2541 - /dev/sdb
2542 - /dev/sdc
2543 - /dev/sdd
2544 backends:
2545 - ibm_storwize
2546 - fujitsu_eternus_dxl
2547 - hitachi_vsp1000
2548
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002549PAM LDAP integration:
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002550
2551.. code-block:: yaml
2552
2553 parameters:
2554 linux:
2555 system:
2556 auth:
2557 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02002558 mkhomedir:
2559 enabled: true
2560 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002561 ldap:
2562 enabled: true
2563 binddn: cn=bind,ou=service_users,dc=example,dc=com
2564 bindpw: secret
2565 uri: ldap://127.0.0.1
2566 base: ou=users,dc=example,dc=com
2567 ldap_version: 3
2568 pagesize: 65536
2569 referrals: off
2570 filter:
2571 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2572 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2573 group: (&(objectClass=group)(gidNumber=*))
2574
Gleb Galkin93b9ae92018-10-18 13:57:30 +03002575PAM duo 2FA integration
2576
2577.. code-block:: yaml
2578
2579 parameters:
2580 linux:
2581 system:
2582 auth:
2583 enabled: true
2584 duo:
2585 enabled: true
2586 duo_host: localhost
2587 duo_ikey: DUO-INTEGRATION-KEY
2588 duo_skey: DUO-SECRET-KEY
2589
2590duo package version may be specified (optional)
2591
2592.. code-block:: yaml
2593
2594 linux:
2595 system:
2596 package:
2597 duo-unix:
2598 version: 1.10.1-0
2599
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002600Disabled multipath (the default setup):
Ales Komareka634f4b2016-10-02 13:11:04 +02002601
2602.. code-block:: yaml
2603
2604 parameters:
2605 linux:
2606 storage:
2607 multipath:
2608 enabled: false
2609
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002610Linux with local loopback device:
Simon Pasquier375001e2017-01-26 13:22:33 +01002611
2612.. code-block:: yaml
2613
2614 linux:
2615 storage:
2616 loopback:
2617 disk1:
2618 file: /srv/disk1
2619 size: 50G
2620
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002621External config generation
2622--------------------------
2623
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002624You are able to use config support metadata between formulas
2625and only generate configuration files for external use, for example, Docker, and so on.
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002626
2627.. code-block:: yaml
2628
2629 parameters:
2630 linux:
2631 system:
2632 config:
2633 pillar:
2634 jenkins:
2635 master:
2636 home: /srv/volumes/jenkins
2637 approved_scripts:
2638 - method java.net.URL openConnection
2639 credentials:
2640 - type: username_password
2641 scope: global
2642 id: test
2643 desc: Testing credentials
2644 username: test
2645 password: test
2646
Vladimir Ereminccf28842017-04-10 23:52:10 +03002647Netconsole Remote Kernel Logging
2648--------------------------------
2649
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002650Netconsole logger can be configured for the configfs-enabled kernels
2651(``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
2652applies both in runtime (if network is already configured),
2653and on-boot after an interface initialization.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002654
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002655.. note::
2656
2657 * Receiver can be located only on the same L3 domain
2658 (or you need to configure gateway MAC manually).
2659 * The Receiver MAC is detected only on configuration time.
2660 * Using broadcast MAC is not recommended.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002661
2662.. code-block:: yaml
2663
2664 parameters:
2665 linux:
2666 system:
2667 netconsole:
2668 enabled: true
2669 port: 514 (optional)
2670 loglevel: debug (optional)
2671 target:
2672 192.168.0.1:
2673 interface: bond0
2674 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02002675
Dzmitry Stremkouskid1a268b2018-10-03 16:36:04 +02002676Check network params on the environment
2677---------------------------------------
2678
2679Grab nics and nics states
2680
2681.. code-block:: bash
2682
2683 salt osd001\* net_checks.get_nics
2684
2685**Example of system output:**
2686
2687.. code-block:: bash
2688
2689 osd001.domain.com:
2690 |_
2691 - bond0
2692 - None
2693 - 1e:c8:64:42:23:b9
2694 - 0
2695 - 1500
2696 |_
2697 - bond1
2698 - None
2699 - 3c:fd:fe:27:3b:00
2700 - 1
2701 - 9100
2702 |_
2703 - fourty1
2704 - None
2705 - 3c:fd:fe:27:3b:00
2706 - 1
2707 - 9100
2708 |_
2709 - fourty2
2710 - None
2711 - 3c:fd:fe:27:3b:02
2712 - 1
2713 - 9100
2714
2715Grab 10G nics PCI addresses for hugepages setup
2716
2717.. code-block:: bash
2718
2719 salt cmp001\* net_checks.get_ten_pci
2720
2721**Example of system output:**
2722
2723.. code-block:: bash
2724
2725 cmp001.domain.com:
2726 |_
2727 - ten1
2728 - 0000:19:00.0
2729 |_
2730 - ten2
2731 - 0000:19:00.1
2732 |_
2733 - ten3
2734 - 0000:19:00.2
2735 |_
2736 - ten4
2737 - 0000:19:00.3
2738
2739Grab ip address for an interface
2740
2741.. code-block:: bash
2742
2743 salt cmp001\* net_checks.get_ip iface=one4
2744
2745**Example of system output:**
2746
2747.. code-block:: bash
2748
2749 cmp001.domain.com:
2750 10.200.177.101
2751
2752Grab ip addresses map
2753
2754.. code-block:: bash
2755
2756 salt-call net_checks.nodes_addresses
2757
2758**Example of system output:**
2759
2760.. code-block:: bash
2761
2762 local:
2763 |_
2764 - cid01.domain.com
2765 |_
2766 |_
2767 - pxe
2768 - 10.200.177.91
2769 |_
2770 - control
2771 - 10.200.178.91
2772 |_
2773 - cmn02.domain.com
2774 |_
2775 |_
2776 - storage_access
2777 - 10.200.181.67
2778 |_
2779 - pxe
2780 - 10.200.177.67
2781 |_
2782 - control
2783 - 10.200.178.67
2784 |_
2785 - cmp010.domain.com
2786 |_
2787 |_
2788 - pxe
2789 - 10.200.177.110
2790 |_
2791 - storage_access
2792 - 10.200.181.110
2793 |_
2794 - control
2795 - 10.200.178.110
2796 |_
2797 - vxlan
2798 - 10.200.179.110
2799
2800Verify full mesh connectivity
2801
2802.. code-block:: bash
2803
2804 salt-call net_checks.ping_check
2805
2806**Example of positive system output:**
2807
2808.. code-block:: bash
2809
2810 ['PASSED']
2811 [INFO ] ['PASSED']
2812 local:
2813 True
2814
2815**Example of system output in case of failure:**
2816
2817.. code-block:: bash
2818
2819 FAILED
2820 [ERROR ] FAILED
2821 ['control: 10.0.1.92 -> 10.0.1.224: Failed']
2822 ['control: 10.0.1.93 -> 10.0.1.224: Failed']
2823 ['control: 10.0.1.51 -> 10.0.1.224: Failed']
2824 ['control: 10.0.1.102 -> 10.0.1.224: Failed']
2825 ['control: 10.0.1.13 -> 10.0.1.224: Failed']
2826 ['control: 10.0.1.81 -> 10.0.1.224: Failed']
2827 local:
2828 False
2829
2830For this feature to work, please mark addresses with some role.
2831Otherwise 'default' role is assumed and mesh would consist of all
2832addresses on the environment.
2833
2834Mesh mark is needed only for interfaces which are enabled and have
2835ip address assigned.
2836
2837Checking dhcp pxe network meaningless, as it is used for salt
2838master vs minion communications, therefore treated as checked.
2839
2840.. code-block:: yaml
2841
2842 parameters:
2843 linux:
2844 network:
2845 interface:
2846 ens3:
2847 enabled: true
2848 type: eth
2849 proto: static
2850 address: ${_param:deploy_address}
2851 netmask: ${_param:deploy_network_netmask}
2852 gateway: ${_param:deploy_network_gateway}
2853 mesh: pxe
2854
2855Check pillars for ip address duplicates
2856
2857.. code-block:: bash
2858
2859 salt-call net_checks.verify_addresses
2860
2861**Example of positive system output:**
2862
2863.. code-block:: bash
2864
2865 ['PASSED']
2866 [INFO ] ['PASSED']
2867 local:
2868 True
2869
2870**Example of system output in case of failure:**
2871
2872.. code-block:: bash
2873
2874 FAILED. Duplicates found
2875 [ERROR ] FAILED. Duplicates found
2876 ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2877 [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2878 local:
2879 False
2880
2881Generate csv report for the env
2882
2883.. code-block:: bash
2884
2885 salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
2886 | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
2887 | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
2888
2889**Example of system output:**
2890
2891.. code-block:: bash
2892
2893 server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
2894 cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
2895 cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
2896 cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
2897 cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
2898 cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
2899 cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
2900 cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
2901 cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
2902 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
2903 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
2904 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
2905 cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
2906 cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
2907 cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
2908 ...
2909
Filip Pytlounf5383a42015-10-06 16:28:32 +02002910Usage
2911=====
2912
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002913Set MTU of the eth0 network interface to 1400:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002914
2915.. code-block:: bash
2916
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002917 ip link set dev eth0 mtu 1400
Filip Pytlounf5383a42015-10-06 16:28:32 +02002918
Denis Egorenko2e6ad0f2019-10-02 14:57:10 +04002919Switch Kernel from non-HWE to HWE
2920==================================
2921
2922It is possible to switch Kernel from non-HWE to HWE by using module
2923linux_kernel_switch. It has few methods:
2924
2925* check_hwe_kernel
2926* switch_kernel
2927* rollback_switch_kernel
2928
2929Method ``check_hwe_kernel`` allows to check whether HWE kernel installed
2930or not:
2931
2932.. code-block:: bash
2933
2934 salt <target> linux_kernel_switch.check_hwe_kernel
2935
2936Output for case HWE is installed:
2937
2938.. code-bloc:: bash
2939
2940 kvm02.cluster-env.local:
2941 ----------
2942 linux-image-extra-virtual-hwe-16.04:
2943 ----------
2944 linux-image-extra-virtual-hwe-16.04:
2945 ----------
2946 architecture:
2947 amd64
2948 description:
2949 Extra drivers for Virtual Linux kernel image
2950 This package will always depend on linux-image-generic.
2951 group:
2952 kernel
2953 install_date:
2954 2019-10-01T11:50:15Z
2955 name:
2956 linux-image-extra-virtual-hwe-16.04
2957 packager:
2958 Ubuntu Kernel Team <kernel-team@lists.ubuntu.com>
2959 source:
2960 linux-meta-hwe
2961 version:
2962 4.15.0.54.75
2963 ...
2964
2965Output for case HWE is not installed:
2966
2967.. code-bloc:: bash
2968
2969 kvm02.cluster-env.local:
2970 ----------
2971 linux-image-extra-virtual-hwe-16.04:
2972 Not installed!
2973 linux-image-generic-hwe-16.04:
2974 Not installed!
2975
2976Method ``switch_kernel`` allows you to switch from non-HWE to HWE. It has
2977two options: ``dry_run`` - to check what packages are going to be installed or
2978removed and ``only_kernel`` - install only Kernel image packages without other
2979HWE packages.
2980
2981Method ``rollback_switch_kernel`` allows you to rollback method
2982``switch_kernel`` which was executed successfully previously. Option
2983``dry_run`` - to check what packages are going to be installed/removed.
2984
Filip Pytlounf5383a42015-10-06 16:28:32 +02002985Read more
2986=========
2987
2988* https://www.archlinux.org/
2989* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu