blob: f6a4cba6f4bd862ed401c581efb9a21e8fc0f787 [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
Taras Khlivnyak9c0093f2021-03-25 13:31:03 +0200270Set ssd scheduler on physical nodes:
271Default values are
Taras Khlivnyak3d03ca02021-03-31 17:50:57 +0300272 enabled: false
Taras Khlivnyak9c0093f2021-03-25 13:31:03 +0200273 name: deadline
274
275.. code-block:: yaml
276
277 linux:
278 system:
279 ...
280 ssd_scheduler:
281 enabled: true
282 name: cfq
283 ...
284
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300285Linux with package, latest version:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200286
287.. code-block:: yaml
288
289 linux:
290 system:
291 ...
292 package:
293 package-name:
294 version: latest
295
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300296Linux with package from certail repo, version with no upgrades:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200297
298.. code-block:: yaml
299
300 linux:
301 system:
302 ...
303 package:
304 package-name:
305 version: 2132.323
306 repo: 'custom-repo'
307 hold: true
308
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300309Linux with package from certail repo, version with no GPG
310verification:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200311
312.. code-block:: yaml
313
314 linux:
315 system:
316 ...
317 package:
318 package-name:
319 version: 2132.323
320 repo: 'custom-repo'
321 verify: false
322
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300323Linux with autoupdates (automatically install security package
324updates):
Bruno Binet69a9d8d2017-02-16 22:34:32 +0100325
326.. code-block:: yaml
327
328 linux:
329 system:
330 ...
331 autoupdates:
332 enabled: true
333 mail: root@localhost
334 mail_only_on_error: true
335 remove_unused_dependencies: false
336 automatic_reboot: true
337 automatic_reboot_time: "02:00"
338
Dmitry Teselkin0f084a02018-08-29 14:46:38 +0300339Managing cron tasks
340-------------------
341
342There are two data structures that are related to managing cron itself and
343cron tasks:
344
345.. code-block:: yaml
346
347 linux:
348 system:
349 cron:
350
351and
352
353.. code-block:: yaml
354
355 linux:
356 system:
357 job:
358
359`linux:system:cron` manages cron packages, services, and '/etc/cron.allow' file.
360
361'deny' files are managed the only way - we're ensuring they are absent, that's
362a requirement from CIS 5.1.8
363
364'cron' pillar structure is the following:
365
366.. code-block:: yaml
367
368 linux:
369 system:
370 cron:
371 enabled: true
372 pkgs: [ <cron packages> ]
373 services: [ <cron services> ]
374 user:
375 <username>:
376 enabled: true
377
378To add user to '/etc/cron.allow' use 'enabled' key as shown above.
379
380'/etc/cron.deny' is not managed as CIS 5.1.8 requires it was removed.
381
382A user would be ignored if any of the following is true:
383* user is disabled in `linux:system:user:<username>`
384* user is disabled in `linux:system:cron:user:<username>`
385
386`linux:system:job` manages individual cron tasks.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300387
388By default, it will use name as an identifier, unless identifier key is
Filip Pytloun91222222017-08-04 10:55:27 +0200389explicitly set or False (then it will use Salt's default behavior which is
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300390identifier same as command resulting in not being able to change it):
Filip Pytlounf5383a42015-10-06 16:28:32 +0200391
392.. code-block:: yaml
393
394 linux:
395 system:
396 ...
397 job:
398 cmd1:
399 command: '/cmd/to/run'
Filip Pytloun91222222017-08-04 10:55:27 +0200400 identifier: cmd1
Filip Pytlounf5383a42015-10-06 16:28:32 +0200401 enabled: true
402 user: 'root'
403 hour: 2
404 minute: 0
405
Dmitry Teselkin0f084a02018-08-29 14:46:38 +0300406Managing 'at' tasks
407-------------------
408
409Pillar for managing `at` tasks is similar to one for `cron` tasks:
410
411.. code-block:: yaml
412
413 linux:
414 system:
415 at:
416 enabled: true
417 pkgs: [ <at packages> ]
418 services: [ <at services> ]
419 user:
420 <username>:
421 enabled: true
422
423To add a user to '/etc/at.allow' use 'enabled' key as shown above.
424
425'/etc/at.deny' is not managed as CIS 5.1.8 requires it was removed.
426
427A user will be ignored if any of the following is true:
428* user is disabled in `linux:system:user:<username>`
429* user is disabled in `linux:system:at:user:<username>`
430
431
Filip Pytlound0a29e72015-11-30 15:23:34 +0100432Linux security limits (limit sensu user memory usage to max 1GB):
433
434.. code-block:: yaml
435
436 linux:
437 system:
438 ...
439 limit:
440 sensu:
441 enabled: true
442 domain: sensu
443 limits:
444 - type: hard
445 item: as
446 value: 1000000
447
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300448Enable autologin on ``tty1`` (may work only for Ubuntu 14.04):
Filip Pytloun7fee0542015-10-15 11:19:24 +0200449
450.. code-block:: yaml
451
452 linux:
453 system:
454 console:
455 tty1:
456 autologin: root
Filip Pytloun281d0202016-01-29 14:03:51 +0100457 # Enable serial console
458 ttyS0:
459 autologin: root
460 rate: 115200
461 term: xterm
Filip Pytloun7fee0542015-10-15 11:19:24 +0200462
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300463To disable set autologin to ``false``.
Filip Pytloun7fee0542015-10-15 11:19:24 +0200464
Filip Pytloun7731b852016-02-01 11:13:47 +0100465Set ``policy-rc.d`` on Debian-based systems. Action can be any available
466command in ``while true`` loop and ``case`` context.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300467Following will disallow dpkg to stop/start services for the Cassandra
468package automatically:
Filip Pytloun7731b852016-02-01 11:13:47 +0100469
470.. code-block:: yaml
471
472 linux:
473 system:
474 policyrcd:
475 - package: cassandra
476 action: exit 101
477 - package: '*'
478 action: switch
479
Filip Pytlounc49445a2016-04-04 14:23:20 +0200480Set system locales:
481
482.. code-block:: yaml
483
484 linux:
485 system:
486 locale:
487 en_US.UTF-8:
488 default: true
Filip Pytlounee1745f2016-04-04 17:39:41 +0200489 "cs_CZ.UTF-8 UTF-8":
Filip Pytlounc49445a2016-04-04 14:23:20 +0200490 enabled: true
491
Andrey Shestakove7cca052017-05-24 23:06:24 +0300492Systemd settings:
493
494.. code-block:: yaml
495
496 linux:
497 system:
498 ...
499 systemd:
500 system:
501 Manager:
502 DefaultLimitNOFILE: 307200
503 DefaultLimitNPROC: 307200
504 user:
505 Manager:
506 DefaultLimitCPU: 2
507 DefaultLimitNPROC: 4
508
Filip Pytloun8b2131e2017-11-08 13:29:03 +0100509Ensure presence of directory:
510
511.. code-block:: yaml
512
513 linux:
514 system:
515 directory:
516 /tmp/test:
517 user: root
518 group: root
519 mode: 700
520 makedirs: true
521
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300522Ensure presence of file by specifying its source:
Richard Felkl2e07d652018-01-19 10:19:06 +0100523
524.. code-block:: yaml
525
526 linux:
527 system:
528 file:
529 /tmp/test.txt:
530 source: http://example.com/test.txt
Richard Felklf40599a2018-02-06 22:56:41 +0100531 user: root #optional
532 group: root #optional
533 mode: 700 #optional
534 dir_mode: 700 #optional
535 encoding: utf-8 #optional
536 hash: <<hash>> or <<URI to hash>> #optional
537 makedirs: true #optional
538
539 linux:
540 system:
541 file:
542 test.txt:
543 name: /tmp/test.txt
544 source: http://example.com/test.txt
Richard Felkl2e07d652018-01-19 10:19:06 +0100545
Gabor Orosz35815c02018-09-07 17:31:05 +0200546 linux:
547 system:
548 file:
549 test2:
550 name: /tmp/test2.txt
551 source: http://example.com/test2.jinja
552 template: jinja
553
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300554Ensure presence of file by specifying its contents:
Richard Felkl2e07d652018-01-19 10:19:06 +0100555
556.. code-block:: yaml
557
558 linux:
559 system:
560 file:
561 /tmp/test.txt:
562 contents: |
563 line1
564 line2
Richard Felklf40599a2018-02-06 22:56:41 +0100565
566 linux:
567 system:
568 file:
569 /tmp/test.txt:
570 contents_pillar: linux:network:hostname
571
572 linux:
573 system:
574 file:
575 /tmp/test.txt:
576 contents_grains: motd
577
Ivan Berezovskiy25e177d2019-07-22 13:14:14 +0400578Ensure presence of file by specifying its secured source:
579
580.. code-block:: yaml
581
582 linux:
583 system:
584 file:
585 /tmp/test.txt:
586 secured_source:
587 protocol: http #optional
588 user: foo
589 password: bar
590 url: example.com/test.txt
591 secured_hash: #optional
592 url: example.com/test.txt.md5
593 user: root #optional
594 group: root #optional
595 mode: 700 #optional
596 dir_mode: 700 #optional
597 encoding: utf-8 #optional
598 makedirs: true #optional
599
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300600Ensure presence of file to be serialized through one of the
601serializer modules (see:
602https://docs.saltstack.com/en/latest/ref/serializers/all/index.html):
Bruno Binet9c2fe222018-06-08 16:57:32 +0200603
604.. code-block:: yaml
605
606 linux:
607 system:
608 file:
609 /tmp/test.json:
610 serialize: json
611 contents:
612 foo: 1
613 bar: 'bar'
614
Filip Pytloun281034a2016-01-04 18:06:22 +0100615Kernel
616~~~~~~
617
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300618Install always up to date LTS kernel and headers from Ubuntu Trusty:
Filip Pytloun281034a2016-01-04 18:06:22 +0100619
620.. code-block:: yaml
621
622 linux:
623 system:
624 kernel:
625 type: generic
626 lts: trusty
627 headers: true
628
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300629Load kernel modules and add them to ``/etc/modules``:
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100630
631.. code-block:: yaml
632
633 linux:
634 system:
635 kernel:
636 modules:
637 - nf_conntrack
638 - tp_smapi
639 - 8021q
640
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300641Configure or blacklist kernel modules with additional options to
642``/etc/modprobe.d`` following example will add
643``/etc/modprobe.d/nf_conntrack.conf`` file with line
644``options nf_conntrack hashsize=262144``:
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300645
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300646'option' can be a mapping (with 'enabled' and 'value' keys) or a scalar.
647
648Example for 'scalar' option value:
649
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300650.. code-block:: yaml
651
652 linux:
653 system:
654 kernel:
655 module:
656 nf_conntrack:
657 option:
658 hashsize: 262144
659
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300660Example for 'mapping' option value:
661
662.. code-block:: yaml
663
664 linux:
665 system:
666 kernel:
667 module:
668 nf_conntrack:
669 option:
670 hashsize:
671 enabled: true
672 value: 262144
673
674NOTE: 'enabled' key is optional and is True by default.
675
676Blacklist a module:
677
678.. code-block:: yaml
679
680 linux:
681 system:
682 kernel:
683 module:
684 nf_conntrack:
685 blacklist: true
686
687A module can have a number of aliases, wildcards are allowed.
688Define an alias for a module:
689
690.. code-block:: yaml
691
692 linux:
693 system:
694 kernel:
695 module:
696 nf_conntrack:
697 alias:
698 nfct:
699 enabled: true
700 "nf_conn*":
701 enabled: true
702
703NOTE: 'enabled' key is mandatory as there are no other keys exist.
704
705Execute custom command instead of 'insmod' when inserting a module:
706
707.. code-block:: yaml
708
709 linux:
710 system:
711 kernel:
712 module:
713 nf_conntrack:
714 install:
715 enabled: true
716 command: /bin/true
717
718NOTE: 'enabled' key is optional and is True by default.
719
720Execute custom command instead of 'rmmod' when removing a module:
721
722.. code-block:: yaml
723
724 linux:
725 system:
726 kernel:
727 module:
728 nf_conntrack:
729 remove:
730 enabled: true
731 command: /bin/true
732
733NOTE: 'enabled' key is optional and is True by default.
734
735Define module dependencies:
736
737.. code-block:: yaml
738
739 linux:
740 system:
741 kernel:
742 module:
743 nf_conntrack:
744 softdep:
745 pre:
746 1:
747 enabled: true
748 value: a
749 2:
750 enabled: true
751 value: b
752 3:
753 enabled: true
754 value: c
755 post:
756 1:
757 enabled: true
758 value: x
759 2:
760 enabled: true
761 value: y
762 3:
763 enabled: true
764 value: z
765
766NOTE: 'enabled' key is optional and is True by default.
767
768
Filip Pytloun281034a2016-01-04 18:06:22 +0100769Install specific kernel version and ensure all other kernel packages are
770not present. Also install extra modules and headers for this kernel:
771
772.. code-block:: yaml
773
774 linux:
775 system:
776 kernel:
777 type: generic
778 extra: true
779 headers: true
780 version: 4.2.0-22
781
Denis Egorenko567aa202019-11-06 14:02:00 +0400782Also it is possible to install Kernel with Hardware Enablement or virtual
783kernel packages. For example, for Xenial:
784
785.. code-block:: yaml
786
787 linux:
788 system:
789 kernel:
790 type: generic
791 extra: true
792 headers: true
793 version: 4.15.0-65
794 hwe:
795 type: hwe
796 version: 16.04
797 kernel_version: 4.15.0.65
798
799Set `linux:system:kernel:hwe:type:virtual` if you need Virtual kernel packages.
800
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300801Systcl kernel parameters:
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100802
803.. code-block:: yaml
804
805 linux:
806 system:
807 kernel:
808 sysctl:
809 net.ipv4.tcp_keepalive_intvl: 3
810 net.ipv4.tcp_keepalive_time: 30
811 net.ipv4.tcp_keepalive_probes: 8
812
Michael Polenchukebf55522018-01-25 13:22:39 +0400813Configure kernel boot options:
814
815.. code-block:: yaml
816
817 linux:
818 system:
819 kernel:
820 boot_options:
821 - elevator=deadline
822 - spectre_v2=off
823 - nopti
824
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100825CPU
826~~~
827
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300828Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100829
830.. code-block:: yaml
831
832 linux:
833 system:
834 cpu:
835 governor: performance
836
Nick Metzf04f5f32018-01-08 15:25:04 +0100837
Jiri Broulik303905d2018-01-11 14:12:48 +0100838CGROUPS
839~~~~~~~
840
841Setup linux cgroups:
842
843.. code-block:: yaml
844
845 linux:
846 system:
847 cgroup:
848 enabled: true
849 group:
850 ceph_group_1:
851 controller:
852 cpu:
853 shares:
854 value: 250
855 cpuacct:
856 usage:
857 value: 0
858 cpuset:
859 cpus:
860 value: 1,2,3
861 memory:
862 limit_in_bytes:
863 value: 2G
864 memsw.limit_in_bytes:
865 value: 3G
866 mapping:
867 subjects:
868 - '@ceph'
869 generic_group_1:
870 controller:
871 cpu:
872 shares:
873 value: 250
874 cpuacct:
875 usage:
876 value: 0
877 mapping:
878 subjects:
879 - '*:firefox'
880 - 'student:cp'
881
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300882Shared libraries
Nick Metzf04f5f32018-01-08 15:25:04 +0100883~~~~~~~~~~~~~~~~
884
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300885Set additional shared library to Linux system library path:
Nick Metzf04f5f32018-01-08 15:25:04 +0100886
887.. code-block:: yaml
888
889 linux:
890 system:
891 ld:
892 library:
893 java:
894 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
895 - /opt/java/jre/lib/amd64/server
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200896
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200897Certificates
898~~~~~~~~~~~~
899
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300900Add certificate authority into system trusted CA bundle:
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200901
902.. code-block:: yaml
903
904 linux:
905 system:
906 ca_certificates:
907 mycert: |
908 -----BEGIN CERTIFICATE-----
909 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
910 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
911 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
912 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
913 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
914 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
915 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
916 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
917 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
918 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
919 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
920 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
921 -----END CERTIFICATE-----
922
Filip Pytloun361096c2017-08-23 10:57:20 +0200923Sysfs
924~~~~~
925
926Install sysfsutils and set sysfs attributes:
927
928.. code-block:: yaml
929
930 linux:
931 system:
932 sysfs:
933 scheduler:
934 block/sda/queue/scheduler: deadline
935 power:
936 mode:
937 power/state: 0660
938 owner:
939 power/state: "root:power"
940 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
941
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200942Optional: You can also use list that will ensure order of items.
943
944.. code-block:: yaml
945
946 linux:
947 system:
948 sysfs:
949 scheduler:
950 block/sda/queue/scheduler: deadline
951 power:
952 - mode:
953 power/state: 0660
954 - owner:
955 power/state: "root:power"
956 - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
957
Martin Polreich148e1b82018-09-13 15:54:25 +0200958Sysfs definition with disabled automatic write. Attributes are saved
959to configuration, but are not applied during the run.
960Thay will be applied automatically after the reboot.
961
962
963.. code-block:: yaml
964
965 linux:
966 system:
967 sysfs:
968 enable_apply: false
969 scheduler:
970 block/sda/queue/scheduler: deadline
971
972.. note:: The `enable_apply` parameter defaults to `True` if not defined.
973
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100974Huge Pages
975~~~~~~~~~~~~
976
977Huge Pages give a performance boost to applications that intensively deal
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300978with memory allocation/deallocation by decreasing memory fragmentation:
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100979
980.. code-block:: yaml
981
982 linux:
983 system:
984 kernel:
985 hugepages:
986 small:
987 size: 2M
988 count: 107520
989 mount_point: /mnt/hugepages_2MB
Michael Polenchukd9369fe2018-05-08 17:53:08 +0400990 mount: false/true # default is true (mount immediately) / false (just save in the fstab)
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100991 large:
992 default: true # default automatically mounted
993 size: 1G
994 count: 210
995 mount_point: /mnt/hugepages_1GB
996
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300997.. note:: Not recommended to use both pagesizes concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100998
Jakub Pavlik5398d872017-02-13 22:30:47 +0100999Intel SR-IOV
1000~~~~~~~~~~~~
1001
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001002PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV)
1003specification defines a standardized mechanism to virtualize
1004PCIe devices. The mechanism can virtualize a single PCIe
1005Ethernet controller to appear as multiple PCIe devices:
Jakub Pavlik5398d872017-02-13 22:30:47 +01001006
1007.. code-block:: yaml
1008
1009 linux:
1010 system:
1011 kernel:
1012 sriov: True
1013 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
1014 rc:
1015 local: |
1016 #!/bin/sh -e
1017 # Enable 7 VF on eth1
1018 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
1019 exit 0
1020
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001021Isolate CPU options
1022~~~~~~~~~~~~~~~~~~~
1023
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001024Remove the specified CPUs, as defined by the cpu_number values, from
1025the general kernel SMP balancing and scheduler algroithms. The only
1026way to move a process onto or off an *isolated* CPU is via the CPU
1027affinity syscalls. ``cpu_number begins`` at ``0``, so the
1028maximum value is ``1`` less than the number of CPUs on the system.:
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001029
1030.. code-block:: yaml
1031
1032 linux:
1033 system:
1034 kernel:
1035 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +01001036
Filip Pytlounf5383a42015-10-06 16:28:32 +02001037Repositories
1038~~~~~~~~~~~~
1039
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001040RedHat-based Linux with additional OpenStack repo:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001041
1042.. code-block:: yaml
1043
1044 linux:
1045 system:
1046 ...
1047 repo:
1048 rdo-icehouse:
1049 enabled: true
1050 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
1051 pgpcheck: 0
1052
1053Ensure system repository to use czech Debian mirror (``default: true``)
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001054Also pin it's packages with priority ``900``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001055
1056.. code-block:: yaml
1057
1058 linux:
1059 system:
1060 repo:
1061 debian:
1062 default: true
1063 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
1064 # Import signing key from URL if needed
1065 key_url: "http://dummy.com/public.gpg"
1066 pin:
1067 - pin: 'origin "ftp.cz.debian.org"'
1068 priority: 900
1069 package: '*'
1070
azvyagintseva3a73d02018-12-06 14:49:58 +02001071Sometimes better to use one pining rule file, to decrease mistaken
1072ordering. You can use those option ``system:apt:preferences``, which would add opts into
1073``/etc/apt/preferences`` file:
1074
1075.. code-block:: yaml
1076
1077 parameters:
1078 linux:
1079 system:
1080 apt:
1081 preferences:
1082 enabled: true
1083 rules:
1084 100:
1085 enabled: true
1086 name: 'some origin pin'
1087 pin: 'release o=Debian'
1088 priority: 1100
1089 package: '*'
1090
1091
azvyagintsev4494a472018-09-14 19:19:23 +03001092If you need to add multiple pin rules for one repo, please use new,ordered definition format
1093('pinning' definition will be in priotity to use):
1094
1095.. code-block:: yaml
1096
1097 linux:
1098 system:
1099 repo:
1100 mcp_saltstack:
1101 source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main"
1102 architectures: amd64
1103 clean_file: true
1104 pinning:
1105 10:
1106 enabled: true
1107 pin: 'release o=SaltStack'
1108 priority: 50
1109 package: 'libsodium18'
1110 20:
1111 enabled: true
1112 pin: 'release o=SaltStack'
1113 priority: 1100
1114 package: '*'
1115
1116
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001117.. note:: For old Ubuntu releases (<xenial)
azvyagintsevff089d22018-07-27 16:52:34 +02001118 extra packages for apt transport, like ``apt-transport-https``
1119 may be required to be installed manually.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001120 (Chicken-eggs issue: we need to install packages to
azvyagintsevff089d22018-07-27 16:52:34 +02001121 reach repo from where they should be installed)
1122 Otherwise, you still can try 'fortune' and install prereq.packages before
1123 any repo configuration, using list of requires in map.jinja.
1124
1125
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001126Disabling any prerequisite packages installation:
1127
azvyagintsevff089d22018-07-27 16:52:34 +02001128You can simply drop any package pre-installation (before system.linux.repo
1129will be processed) via cluster lvl:
1130
1131.. code-block:: yaml
1132
1133 linux:
1134 system:
1135 pkgs: ~
1136
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001137Package manager proxy global setup:
Petr Michalec10462bb2017-03-23 19:18:08 +01001138
1139.. code-block:: yaml
1140
1141 linux:
1142 system:
1143 ...
1144 repo:
1145 apt-mk:
1146 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1147 ...
1148 proxy:
1149 pkg:
1150 enabled: true
1151 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1152 ...
1153 # NOTE: Global defaults for any other componet that configure proxy on the system.
1154 # If your environment has just one simple proxy, set it on linux:system:proxy.
1155 #
1156 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1157 # as for https and http
1158 ftp: ftp://proxy.host.local:2121
1159 http: http://proxy.host.local:3142
1160 https: https://proxy.host.local:3143
1161
Taras Khlivnyak344de402021-02-17 09:10:16 +02001162Package manager direct access setup:
1163
1164.. code-block:: yaml
1165
1166 linux:
1167 system:
1168 ...
1169 repo:
1170 apt-mk:
1171 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1172 ...
1173 proxy:
1174 pkg:
1175 enabled: true
1176 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1177 ...
1178 # NOTE: Global defaults for any other componet that configure proxy on the system.
1179 # If your environment has just one simple proxy, set it on linux:system:proxy.
1180 #
1181 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1182 # as for https and http
1183 ftp: ftp://proxy.host.local:2121
1184 http: http://proxy.host.local:3142
1185 https: https://proxy.host.local:3143
1186 direct:
1187 - 192.168.0.100
1188 - repo.wo.proxy.local
1189
1190
Petr Michalec10462bb2017-03-23 19:18:08 +01001191Package manager proxy setup per repository:
1192
1193.. code-block:: yaml
1194
1195 linux:
1196 system:
1197 ...
1198 repo:
1199 debian:
1200 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1201 ...
1202 apt-mk:
1203 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1204 # per repository proxy
1205 proxy:
1206 enabled: true
1207 http: http://maas-01:8080
1208 https: http://maas-01:8080
1209 ...
1210 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001211 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +01001212 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
1213 pkg:
1214 enabled: true
1215 ftp: ftp://proxy.host.local:2121
1216 #http: http://proxy.host.local:3142
1217 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001218 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001219 # global system fallback system defaults
1220 ftp: ftp://proxy.host.local:2121
1221 http: http://proxy.host.local:3142
1222 https: https://proxy.host.local:3143
1223
Ivan Berezovskiycfd58a22019-06-25 20:15:51 +04001224
1225Add secured apt repository:
1226
1227.. code-block:: yaml
1228
1229 linux:
1230 system:
1231 ...
1232 repo:
1233 test:
1234 secure: true
1235 url: example.org/ubuntu
1236 arch: deb
1237 protocol: http
1238 user: foo
1239 password: bar
1240 distribution: stable
1241 component: main
1242
1243Add multiply secured apt repositories with same credentials:
1244
1245.. code-block:: yaml
1246
1247 linux:
1248 system:
1249 ...
1250 common_repo_secured:
1251 arch: deb
1252 protocol: http
1253 user: foo
1254 password: bar
1255 distribution: stable
1256 component: main
1257 repo:
1258 test1:
1259 secure: true
1260 url: example1.org/ubuntu
1261 test2:
1262 secure: true
1263 url: example2.org/ubuntu
1264
Denis Egorenkoe29a04f2019-12-05 15:46:06 +04001265Also it is possible to specify list of repos, which should be secured
1266within ``common_repo_secured`` block and without changing current
1267existing repo source parameter:
1268
1269.. code-block:: yaml
1270
1271 linux:
1272 system:
1273 ...
1274 common_repo_secured:
1275 user: foo
1276 password: bar
1277 secured_repos: [ 'test1', 'test2' ]
1278 repo:
1279 test1:
1280 ...
1281 test2:
1282 ...
1283 test3:
1284 ...
1285
1286Repos ``test1, test2`` will be secured. In case if you want secure all
1287available repos use ``secured_repos: [ 'all' ]``. But repo parameters have
1288precedence over parameters from ``common_repo_secured``. In next case:
1289
1290 linux:
1291 system:
1292 ...
1293 common_repo_secured:
1294 user: foo
1295 password: bar
1296 secured_repos: [ 'all' ]
1297 repo:
1298 test1:
1299 ...
1300 test2:
1301 ...
1302 test3:
1303 secure: False
1304 ...
1305
1306Repo ``test3`` will not be secured.
1307
Jiri Broulik34a29b42017-04-25 14:42:54 +02001308Remove all repositories:
1309
1310.. code-block:: yaml
1311
1312 linux:
1313 system:
1314 purge_repos: true
1315
azvyagintsevff089d22018-07-27 16:52:34 +02001316Refresh repositories metada, after configuration:
1317
1318.. code-block:: yaml
1319
1320 linux:
1321 system:
1322 refresh_repos_meta: true
1323
Filip Pytlounc512e6c2017-11-22 14:28:10 +01001324Setup custom apt config options:
1325
1326.. code-block:: yaml
1327
1328 linux:
1329 system:
1330 apt:
1331 config:
1332 compression-workaround:
1333 "Acquire::CompressionTypes::Order": "gz"
1334 docker-clean:
1335 "DPkg::Post-Invoke":
1336 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
1337 "APT::Update::Post-Invoke":
1338 - "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 +02001339
Petr Michalec10462bb2017-03-23 19:18:08 +01001340RC
1341~~
1342
Jakub Pavlik78859382016-01-21 11:26:39 +01001343rc.local example
1344
1345.. code-block:: yaml
1346
1347 linux:
1348 system:
1349 rc:
1350 local: |
1351 #!/bin/sh -e
1352 #
1353 # rc.local
1354 #
1355 # This script is executed at the end of each multiuser runlevel.
1356 # Make sure that the script will "exit 0" on success or any other
1357 # value on error.
1358 #
1359 # In order to enable or disable this script just change the execution
1360 # bits.
1361 #
1362 # By default this script does nothing.
1363 exit 0
1364
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001365Prompt
1366~~~~~~
1367
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001368Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``.
1369Every user can have different prompt:
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001370
1371.. code-block:: yaml
1372
1373 linux:
1374 system:
1375 prompt:
1376 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\\]
1377 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
1378
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001379On Debian systems, to set prompt system-wide, it's necessary to
1380remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``,
1381which comes from ``/etc/skel/.bashrc``. This formula will do
1382this automatically, but will not touch existing user's
1383``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +01001384
Filip Pytlouneef11c12016-03-25 11:00:23 +01001385Bash
1386~~~~
1387
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001388Fix bash configuration to preserve history across sessions
1389like ZSH does by default:
Filip Pytlouneef11c12016-03-25 11:00:23 +01001390
1391.. code-block:: yaml
1392
1393 linux:
1394 system:
1395 bash:
1396 preserve_history: true
1397
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001398Login banner message
1399~~~~~~~~~~~~~~~~~~~~
1400
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001401``/etc/issue`` is a text file which contains a message or system
1402identification to be printed before the login prompt. It may contain
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001403various @char and \char sequences, if supported by the getty-type
1404program employed on the system.
1405
1406Setting logon banner message is easy:
1407
1408.. code-block:: yaml
1409
1410 liunx:
1411 system:
1412 banner:
1413 enabled: true
1414 contents: |
1415 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1416
1417 You must have explicit, authorized permission to access or configure this
1418 device. Unauthorized attempts and actions to access or use this system may
1419 result in civil and/or criminal penalties.
1420 All activities performed on this system are logged and monitored.
1421
Filip Pytloune874dfb2016-01-22 16:57:34 +01001422Message of the day
1423~~~~~~~~~~~~~~~~~~
1424
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001425``pam_motd`` from package ``libpam-modules`` is used for dynamic
1426messages of the day. Setting custom ``motd`` will clean up existing ones.
Filip Pytloune874dfb2016-01-22 16:57:34 +01001427
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001428Setting static ``motd`` will replace existing ``/etc/motd`` and remove
1429scripts from ``/etc/update-motd.d``.
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001430
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001431Setting static ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001432
1433.. code-block:: yaml
1434
1435 linux:
1436 system:
1437 motd: |
1438 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1439
1440 You must have explicit, authorized permission to access or configure this
1441 device. Unauthorized attempts and actions to access or use this system may
1442 result in civil and/or criminal penalties.
1443 All activities performed on this system are logged and monitored.
1444
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001445Setting dynamic ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001446
Filip Pytloune874dfb2016-01-22 16:57:34 +01001447.. code-block:: yaml
1448
1449 linux:
1450 system:
1451 motd:
1452 - release: |
1453 #!/bin/sh
1454 [ -r /etc/lsb-release ] && . /etc/lsb-release
1455
1456 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
1457 # Fall back to using the very slow lsb_release utility
1458 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
1459 fi
1460
1461 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
1462 - warning: |
1463 #!/bin/sh
1464 printf "This is [company name] network.\n"
1465 printf "Unauthorized access strictly prohibited.\n"
1466
Marek Celoud713e9072017-05-18 15:20:25 +02001467Services
1468~~~~~~~~
1469
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001470Stop and disable the ``linux`` service:
Marek Celoud713e9072017-05-18 15:20:25 +02001471
1472.. code-block:: yaml
1473
1474 linux:
1475 system:
1476 service:
1477 apt-daily.timer:
1478 status: dead
1479
Dzmitry Stremkouski70d09782018-11-30 16:04:59 +01001480Override systemd service unit:
1481
1482.. code-block:: yaml
1483
1484 parameters:
1485
1486 linux:
1487 system:
1488 service:
1489 tgt:
1490 name: tgt
1491 status: running
1492 enabled: True
1493 override:
1494 50:
1495 target: tgt.service.d
1496 name: bind
1497 content: |
1498 [Service]
1499 ExecStart=
1500 ExecStart=/usr/sbin/tgtd -f --iscsi portal=${_param:single_address}:3260
1501
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001502Possible statuses are ``dead`` (disable service by default), ``running``
1503(enable service by default), ``enabled``, ``disabled``:
Marek Celoud713e9072017-05-18 15:20:25 +02001504
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001505Linux with the ``atop`` service:
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +03001506
1507.. code-block:: yaml
1508
1509 linux:
1510 system:
1511 atop:
1512 enabled: true
1513 interval: 20
1514 logpath: "/var/log/atop"
1515 outfile: "/var/log/atop/daily.log"
1516
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001517Linux with the ``mcelog`` service:
Oleksii Chupryn144432b2018-05-22 10:34:48 +03001518
1519.. code-block:: yaml
1520
1521 linux:
1522 system:
1523 mcelog:
1524 enabled: true
1525 logging:
1526 syslog: true
1527 syslog_error: true
1528
Denis Egorenko394ae072019-11-22 17:26:30 +04001529Linux Sosreport
1530^^^^^^^^^^^^^^^
1531
1532Sosreport is an extensible, portable, support data collection tool
1533primarily aimed at Linux distributions and other UNIX-like operating systems,
1534which allows to create diagnostic snapshot of system.
1535
1536Works out of box and additional pillars are not needed by default:
1537
1538.. code-block:: bash
1539
1540 salt-call state.sls linux.system.sosreport.report
1541
1542or from Salt Master:
1543
1544.. code-block:: bash
1545
1546 salt -C '<target>' state.sls linux.system.sosreport.report
1547
1548Sosreport configuration may be extended with next pillar data:
1549
1550.. code-block:: yaml
1551
1552 linux:
1553 system:
1554 sosreport:
1555 cmd_options:
1556 tmp-dir: /root/reportdir
1557 no_arg_opts: [ '-q' ]
1558 config_options:
1559 general:
1560 all-logs: true
1561 plugins:
1562 disabled: [ docker ]
1563 tunables:
1564 apache.log: true
1565
1566Where is ``cmd_options`` additional provided arguments for cli cmd call,
1567``general`` desribes parameters for sos.conf ``general`` section,
1568``plugins`` desribes which plugins should be ``enabled`` or ``disabled``
1569and ``tunables`` has custom plugin options which can be additionally set.
1570
1571Also it is possible to pass cmd_options through pillar override:
1572
1573.. code-block:: bash
1574
1575 salt -C '<target>' state.sls linux.system.sosreport.report pillar='{ "sosreport" : { "ticket-number": 12345, "tmp-dir": "/root/reportdir2" } }'
1576
1577Run ``sosreport --help`` to get full list of possible options.
1578
1579Once state ``linux.system.sosreport.report`` is executed on targets, it is
1580possible to collect all reports by using next command on Salt Master:
1581
1582.. code-block:: bash
1583
1584 salt -C 'I@salt:master' state.sls linux.system.sosreport.collect pillar='{ "sosreport_collect" : { "target": "<target>", "archiveName": "sosreport_<env_name>_<customer>_<ticket>" } }'
1585
1586This will generate one common archive for all ``<target>`` nodes with name
1587``sosreport_<env_name>_<customer>_<ticket>.tar.gz``. It is required to specify
1588target nodes through model (``linux.system.sosreport.collect``) or pillar
1589override. Also possible options are: ``nodeIp`` which allows you to use IP from another
1590interface on node (should be available from minions), ``port`` for NetCat if
1591you see that default port is busy, ``archiveName`` for your archive and
1592``reportWorkDir`` directory to keeping all reports for current case.
1593
Filip Pytloun2f70b492016-02-19 15:55:25 +01001594RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +01001595^^^^^^^^^^^^^
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001596Currently, ``update-motd`` is not available
1597for RHEL. So there is no native support for dynamic ``motd``.
1598You can still set a static one, with a different pillar structure:
Filip Pytloun2f70b492016-02-19 15:55:25 +01001599
1600.. code-block:: yaml
1601
1602 linux:
1603 system:
1604 motd: |
1605 This is [company name] network.
1606 Unauthorized access strictly prohibited.
1607
Filip Pytloun8296bb92016-02-19 18:42:09 +01001608Haveged
1609~~~~~~~
1610
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001611If you are running headless server and are low on entropy,
1612you may set up Haveged:
Filip Pytloun8296bb92016-02-19 18:42:09 +01001613
1614.. code-block:: yaml
1615
1616 linux:
1617 system:
1618 haveged:
1619 enabled: true
1620
Filip Pytlounf5383a42015-10-06 16:28:32 +02001621Linux network
1622-------------
1623
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001624Linux with network manager:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001625
1626.. code-block:: yaml
1627
1628 linux:
1629 network:
1630 enabled: true
1631 network_manager: true
1632
Dzmitry Stremkouski00cdbe62018-10-31 16:41:54 +01001633Execute linux.network.interface state without ifupdown activity:
1634
1635.. code-block:: bash
1636
1637 salt-call linux.network.interface pillar='{"linux":{"network":{"noifupdown":True}}}'
1638
1639
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001640Linux with default static network interfaces, default gateway
1641interface and DNS servers:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001642
1643.. code-block:: yaml
1644
1645 linux:
1646 network:
1647 enabled: true
1648 interface:
1649 eth0:
1650 enabled: true
1651 type: eth
1652 address: 192.168.0.102
1653 netmask: 255.255.255.0
1654 gateway: 192.168.0.1
1655 name_servers:
1656 - 8.8.8.8
1657 - 8.8.4.4
1658 mtu: 1500
1659
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001660Linux with bonded interfaces and disabled ``NetworkManager``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001661
1662.. code-block:: yaml
1663
1664 linux:
1665 network:
1666 enabled: true
1667 interface:
1668 eth0:
1669 type: eth
1670 ...
1671 eth1:
1672 type: eth
1673 ...
1674 bond0:
1675 enabled: true
1676 type: bond
1677 address: 192.168.0.102
1678 netmask: 255.255.255.0
1679 mtu: 1500
1680 use_in:
1681 - interface: ${linux:interface:eth0}
1682 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +01001683 network_manager:
1684 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001685
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001686Linux with VLAN ``interface_params``:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001687
1688.. code-block:: yaml
1689
1690 linux:
1691 network:
1692 enabled: true
1693 interface:
1694 vlan69:
1695 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001696 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001697 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001698
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001699Linux with wireless interface parameters:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001700
1701.. code-block:: yaml
1702
1703 linux:
1704 network:
1705 enabled: true
1706 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001707 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001708 interface:
1709 wlan0:
1710 type: eth
1711 wireless:
1712 essid: example
1713 key: example_key
1714 security: wpa
1715 priority: 1
1716
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001717Linux networks with routes defined:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001718
1719.. code-block:: yaml
1720
1721 linux:
1722 network:
1723 enabled: true
1724 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001725 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001726 interface:
1727 eth0:
1728 type: eth
1729 route:
1730 default:
1731 address: 192.168.0.123
1732 netmask: 255.255.255.0
1733 gateway: 192.168.0.1
1734
ivce5011da2019-01-23 07:56:53 +03001735Linux networks with implicit routes definition:
1736
1737- on node 1:
1738
1739.. code-block:: yaml
1740
1741 linux:
1742 network:
1743 enabled: true
1744 router:
1745 ctl:
1746 # router that connects 10.0.1.0/24 and 10.0.2.0/24
1747 addresses:
1748 - 10.0.1.1/24
1749 - 10.0.2.1/24
1750 test:
1751 addresses:
1752 - 10.0.1.2/24
1753 networks:
1754 - 10.100.0.0/16
1755 interface:
1756 ctl:
1757 name: eth0
1758 address: 10.0.1.101
1759 netmask: 255.255.255.0
1760
1761- on node2:
1762
1763.. code-block:: yaml
1764
1765 linux:
1766 network:
1767 enabled: true
1768 router:
1769 ctl:
1770 # equivalent of node1's ctl router with 'implicit_routes = false'
1771 options:
1772 implicit_routes: false
1773 addresses:
1774 - 10.0.1.1/24
1775 - 10.0.2.1/24
1776 networks:
1777 - 10.0.1.0/24
1778 - 10.0.2.0/24
1779 interface:
1780 ctl:
1781 name: eth0
1782 address: 10.0.2.101
1783 netmask: 255.255.255.0
1784
1785
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001786Native Linux Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001787
1788.. code-block:: yaml
1789
1790 linux:
1791 network:
1792 interface:
1793 eth1:
1794 enabled: true
1795 type: eth
1796 proto: manual
1797 up_cmds:
1798 - ip address add 0/0 dev $IFACE
1799 - ip link set $IFACE up
1800 down_cmds:
1801 - ip link set $IFACE down
1802 br-ex:
1803 enabled: true
1804 type: bridge
1805 address: ${linux:network:host:public_local:address}
1806 netmask: 255.255.255.0
1807 use_interfaces:
1808 - eth1
1809
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001810Open vSwitch Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001811
1812.. code-block:: yaml
1813
1814 linux:
1815 network:
1816 bridge: openvswitch
1817 interface:
1818 eth1:
1819 enabled: true
1820 type: eth
1821 proto: manual
1822 up_cmds:
1823 - ip address add 0/0 dev $IFACE
1824 - ip link set $IFACE up
1825 down_cmds:
1826 - ip link set $IFACE down
1827 br-ex:
1828 enabled: true
1829 type: bridge
1830 address: ${linux:network:host:public_local:address}
1831 netmask: 255.255.255.0
1832 use_interfaces:
1833 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001834 br-prv:
1835 enabled: true
1836 type: ovs_bridge
1837 mtu: 65000
1838 br-ens7:
1839 enabled: true
1840 name: br-ens7
1841 type: ovs_bridge
1842 proto: manual
1843 mtu: 9000
1844 use_interfaces:
1845 - ens7
1846 patch-br-ens7-br-prv:
1847 enabled: true
1848 name: ens7-prv
1849 ovs_type: ovs_port
1850 type: ovs_port
1851 bridge: br-ens7
1852 port_type: patch
1853 peer: prv-ens7
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001854 tag: 109 # [] to unset a tag
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001855 mtu: 65000
1856 patch-br-prv-br-ens7:
1857 enabled: true
1858 name: prv-ens7
1859 bridge: br-prv
1860 ovs_type: ovs_port
1861 type: ovs_port
1862 port_type: patch
1863 peer: ens7-prv
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001864 tag: 109
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001865 mtu: 65000
1866 ens7:
1867 enabled: true
1868 name: ens7
1869 proto: manual
1870 ovs_port_type: OVSPort
1871 type: ovs_port
1872 ovs_bridge: br-ens7
1873 bridge: br-ens7
Oleg Gelbukh36f01072019-07-01 15:26:16 -07001874 ens6:
1875 enabled: true
1876 proto: manual
1877 type: eth
1878 ovs_bridge: br-ctl
1879 br-ctl:
1880 enabled: true
1881 type: ovs_bridge
1882 internal-br-ctl-port:
1883 enabled: true
1884 proto: static
1885 address: 172.172.0.10
1886 netmask: 255.255.0.0
1887 name_servers:
1888 - 8.8.8.8
1889 - 172.172.172.172
1890 name: port-br-ctl
1891 bridge: br-ctl
1892 ovs_type: ovs_port
1893 type: ovs_port
1894 port_type: internal
1895 mtu: 65000
Filip Pytlounf5383a42015-10-06 16:28:32 +02001896
Petr Jediný8f8ae542017-07-13 16:19:12 +02001897Debian manual proto interfaces
1898
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001899When you are changing interface proto from static in up state
1900to manual, you may need to flush ip addresses. For example,
1901if you want to use the interface and the ip on the bridge.
1902This can be done by setting the ``ipflush_onchange`` to true.
Petr Jediný8f8ae542017-07-13 16:19:12 +02001903
1904.. code-block:: yaml
1905
1906 linux:
1907 network:
1908 interface:
1909 eth1:
1910 enabled: true
1911 type: eth
1912 proto: manual
1913 mtu: 9100
1914 ipflush_onchange: true
1915
Jiri Broulik1a191e32018-01-15 15:54:21 +01001916Debian static proto interfaces
1917
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001918When you are changing interface proto from dhcp in up state to
1919static, you may need to flush ip addresses and restart interface
1920to assign ip address from a managed file. For example, if you wantto
1921use the interface and the ip on the bridge. This can be done by
1922setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
1923param set to true.
Jiri Broulik1a191e32018-01-15 15:54:21 +01001924
1925.. code-block:: yaml
1926
1927 linux:
1928 network:
1929 interface:
1930 eth1:
1931 enabled: true
1932 type: eth
1933 proto: static
1934 address: 10.1.0.22
1935 netmask: 255.255.255.0
1936 ipflush_onchange: true
1937 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001938
Petr Jedinýd577cb52017-06-28 20:17:49 +02001939Concatinating and removing interface files
1940
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001941Debian based distributions have ``/etc/network/interfaces.d/``
1942directory, where you can store configuration of network
1943interfaces in separate files. You can concatinate the files
1944to the defined destination when needed, this operation removes
1945the file from the ``/etc/network/interfaces.d/``. If you just need
1946to remove iface files, you can use the ``remove_iface_files`` key.
Petr Jedinýd577cb52017-06-28 20:17:49 +02001947
1948.. code-block:: yaml
1949
1950 linux:
1951 network:
1952 concat_iface_files:
1953 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1954 dst: '/etc/network/interfaces'
1955 remove_iface_files:
1956 - '/etc/network/interfaces.d/90-custom.cfg'
1957
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001958Configure DHCP client
Petr Jedinýd577cb52017-06-28 20:17:49 +02001959
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001960None of the keys is mandatory, include only those you really need.
1961For full list of available options under send, supersede, prepend,
1962append refer to dhcp-options(5).
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001963
1964.. code-block:: yaml
1965
1966 linux:
1967 network:
1968 dhclient:
1969 enabled: true
1970 backoff_cutoff: 15
1971 initial_interval: 10
1972 reboot: 10
1973 retry: 60
1974 select_timeout: 0
1975 timeout: 120
1976 send:
1977 - option: host-name
1978 declaration: "= gethostname()"
1979 supersede:
1980 - option: host-name
1981 declaration: "spaceship"
1982 - option: domain-name
1983 declaration: "domain.home"
1984 #- option: arp-cache-timeout
1985 # declaration: 20
1986 prepend:
1987 - option: domain-name-servers
1988 declaration:
1989 - 8.8.8.8
1990 - 8.8.4.4
1991 - option: domain-search
1992 declaration:
1993 - example.com
1994 - eng.example.com
1995 #append:
1996 #- option: domain-name-servers
1997 # declaration: 127.0.0.1
1998 # ip or subnet to reject dhcp offer from
1999 reject:
2000 - 192.33.137.209
2001 - 10.0.2.0/24
2002 request:
2003 - subnet-mask
2004 - broadcast-address
2005 - time-offset
2006 - routers
2007 - domain-name
2008 - domain-name-servers
2009 - domain-search
2010 - host-name
2011 - dhcp6.name-servers
2012 - dhcp6.domain-search
2013 - dhcp6.fqdn
2014 - dhcp6.sntp-servers
2015 - netbios-name-servers
2016 - netbios-scope
2017 - interface-mtu
2018 - rfc3442-classless-static-routes
2019 - ntp-servers
2020 require:
2021 - subnet-mask
2022 - domain-name-servers
2023 # if per interface configuration required add below
2024 interface:
2025 ens2:
2026 initial_interval: 11
2027 reject:
2028 - 192.33.137.210
2029 ens3:
2030 initial_interval: 12
2031 reject:
2032 - 192.33.137.211
2033
Petr Michaleceb14b552017-06-01 10:27:05 +02002034Linux network systemd settings:
2035
2036.. code-block:: yaml
2037
2038 linux:
2039 network:
2040 ...
2041 systemd:
2042 link:
2043 10-iface-dmz:
2044 Match:
2045 MACAddress: c8:5b:67:fa:1a:af
2046 OriginalName: eth0
2047 Link:
2048 Name: dmz0
2049 netdev:
2050 20-bridge-dmz:
2051 match:
2052 name: dmz0
2053 network:
2054 mescription: bridge
2055 bridge: br-dmz0
2056 network:
2057 # works with lowercase, keys are by default capitalized
2058 40-dhcp:
2059 match:
2060 name: '*'
2061 network:
2062 DHCP: yes
2063
Petr Michalec10462bb2017-03-23 19:18:08 +01002064Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01002065
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002066Use ``/etc/environment`` for static system wide variable assignment
2067after boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002068
2069.. code-block:: yaml
2070
2071 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01002072 system:
2073 env:
2074 BOB_VARIABLE: Alice
2075 ...
2076 BOB_PATH:
2077 - /srv/alice/bin
2078 - /srv/bob/bin
2079 ...
2080 ftp_proxy: none
2081 http_proxy: http://global-http-proxy.host.local:8080
2082 https_proxy: ${linux:system:proxy:https}
2083 no_proxy:
2084 - 192.168.0.80
2085 - 192.168.1.80
2086 - .domain.com
2087 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02002088 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01002089 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002090 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01002091 ftp: ftp://proxy.host.local:2121
2092 http: http://proxy.host.local:3142
2093 https: https://proxy.host.local:3143
2094 noproxy:
2095 - .domain.com
2096 - .local
2097
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002098Configure the ``profile.d`` scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01002099
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002100The ``profile.d`` scripts are being sourced during ``.sh`` execution
2101and support variable expansion in opposite to /etc/environment global
2102settings in ``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01002103
2104.. code-block:: yaml
2105
2106 linux:
2107 system:
2108 profile:
2109 locales: |
2110 export LANG=C
2111 export LC_ALL=C
2112 ...
2113 vi_flavors.sh: |
2114 export PAGER=view
2115 export EDITOR=vim
2116 alias vi=vim
2117 shell_locales.sh: |
2118 export LANG=en_US
2119 export LC_ALL=en_US.UTF-8
2120 shell_proxies.sh: |
2121 export FTP_PROXY=ftp://127.0.3.3:2121
2122 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02002123
Dmitry Teselkina0d31d12018-09-04 14:43:09 +03002124
2125Configure login.defs parameters
2126-------------------------------
2127
2128.. code-block:: yaml
2129
2130 linux:
2131 system:
2132 login_defs:
2133 <opt_name>:
2134 enabled: true
2135 value: <opt_value>
2136
2137<opt_name> is a configurational option defined in 'man login.defs'.
2138<opt_name> is case sensitive, should be UPPERCASE only!
2139
2140
Filip Pytlounf5383a42015-10-06 16:28:32 +02002141Linux with hosts
2142
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002143Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
2144removing entries that are not defined in model except defaults
2145for both IPv4 and IPv6 localhost and hostname as well as FQDN.
Ales Komarek417e8c52017-08-25 15:10:29 +02002146
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002147We recommend using this option to verify that ``/etc/hosts``
2148is always in a clean state. However it is not enabled by default
2149for security reasons.
Filip Pytloun86506fe2017-01-26 14:36:16 +01002150
Filip Pytlounf5383a42015-10-06 16:28:32 +02002151.. code-block:: yaml
2152
2153 linux:
2154 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002155 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002156 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002157 # No need to define this one if purge_hosts is true
2158 hostname:
2159 address: 127.0.1.1
2160 names:
2161 - ${linux:network:fqdn}
2162 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02002163 node1:
2164 address: 192.168.10.200
2165 names:
2166 - node2.domain.com
2167 - service2.domain.com
2168 node2:
2169 address: 192.168.10.201
2170 names:
2171 - node2.domain.com
2172 - service2.domain.com
2173
Ales Komarek417e8c52017-08-25 15:10:29 +02002174Linux with hosts collected from mine
2175
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002176All DNS records defined within infrastrucuture
2177are passed to the local hosts records or any DNS server. Only
2178hosts with the ``grain`` parameter set to ``true`` will be propagated
2179to the mine.
Ales Komarek417e8c52017-08-25 15:10:29 +02002180
2181.. code-block:: yaml
2182
2183 linux:
2184 network:
2185 purge_hosts: true
2186 mine_dns_records: true
2187 host:
2188 node1:
2189 address: 192.168.10.200
2190 grain: true
2191 names:
2192 - node2.domain.com
2193 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01002194
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002195Set up ``resolvconf's basic resolver info``, e.g. nameservers, search/domain and options:
Filip Pytlounde9bea52016-01-11 15:39:10 +01002196
2197.. code-block:: yaml
2198
2199 linux:
2200 network:
2201 resolv:
2202 dns:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002203 - 8.8.4.4
2204 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01002205 domain: my.example.com
2206 search:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002207 - my.example.com
2208 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01002209 options:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002210 - ndots:5
2211 - timeout:2
2212 - attempts:2
Filip Pytlounde9bea52016-01-11 15:39:10 +01002213
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002214Set up custom TX queue length for tap interfaces:
Andrii Petrenko735761d2017-03-21 17:17:35 -07002215
2216.. code-block:: yaml
2217
2218 linux:
2219 network:
Dzmitry Stremkouskif76e8092020-09-14 17:41:49 +02002220 custom_txqueuelen
2221 tap:
2222 queue_length: 10000
2223 enabled: true
2224 device_filter: 'tap[0-9a-z\-]*'
2225 ten:
2226 enabled: false
2227 veth:
2228 queue_length: 20000
Andrii Petrenko735761d2017-03-21 17:17:35 -07002229
Michael Polenchukc37bd4a2019-04-22 15:20:03 +04002230Auto repair/re-attach libvirt's vnet interfaces:
2231
2232.. code-block:: yaml
2233
2234 linux:
2235 network:
2236 libvirt_vnet_repair: true
2237
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002238DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002239
2240**DPDK OVS NIC**
2241
2242.. code-block:: yaml
2243
2244 linux:
2245 network:
2246 bridge: openvswitch
2247 dpdk:
2248 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002249 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002250 openvswitch:
2251 pmd_cpu_mask: "0x6"
2252 dpdk_socket_mem: "1024,1024"
2253 dpdk_lcore_mask: "0x400"
2254 memory_channels: 2
2255 interface:
2256 dpkd0:
2257 name: ${_param:dpdk_nic}
2258 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002259 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002260 enabled: true
2261 type: dpdk_ovs_port
2262 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002263 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002264 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01002265 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002266 br-prv:
2267 enabled: true
2268 type: dpdk_ovs_bridge
Michael Polenchuk70147482018-12-29 16:46:50 +04002269 br-floating:
2270 enabled: true
2271 type: ovs_bridge
2272 name_servers:
2273 - 1.1.1.1
2274 - 9.9.9.9
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002275
2276**DPDK OVS Bond**
2277
2278.. code-block:: yaml
2279
2280 linux:
2281 network:
2282 bridge: openvswitch
2283 dpdk:
2284 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002285 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002286 openvswitch:
2287 pmd_cpu_mask: "0x6"
2288 dpdk_socket_mem: "1024,1024"
2289 dpdk_lcore_mask: "0x400"
2290 memory_channels: 2
2291 interface:
2292 dpdk_second_nic:
2293 name: ${_param:primary_second_nic}
2294 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002295 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002296 bond: dpdkbond0
2297 enabled: true
2298 type: dpdk_ovs_port
2299 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002300 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002301 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002302 dpdk_first_nic:
2303 name: ${_param:primary_first_nic}
2304 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002305 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002306 bond: dpdkbond0
2307 enabled: true
2308 type: dpdk_ovs_port
2309 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002310 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002311 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002312 dpdkbond0:
2313 enabled: true
2314 bridge: br-prv
2315 type: dpdk_ovs_bond
2316 mode: active-backup
2317 br-prv:
2318 enabled: true
2319 type: dpdk_ovs_bridge
2320
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01002321**DPDK OVS LACP Bond with vlan tag**
2322
2323.. code-block:: yaml
2324
2325 linux:
2326 network:
2327 bridge: openvswitch
2328 dpdk:
2329 enabled: true
2330 driver: uio
2331 openvswitch:
2332 pmd_cpu_mask: "0x6"
2333 dpdk_socket_mem: "1024,1024"
2334 dpdk_lcore_mask: "0x400"
2335 memory_channels: "2"
2336 interface:
2337 eth3:
2338 enabled: true
2339 type: eth
2340 proto: manual
2341 name: ${_param:tenant_first_nic}
2342 eth4:
2343 enabled: true
2344 type: eth
2345 proto: manual
2346 name: ${_param:tenant_second_nic}
2347 dpdk0:
2348 name: ${_param:tenant_first_nic}
2349 pci: "0000:81:00.0"
2350 driver: igb_uio
2351 bond: bond1
2352 enabled: true
2353 type: dpdk_ovs_port
2354 n_rxq: 2
2355 dpdk1:
2356 name: ${_param:tenant_second_nic}
2357 pci: "0000:81:00.1"
2358 driver: igb_uio
2359 bond: bond1
2360 enabled: true
2361 type: dpdk_ovs_port
2362 n_rxq: 2
2363 bond1:
2364 enabled: true
2365 bridge: br-prv
2366 type: dpdk_ovs_bond
2367 mode: balance-slb
2368 br-prv:
2369 enabled: true
2370 type: dpdk_ovs_bridge
2371 tag: ${_param:tenant_vlan}
2372 address: ${_param:tenant_address}
2373 netmask: ${_param:tenant_network_netmask}
2374
Jakub Pavlikaa759062017-03-13 15:57:26 +01002375**DPDK OVS bridge for VXLAN**
2376
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002377If VXLAN is used as tenant segmentation, IP address must
2378be set on ``br-prv``.
Jakub Pavlikaa759062017-03-13 15:57:26 +01002379
2380.. code-block:: yaml
2381
2382 linux:
2383 network:
2384 ...
2385 interface:
2386 br-prv:
2387 enabled: true
2388 type: dpdk_ovs_bridge
2389 address: 192.168.50.0
2390 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04002391 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01002392 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002393
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02002394**DPDK OVS bridge with Linux network interface**
2395
2396.. code-block:: yaml
2397
2398 linux:
2399 network:
2400 ...
2401 interface:
2402 eth0:
2403 type: eth
2404 ovs_bridge: br-prv
2405 ...
2406 br-prv:
2407 enabled: true
2408 type: dpdk_ovs_bridge
2409 ...
2410
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002411Linux storage
2412-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02002413
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002414Linux with mounted Samba:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002415
2416.. code-block:: yaml
2417
2418 linux:
2419 storage:
2420 enabled: true
2421 mount:
2422 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01002423 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002424 - path: /media/myuser/public/
2425 - device: //192.168.0.1/storage
2426 - file_system: cifs
2427 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
2428
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002429NFS mount:
Jiri Broulikb017f932017-03-31 13:55:36 +02002430
2431.. code-block:: yaml
2432
2433 linux:
2434 storage:
2435 enabled: true
2436 mount:
2437 nfs_glance:
2438 enabled: true
2439 path: /var/lib/glance/images
2440 device: 172.16.10.110:/var/nfs/glance
2441 file_system: nfs
2442 opts: rw,sync
2443
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002444File swap configuration:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002445
2446.. code-block:: yaml
2447
2448 linux:
2449 storage:
2450 enabled: true
2451 swap:
2452 file:
2453 enabled: true
2454 engine: file
2455 device: /swapfile
2456 size: 1024
2457
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002458Partition swap configuration:
Lachlan Evenson30676512016-01-22 15:43:28 -08002459
2460.. code-block:: yaml
2461
2462 linux:
2463 storage:
2464 enabled: true
2465 swap:
2466 partition:
2467 enabled: true
2468 engine: partition
2469 device: /dev/vg0/swap
2470
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002471LVM group ``vg1`` with one device and ``data`` volume mounted
2472into ``/mnt/data``.
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002473
2474.. code-block:: yaml
2475
2476 parameters:
2477 linux:
2478 storage:
Dzmitry Stremkouskif94b5852021-03-05 11:53:27 +01002479 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002480 mount:
2481 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01002482 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002483 device: /dev/vg1/data
2484 file_system: ext4
2485 path: /mnt/data
2486 lvm:
2487 vg1:
2488 enabled: true
2489 devices:
2490 - /dev/sdb
2491 volume:
2492 data:
2493 size: 40G
2494 mount: ${linux:storage:mount:data}
root3387f332019-01-11 08:55:32 +00002495 # When set they will take precedence over filters aget from volume groups.
2496 lvm_filters:
2497 10:
2498 enabled: True
2499 value: "a|loop|"
2500 20:
2501 enabled: True
2502 value: "r|/dev/hdc|"
2503 30:
2504 enabled: True
2505 value: "a|/dev/ide|"
2506 40:
2507 enabled: True
2508 value: "r|.*|"
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002509
Jakub Pavlik4f742142017-08-08 15:05:50 +02002510Create partitions on disk. Specify size in MB. It expects empty
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002511disk without any existing partitions.
2512Set ``startsector=1`` if you want to start partitions from ``2048``.
Jakub Pavlik4f742142017-08-08 15:05:50 +02002513
2514.. code-block:: yaml
2515
2516 linux:
2517 storage:
2518 disk:
2519 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01002520 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02002521 name: /dev/loop1
2522 type: gpt
2523 partitions:
2524 - size: 200 #size in MB
2525 type: fat32
2526 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02002527 mkfs: True
2528 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02002529 /dev/vda1:
2530 partitions:
2531 - size: 5
2532 type: ext2
2533 - size: 10
2534 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02002535
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002536Multipath with Fujitsu Eternus DXL:
Ales Komareka634f4b2016-10-02 13:11:04 +02002537
2538.. code-block:: yaml
2539
2540 parameters:
2541 linux:
2542 storage:
2543 multipath:
2544 enabled: true
2545 blacklist_devices:
2546 - /dev/sda
2547 - /dev/sdb
2548 backends:
2549 - fujitsu_eternus_dxl
2550
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002551Multipath with Hitachi VSP 1000:
Ales Komareka634f4b2016-10-02 13:11:04 +02002552
2553.. code-block:: yaml
2554
2555 parameters:
2556 linux:
2557 storage:
2558 multipath:
2559 enabled: true
2560 blacklist_devices:
2561 - /dev/sda
2562 - /dev/sdb
2563 backends:
2564 - hitachi_vsp1000
2565
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002566Multipath with IBM Storwize:
Ales Komareka634f4b2016-10-02 13:11:04 +02002567
2568.. code-block:: yaml
2569
2570 parameters:
2571 linux:
2572 storage:
2573 multipath:
2574 enabled: true
2575 blacklist_devices:
2576 - /dev/sda
2577 - /dev/sdb
2578 backends:
2579 - ibm_storwize
2580
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002581Multipath with multiple backends:
Ales Komareka634f4b2016-10-02 13:11:04 +02002582
2583.. code-block:: yaml
2584
2585 parameters:
2586 linux:
2587 storage:
2588 multipath:
2589 enabled: true
2590 blacklist_devices:
2591 - /dev/sda
2592 - /dev/sdb
2593 - /dev/sdc
2594 - /dev/sdd
2595 backends:
2596 - ibm_storwize
2597 - fujitsu_eternus_dxl
2598 - hitachi_vsp1000
2599
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002600PAM LDAP integration:
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002601
2602.. code-block:: yaml
2603
2604 parameters:
2605 linux:
2606 system:
2607 auth:
2608 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02002609 mkhomedir:
2610 enabled: true
2611 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002612 ldap:
2613 enabled: true
2614 binddn: cn=bind,ou=service_users,dc=example,dc=com
2615 bindpw: secret
2616 uri: ldap://127.0.0.1
2617 base: ou=users,dc=example,dc=com
2618 ldap_version: 3
2619 pagesize: 65536
2620 referrals: off
2621 filter:
2622 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2623 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2624 group: (&(objectClass=group)(gidNumber=*))
2625
Gleb Galkin93b9ae92018-10-18 13:57:30 +03002626PAM duo 2FA integration
2627
2628.. code-block:: yaml
2629
2630 parameters:
2631 linux:
2632 system:
2633 auth:
2634 enabled: true
2635 duo:
2636 enabled: true
2637 duo_host: localhost
2638 duo_ikey: DUO-INTEGRATION-KEY
2639 duo_skey: DUO-SECRET-KEY
2640
2641duo package version may be specified (optional)
2642
2643.. code-block:: yaml
2644
2645 linux:
2646 system:
2647 package:
2648 duo-unix:
2649 version: 1.10.1-0
2650
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002651Disabled multipath (the default setup):
Ales Komareka634f4b2016-10-02 13:11:04 +02002652
2653.. code-block:: yaml
2654
2655 parameters:
2656 linux:
2657 storage:
2658 multipath:
2659 enabled: false
2660
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002661Linux with local loopback device:
Simon Pasquier375001e2017-01-26 13:22:33 +01002662
2663.. code-block:: yaml
2664
2665 linux:
2666 storage:
2667 loopback:
2668 disk1:
2669 file: /srv/disk1
2670 size: 50G
2671
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002672External config generation
2673--------------------------
2674
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002675You are able to use config support metadata between formulas
2676and only generate configuration files for external use, for example, Docker, and so on.
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002677
2678.. code-block:: yaml
2679
2680 parameters:
2681 linux:
2682 system:
2683 config:
2684 pillar:
2685 jenkins:
2686 master:
2687 home: /srv/volumes/jenkins
2688 approved_scripts:
2689 - method java.net.URL openConnection
2690 credentials:
2691 - type: username_password
2692 scope: global
2693 id: test
2694 desc: Testing credentials
2695 username: test
2696 password: test
2697
Vladimir Ereminccf28842017-04-10 23:52:10 +03002698Netconsole Remote Kernel Logging
2699--------------------------------
2700
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002701Netconsole logger can be configured for the configfs-enabled kernels
2702(``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
2703applies both in runtime (if network is already configured),
2704and on-boot after an interface initialization.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002705
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002706.. note::
2707
2708 * Receiver can be located only on the same L3 domain
2709 (or you need to configure gateway MAC manually).
2710 * The Receiver MAC is detected only on configuration time.
2711 * Using broadcast MAC is not recommended.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002712
2713.. code-block:: yaml
2714
2715 parameters:
2716 linux:
2717 system:
2718 netconsole:
2719 enabled: true
2720 port: 514 (optional)
2721 loglevel: debug (optional)
2722 target:
2723 192.168.0.1:
2724 interface: bond0
2725 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02002726
Dzmitry Stremkouskid1a268b2018-10-03 16:36:04 +02002727Check network params on the environment
2728---------------------------------------
2729
2730Grab nics and nics states
2731
2732.. code-block:: bash
2733
2734 salt osd001\* net_checks.get_nics
2735
2736**Example of system output:**
2737
2738.. code-block:: bash
2739
2740 osd001.domain.com:
2741 |_
2742 - bond0
2743 - None
2744 - 1e:c8:64:42:23:b9
2745 - 0
2746 - 1500
2747 |_
2748 - bond1
2749 - None
2750 - 3c:fd:fe:27:3b:00
2751 - 1
2752 - 9100
2753 |_
2754 - fourty1
2755 - None
2756 - 3c:fd:fe:27:3b:00
2757 - 1
2758 - 9100
2759 |_
2760 - fourty2
2761 - None
2762 - 3c:fd:fe:27:3b:02
2763 - 1
2764 - 9100
2765
2766Grab 10G nics PCI addresses for hugepages setup
2767
2768.. code-block:: bash
2769
2770 salt cmp001\* net_checks.get_ten_pci
2771
2772**Example of system output:**
2773
2774.. code-block:: bash
2775
2776 cmp001.domain.com:
2777 |_
2778 - ten1
2779 - 0000:19:00.0
2780 |_
2781 - ten2
2782 - 0000:19:00.1
2783 |_
2784 - ten3
2785 - 0000:19:00.2
2786 |_
2787 - ten4
2788 - 0000:19:00.3
2789
2790Grab ip address for an interface
2791
2792.. code-block:: bash
2793
2794 salt cmp001\* net_checks.get_ip iface=one4
2795
2796**Example of system output:**
2797
2798.. code-block:: bash
2799
2800 cmp001.domain.com:
2801 10.200.177.101
2802
2803Grab ip addresses map
2804
2805.. code-block:: bash
2806
2807 salt-call net_checks.nodes_addresses
2808
2809**Example of system output:**
2810
2811.. code-block:: bash
2812
2813 local:
2814 |_
2815 - cid01.domain.com
2816 |_
2817 |_
2818 - pxe
2819 - 10.200.177.91
2820 |_
2821 - control
2822 - 10.200.178.91
2823 |_
2824 - cmn02.domain.com
2825 |_
2826 |_
2827 - storage_access
2828 - 10.200.181.67
2829 |_
2830 - pxe
2831 - 10.200.177.67
2832 |_
2833 - control
2834 - 10.200.178.67
2835 |_
2836 - cmp010.domain.com
2837 |_
2838 |_
2839 - pxe
2840 - 10.200.177.110
2841 |_
2842 - storage_access
2843 - 10.200.181.110
2844 |_
2845 - control
2846 - 10.200.178.110
2847 |_
2848 - vxlan
2849 - 10.200.179.110
2850
2851Verify full mesh connectivity
2852
2853.. code-block:: bash
2854
2855 salt-call net_checks.ping_check
2856
2857**Example of positive system output:**
2858
2859.. code-block:: bash
2860
2861 ['PASSED']
2862 [INFO ] ['PASSED']
2863 local:
2864 True
2865
2866**Example of system output in case of failure:**
2867
2868.. code-block:: bash
2869
2870 FAILED
2871 [ERROR ] FAILED
2872 ['control: 10.0.1.92 -> 10.0.1.224: Failed']
2873 ['control: 10.0.1.93 -> 10.0.1.224: Failed']
2874 ['control: 10.0.1.51 -> 10.0.1.224: Failed']
2875 ['control: 10.0.1.102 -> 10.0.1.224: Failed']
2876 ['control: 10.0.1.13 -> 10.0.1.224: Failed']
2877 ['control: 10.0.1.81 -> 10.0.1.224: Failed']
2878 local:
2879 False
2880
2881For this feature to work, please mark addresses with some role.
2882Otherwise 'default' role is assumed and mesh would consist of all
2883addresses on the environment.
2884
2885Mesh mark is needed only for interfaces which are enabled and have
2886ip address assigned.
2887
2888Checking dhcp pxe network meaningless, as it is used for salt
2889master vs minion communications, therefore treated as checked.
2890
2891.. code-block:: yaml
2892
2893 parameters:
2894 linux:
2895 network:
2896 interface:
2897 ens3:
2898 enabled: true
2899 type: eth
2900 proto: static
2901 address: ${_param:deploy_address}
2902 netmask: ${_param:deploy_network_netmask}
2903 gateway: ${_param:deploy_network_gateway}
2904 mesh: pxe
2905
2906Check pillars for ip address duplicates
2907
2908.. code-block:: bash
2909
2910 salt-call net_checks.verify_addresses
2911
2912**Example of positive system output:**
2913
2914.. code-block:: bash
2915
2916 ['PASSED']
2917 [INFO ] ['PASSED']
2918 local:
2919 True
2920
2921**Example of system output in case of failure:**
2922
2923.. code-block:: bash
2924
2925 FAILED. Duplicates found
2926 [ERROR ] FAILED. Duplicates found
2927 ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2928 [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2929 local:
2930 False
2931
2932Generate csv report for the env
2933
2934.. code-block:: bash
2935
2936 salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
2937 | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
2938 | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
2939
2940**Example of system output:**
2941
2942.. code-block:: bash
2943
2944 server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
2945 cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
2946 cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
2947 cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
2948 cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
2949 cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
2950 cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
2951 cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
2952 cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
2953 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
2954 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
2955 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
2956 cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
2957 cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
2958 cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
2959 ...
2960
Filip Pytlounf5383a42015-10-06 16:28:32 +02002961Usage
2962=====
2963
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002964Set MTU of the eth0 network interface to 1400:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002965
2966.. code-block:: bash
2967
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002968 ip link set dev eth0 mtu 1400
Filip Pytlounf5383a42015-10-06 16:28:32 +02002969
Denis Egorenko2e6ad0f2019-10-02 14:57:10 +04002970Switch Kernel from non-HWE to HWE
2971==================================
2972
2973It is possible to switch Kernel from non-HWE to HWE by using module
2974linux_kernel_switch. It has few methods:
2975
2976* check_hwe_kernel
2977* switch_kernel
2978* rollback_switch_kernel
2979
2980Method ``check_hwe_kernel`` allows to check whether HWE kernel installed
2981or not:
2982
2983.. code-block:: bash
2984
2985 salt <target> linux_kernel_switch.check_hwe_kernel
2986
2987Output for case HWE is installed:
2988
2989.. code-bloc:: bash
2990
2991 kvm02.cluster-env.local:
2992 ----------
2993 linux-image-extra-virtual-hwe-16.04:
2994 ----------
2995 linux-image-extra-virtual-hwe-16.04:
2996 ----------
2997 architecture:
2998 amd64
2999 description:
3000 Extra drivers for Virtual Linux kernel image
3001 This package will always depend on linux-image-generic.
3002 group:
3003 kernel
3004 install_date:
3005 2019-10-01T11:50:15Z
3006 name:
3007 linux-image-extra-virtual-hwe-16.04
3008 packager:
3009 Ubuntu Kernel Team <kernel-team@lists.ubuntu.com>
3010 source:
3011 linux-meta-hwe
3012 version:
3013 4.15.0.54.75
3014 ...
3015
3016Output for case HWE is not installed:
3017
3018.. code-bloc:: bash
3019
3020 kvm02.cluster-env.local:
3021 ----------
3022 linux-image-extra-virtual-hwe-16.04:
3023 Not installed!
3024 linux-image-generic-hwe-16.04:
3025 Not installed!
3026
3027Method ``switch_kernel`` allows you to switch from non-HWE to HWE. It has
3028two options: ``dry_run`` - to check what packages are going to be installed or
3029removed and ``only_kernel`` - install only Kernel image packages without other
3030HWE packages.
3031
3032Method ``rollback_switch_kernel`` allows you to rollback method
3033``switch_kernel`` which was executed successfully previously. Option
3034``dry_run`` - to check what packages are going to be installed/removed.
3035
Filip Pytlounf5383a42015-10-06 16:28:32 +02003036Read more
3037=========
3038
3039* https://www.archlinux.org/
3040* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu