blob: 5a1cfcdad5d709dc12b68ca710d66106a887c1b6 [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
Taras Khlivnyakd0a46112021-07-12 13:32:17 +0300285Set timestamp format to bash history
286Default value
287 bash_history_timestamp: '%d/%m/%y %T'
288
289 - %d day of month (e.g., 01)
290 - %m month (01..12)
291 - %y last two digits of year (00..99)
292 - %T time; same as %H:%M:%S
293
294All available parameters you can find by 'man date'
295
296.. code-block:: yaml
297
298 linux:
299 system:
300 ...
301 shell:
302 bash_history_timestamp: '%d/%m/%y %T'
303 ...
304
305
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300306Linux with package, latest version:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200307
308.. code-block:: yaml
309
310 linux:
311 system:
312 ...
313 package:
314 package-name:
315 version: latest
316
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300317Linux with package from certail repo, version with no upgrades:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200318
319.. code-block:: yaml
320
321 linux:
322 system:
323 ...
324 package:
325 package-name:
326 version: 2132.323
327 repo: 'custom-repo'
328 hold: true
329
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300330Linux with package from certail repo, version with no GPG
331verification:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200332
333.. code-block:: yaml
334
335 linux:
336 system:
337 ...
338 package:
339 package-name:
340 version: 2132.323
341 repo: 'custom-repo'
342 verify: false
343
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300344Linux with autoupdates (automatically install security package
345updates):
Bruno Binet69a9d8d2017-02-16 22:34:32 +0100346
347.. code-block:: yaml
348
349 linux:
350 system:
351 ...
352 autoupdates:
353 enabled: true
354 mail: root@localhost
355 mail_only_on_error: true
356 remove_unused_dependencies: false
357 automatic_reboot: true
358 automatic_reboot_time: "02:00"
359
Dmitry Teselkin0f084a02018-08-29 14:46:38 +0300360Managing cron tasks
361-------------------
362
363There are two data structures that are related to managing cron itself and
364cron tasks:
365
366.. code-block:: yaml
367
368 linux:
369 system:
370 cron:
371
372and
373
374.. code-block:: yaml
375
376 linux:
377 system:
378 job:
379
380`linux:system:cron` manages cron packages, services, and '/etc/cron.allow' file.
381
382'deny' files are managed the only way - we're ensuring they are absent, that's
383a requirement from CIS 5.1.8
384
385'cron' pillar structure is the following:
386
387.. code-block:: yaml
388
389 linux:
390 system:
391 cron:
392 enabled: true
393 pkgs: [ <cron packages> ]
394 services: [ <cron services> ]
395 user:
396 <username>:
397 enabled: true
398
399To add user to '/etc/cron.allow' use 'enabled' key as shown above.
400
401'/etc/cron.deny' is not managed as CIS 5.1.8 requires it was removed.
402
403A user would be ignored if any of the following is true:
404* user is disabled in `linux:system:user:<username>`
405* user is disabled in `linux:system:cron:user:<username>`
406
407`linux:system:job` manages individual cron tasks.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300408
409By default, it will use name as an identifier, unless identifier key is
Filip Pytloun91222222017-08-04 10:55:27 +0200410explicitly set or False (then it will use Salt's default behavior which is
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300411identifier same as command resulting in not being able to change it):
Filip Pytlounf5383a42015-10-06 16:28:32 +0200412
413.. code-block:: yaml
414
415 linux:
416 system:
417 ...
418 job:
419 cmd1:
420 command: '/cmd/to/run'
Filip Pytloun91222222017-08-04 10:55:27 +0200421 identifier: cmd1
Filip Pytlounf5383a42015-10-06 16:28:32 +0200422 enabled: true
423 user: 'root'
424 hour: 2
425 minute: 0
426
Dmitry Teselkin0f084a02018-08-29 14:46:38 +0300427Managing 'at' tasks
428-------------------
429
430Pillar for managing `at` tasks is similar to one for `cron` tasks:
431
432.. code-block:: yaml
433
434 linux:
435 system:
436 at:
437 enabled: true
438 pkgs: [ <at packages> ]
439 services: [ <at services> ]
440 user:
441 <username>:
442 enabled: true
443
444To add a user to '/etc/at.allow' use 'enabled' key as shown above.
445
446'/etc/at.deny' is not managed as CIS 5.1.8 requires it was removed.
447
448A user will be ignored if any of the following is true:
449* user is disabled in `linux:system:user:<username>`
450* user is disabled in `linux:system:at:user:<username>`
451
452
Filip Pytlound0a29e72015-11-30 15:23:34 +0100453Linux security limits (limit sensu user memory usage to max 1GB):
454
455.. code-block:: yaml
456
457 linux:
458 system:
459 ...
460 limit:
461 sensu:
462 enabled: true
463 domain: sensu
464 limits:
465 - type: hard
466 item: as
467 value: 1000000
468
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300469Enable autologin on ``tty1`` (may work only for Ubuntu 14.04):
Filip Pytloun7fee0542015-10-15 11:19:24 +0200470
471.. code-block:: yaml
472
473 linux:
474 system:
475 console:
476 tty1:
477 autologin: root
Filip Pytloun281d0202016-01-29 14:03:51 +0100478 # Enable serial console
479 ttyS0:
480 autologin: root
481 rate: 115200
482 term: xterm
Filip Pytloun7fee0542015-10-15 11:19:24 +0200483
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300484To disable set autologin to ``false``.
Filip Pytloun7fee0542015-10-15 11:19:24 +0200485
Filip Pytloun7731b852016-02-01 11:13:47 +0100486Set ``policy-rc.d`` on Debian-based systems. Action can be any available
487command in ``while true`` loop and ``case`` context.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300488Following will disallow dpkg to stop/start services for the Cassandra
489package automatically:
Filip Pytloun7731b852016-02-01 11:13:47 +0100490
491.. code-block:: yaml
492
493 linux:
494 system:
495 policyrcd:
496 - package: cassandra
497 action: exit 101
498 - package: '*'
499 action: switch
500
Filip Pytlounc49445a2016-04-04 14:23:20 +0200501Set system locales:
502
503.. code-block:: yaml
504
505 linux:
506 system:
507 locale:
508 en_US.UTF-8:
509 default: true
Filip Pytlounee1745f2016-04-04 17:39:41 +0200510 "cs_CZ.UTF-8 UTF-8":
Filip Pytlounc49445a2016-04-04 14:23:20 +0200511 enabled: true
512
Andrey Shestakove7cca052017-05-24 23:06:24 +0300513Systemd settings:
514
515.. code-block:: yaml
516
517 linux:
518 system:
519 ...
520 systemd:
521 system:
522 Manager:
523 DefaultLimitNOFILE: 307200
524 DefaultLimitNPROC: 307200
525 user:
526 Manager:
527 DefaultLimitCPU: 2
528 DefaultLimitNPROC: 4
529
Filip Pytloun8b2131e2017-11-08 13:29:03 +0100530Ensure presence of directory:
531
532.. code-block:: yaml
533
534 linux:
535 system:
536 directory:
537 /tmp/test:
538 user: root
539 group: root
540 mode: 700
541 makedirs: true
542
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300543Ensure presence of file by specifying its source:
Richard Felkl2e07d652018-01-19 10:19:06 +0100544
545.. code-block:: yaml
546
547 linux:
548 system:
549 file:
550 /tmp/test.txt:
551 source: http://example.com/test.txt
Richard Felklf40599a2018-02-06 22:56:41 +0100552 user: root #optional
553 group: root #optional
554 mode: 700 #optional
555 dir_mode: 700 #optional
556 encoding: utf-8 #optional
557 hash: <<hash>> or <<URI to hash>> #optional
558 makedirs: true #optional
559
560 linux:
561 system:
562 file:
563 test.txt:
564 name: /tmp/test.txt
565 source: http://example.com/test.txt
Richard Felkl2e07d652018-01-19 10:19:06 +0100566
Gabor Orosz35815c02018-09-07 17:31:05 +0200567 linux:
568 system:
569 file:
570 test2:
571 name: /tmp/test2.txt
572 source: http://example.com/test2.jinja
573 template: jinja
574
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300575Ensure presence of file by specifying its contents:
Richard Felkl2e07d652018-01-19 10:19:06 +0100576
577.. code-block:: yaml
578
579 linux:
580 system:
581 file:
582 /tmp/test.txt:
583 contents: |
584 line1
585 line2
Richard Felklf40599a2018-02-06 22:56:41 +0100586
587 linux:
588 system:
589 file:
590 /tmp/test.txt:
591 contents_pillar: linux:network:hostname
592
593 linux:
594 system:
595 file:
596 /tmp/test.txt:
597 contents_grains: motd
598
Ivan Berezovskiy25e177d2019-07-22 13:14:14 +0400599Ensure presence of file by specifying its secured source:
600
601.. code-block:: yaml
602
603 linux:
604 system:
605 file:
606 /tmp/test.txt:
607 secured_source:
608 protocol: http #optional
609 user: foo
610 password: bar
611 url: example.com/test.txt
612 secured_hash: #optional
613 url: example.com/test.txt.md5
614 user: root #optional
615 group: root #optional
616 mode: 700 #optional
617 dir_mode: 700 #optional
618 encoding: utf-8 #optional
619 makedirs: true #optional
620
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300621Ensure presence of file to be serialized through one of the
622serializer modules (see:
623https://docs.saltstack.com/en/latest/ref/serializers/all/index.html):
Bruno Binet9c2fe222018-06-08 16:57:32 +0200624
625.. code-block:: yaml
626
627 linux:
628 system:
629 file:
630 /tmp/test.json:
631 serialize: json
632 contents:
633 foo: 1
634 bar: 'bar'
635
Filip Pytloun281034a2016-01-04 18:06:22 +0100636Kernel
637~~~~~~
638
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300639Install always up to date LTS kernel and headers from Ubuntu Trusty:
Filip Pytloun281034a2016-01-04 18:06:22 +0100640
641.. code-block:: yaml
642
643 linux:
644 system:
645 kernel:
646 type: generic
647 lts: trusty
648 headers: true
649
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300650Load kernel modules and add them to ``/etc/modules``:
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100651
652.. code-block:: yaml
653
654 linux:
655 system:
656 kernel:
657 modules:
658 - nf_conntrack
659 - tp_smapi
660 - 8021q
661
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300662Configure or blacklist kernel modules with additional options to
663``/etc/modprobe.d`` following example will add
664``/etc/modprobe.d/nf_conntrack.conf`` file with line
665``options nf_conntrack hashsize=262144``:
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300666
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300667'option' can be a mapping (with 'enabled' and 'value' keys) or a scalar.
668
669Example for 'scalar' option value:
670
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300671.. code-block:: yaml
672
673 linux:
674 system:
675 kernel:
676 module:
677 nf_conntrack:
678 option:
679 hashsize: 262144
680
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300681Example for 'mapping' option value:
682
683.. code-block:: yaml
684
685 linux:
686 system:
687 kernel:
688 module:
689 nf_conntrack:
690 option:
691 hashsize:
692 enabled: true
693 value: 262144
694
695NOTE: 'enabled' key is optional and is True by default.
696
697Blacklist a module:
698
699.. code-block:: yaml
700
701 linux:
702 system:
703 kernel:
704 module:
705 nf_conntrack:
706 blacklist: true
707
708A module can have a number of aliases, wildcards are allowed.
709Define an alias for a module:
710
711.. code-block:: yaml
712
713 linux:
714 system:
715 kernel:
716 module:
717 nf_conntrack:
718 alias:
719 nfct:
720 enabled: true
721 "nf_conn*":
722 enabled: true
723
724NOTE: 'enabled' key is mandatory as there are no other keys exist.
725
726Execute custom command instead of 'insmod' when inserting a module:
727
728.. code-block:: yaml
729
730 linux:
731 system:
732 kernel:
733 module:
734 nf_conntrack:
735 install:
736 enabled: true
737 command: /bin/true
738
739NOTE: 'enabled' key is optional and is True by default.
740
741Execute custom command instead of 'rmmod' when removing a module:
742
743.. code-block:: yaml
744
745 linux:
746 system:
747 kernel:
748 module:
749 nf_conntrack:
750 remove:
751 enabled: true
752 command: /bin/true
753
754NOTE: 'enabled' key is optional and is True by default.
755
756Define module dependencies:
757
758.. code-block:: yaml
759
760 linux:
761 system:
762 kernel:
763 module:
764 nf_conntrack:
765 softdep:
766 pre:
767 1:
768 enabled: true
769 value: a
770 2:
771 enabled: true
772 value: b
773 3:
774 enabled: true
775 value: c
776 post:
777 1:
778 enabled: true
779 value: x
780 2:
781 enabled: true
782 value: y
783 3:
784 enabled: true
785 value: z
786
787NOTE: 'enabled' key is optional and is True by default.
788
789
Filip Pytloun281034a2016-01-04 18:06:22 +0100790Install specific kernel version and ensure all other kernel packages are
791not present. Also install extra modules and headers for this kernel:
792
793.. code-block:: yaml
794
795 linux:
796 system:
797 kernel:
798 type: generic
799 extra: true
800 headers: true
801 version: 4.2.0-22
802
Denis Egorenko567aa202019-11-06 14:02:00 +0400803Also it is possible to install Kernel with Hardware Enablement or virtual
804kernel packages. For example, for Xenial:
805
806.. code-block:: yaml
807
808 linux:
809 system:
810 kernel:
811 type: generic
812 extra: true
813 headers: true
814 version: 4.15.0-65
815 hwe:
816 type: hwe
817 version: 16.04
818 kernel_version: 4.15.0.65
819
820Set `linux:system:kernel:hwe:type:virtual` if you need Virtual kernel packages.
821
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300822Systcl kernel parameters:
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100823
824.. code-block:: yaml
825
826 linux:
827 system:
828 kernel:
829 sysctl:
830 net.ipv4.tcp_keepalive_intvl: 3
831 net.ipv4.tcp_keepalive_time: 30
832 net.ipv4.tcp_keepalive_probes: 8
833
Michael Polenchukebf55522018-01-25 13:22:39 +0400834Configure kernel boot options:
835
836.. code-block:: yaml
837
838 linux:
839 system:
840 kernel:
841 boot_options:
842 - elevator=deadline
843 - spectre_v2=off
844 - nopti
845
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100846CPU
847~~~
848
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300849Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100850
851.. code-block:: yaml
852
853 linux:
854 system:
855 cpu:
856 governor: performance
857
Nick Metzf04f5f32018-01-08 15:25:04 +0100858
Jiri Broulik303905d2018-01-11 14:12:48 +0100859CGROUPS
860~~~~~~~
861
862Setup linux cgroups:
863
864.. code-block:: yaml
865
866 linux:
867 system:
868 cgroup:
869 enabled: true
870 group:
871 ceph_group_1:
872 controller:
873 cpu:
874 shares:
875 value: 250
876 cpuacct:
877 usage:
878 value: 0
879 cpuset:
880 cpus:
881 value: 1,2,3
882 memory:
883 limit_in_bytes:
884 value: 2G
885 memsw.limit_in_bytes:
886 value: 3G
887 mapping:
888 subjects:
889 - '@ceph'
890 generic_group_1:
891 controller:
892 cpu:
893 shares:
894 value: 250
895 cpuacct:
896 usage:
897 value: 0
898 mapping:
899 subjects:
900 - '*:firefox'
901 - 'student:cp'
902
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300903Shared libraries
Nick Metzf04f5f32018-01-08 15:25:04 +0100904~~~~~~~~~~~~~~~~
905
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300906Set additional shared library to Linux system library path:
Nick Metzf04f5f32018-01-08 15:25:04 +0100907
908.. code-block:: yaml
909
910 linux:
911 system:
912 ld:
913 library:
914 java:
915 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
916 - /opt/java/jre/lib/amd64/server
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200917
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200918Certificates
919~~~~~~~~~~~~
920
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300921Add certificate authority into system trusted CA bundle:
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200922
923.. code-block:: yaml
924
925 linux:
926 system:
927 ca_certificates:
928 mycert: |
929 -----BEGIN CERTIFICATE-----
930 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
931 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
932 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
933 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
934 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
935 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
936 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
937 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
938 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
939 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
940 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
941 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
942 -----END CERTIFICATE-----
943
Filip Pytloun361096c2017-08-23 10:57:20 +0200944Sysfs
945~~~~~
946
947Install sysfsutils and set sysfs attributes:
948
949.. code-block:: yaml
950
951 linux:
952 system:
953 sysfs:
954 scheduler:
955 block/sda/queue/scheduler: deadline
956 power:
957 mode:
958 power/state: 0660
959 owner:
960 power/state: "root:power"
961 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
962
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200963Optional: You can also use list that will ensure order of items.
964
965.. code-block:: yaml
966
967 linux:
968 system:
969 sysfs:
970 scheduler:
971 block/sda/queue/scheduler: deadline
972 power:
973 - mode:
974 power/state: 0660
975 - owner:
976 power/state: "root:power"
977 - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
978
Martin Polreich148e1b82018-09-13 15:54:25 +0200979Sysfs definition with disabled automatic write. Attributes are saved
980to configuration, but are not applied during the run.
981Thay will be applied automatically after the reboot.
982
983
984.. code-block:: yaml
985
986 linux:
987 system:
988 sysfs:
989 enable_apply: false
990 scheduler:
991 block/sda/queue/scheduler: deadline
992
993.. note:: The `enable_apply` parameter defaults to `True` if not defined.
994
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100995Huge Pages
996~~~~~~~~~~~~
997
998Huge Pages give a performance boost to applications that intensively deal
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300999with memory allocation/deallocation by decreasing memory fragmentation:
Jakub Pavlikb148c8c2017-02-12 21:30:48 +01001000
1001.. code-block:: yaml
1002
1003 linux:
1004 system:
1005 kernel:
1006 hugepages:
1007 small:
1008 size: 2M
1009 count: 107520
1010 mount_point: /mnt/hugepages_2MB
Michael Polenchukd9369fe2018-05-08 17:53:08 +04001011 mount: false/true # default is true (mount immediately) / false (just save in the fstab)
Jakub Pavlikb148c8c2017-02-12 21:30:48 +01001012 large:
1013 default: true # default automatically mounted
1014 size: 1G
1015 count: 210
1016 mount_point: /mnt/hugepages_1GB
1017
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001018.. note:: Not recommended to use both pagesizes concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +01001019
Jakub Pavlik5398d872017-02-13 22:30:47 +01001020Intel SR-IOV
1021~~~~~~~~~~~~
1022
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001023PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV)
1024specification defines a standardized mechanism to virtualize
1025PCIe devices. The mechanism can virtualize a single PCIe
1026Ethernet controller to appear as multiple PCIe devices:
Jakub Pavlik5398d872017-02-13 22:30:47 +01001027
1028.. code-block:: yaml
1029
1030 linux:
1031 system:
1032 kernel:
1033 sriov: True
1034 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
1035 rc:
1036 local: |
1037 #!/bin/sh -e
1038 # Enable 7 VF on eth1
1039 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
1040 exit 0
1041
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001042Isolate CPU options
1043~~~~~~~~~~~~~~~~~~~
1044
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001045Remove the specified CPUs, as defined by the cpu_number values, from
1046the general kernel SMP balancing and scheduler algroithms. The only
1047way to move a process onto or off an *isolated* CPU is via the CPU
1048affinity syscalls. ``cpu_number begins`` at ``0``, so the
1049maximum value is ``1`` less than the number of CPUs on the system.:
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001050
1051.. code-block:: yaml
1052
1053 linux:
1054 system:
1055 kernel:
1056 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +01001057
Filip Pytlounf5383a42015-10-06 16:28:32 +02001058Repositories
1059~~~~~~~~~~~~
1060
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001061RedHat-based Linux with additional OpenStack repo:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001062
1063.. code-block:: yaml
1064
1065 linux:
1066 system:
1067 ...
1068 repo:
1069 rdo-icehouse:
1070 enabled: true
1071 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
1072 pgpcheck: 0
1073
1074Ensure system repository to use czech Debian mirror (``default: true``)
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001075Also pin it's packages with priority ``900``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001076
1077.. code-block:: yaml
1078
1079 linux:
1080 system:
1081 repo:
1082 debian:
1083 default: true
1084 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
1085 # Import signing key from URL if needed
1086 key_url: "http://dummy.com/public.gpg"
1087 pin:
1088 - pin: 'origin "ftp.cz.debian.org"'
1089 priority: 900
1090 package: '*'
1091
azvyagintseva3a73d02018-12-06 14:49:58 +02001092Sometimes better to use one pining rule file, to decrease mistaken
1093ordering. You can use those option ``system:apt:preferences``, which would add opts into
1094``/etc/apt/preferences`` file:
1095
1096.. code-block:: yaml
1097
1098 parameters:
1099 linux:
1100 system:
1101 apt:
1102 preferences:
1103 enabled: true
1104 rules:
1105 100:
1106 enabled: true
1107 name: 'some origin pin'
1108 pin: 'release o=Debian'
1109 priority: 1100
1110 package: '*'
1111
1112
azvyagintsev4494a472018-09-14 19:19:23 +03001113If you need to add multiple pin rules for one repo, please use new,ordered definition format
1114('pinning' definition will be in priotity to use):
1115
1116.. code-block:: yaml
1117
1118 linux:
1119 system:
1120 repo:
1121 mcp_saltstack:
1122 source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main"
1123 architectures: amd64
1124 clean_file: true
1125 pinning:
1126 10:
1127 enabled: true
1128 pin: 'release o=SaltStack'
1129 priority: 50
1130 package: 'libsodium18'
1131 20:
1132 enabled: true
1133 pin: 'release o=SaltStack'
1134 priority: 1100
1135 package: '*'
1136
1137
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001138.. note:: For old Ubuntu releases (<xenial)
azvyagintsevff089d22018-07-27 16:52:34 +02001139 extra packages for apt transport, like ``apt-transport-https``
1140 may be required to be installed manually.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001141 (Chicken-eggs issue: we need to install packages to
azvyagintsevff089d22018-07-27 16:52:34 +02001142 reach repo from where they should be installed)
1143 Otherwise, you still can try 'fortune' and install prereq.packages before
1144 any repo configuration, using list of requires in map.jinja.
1145
1146
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001147Disabling any prerequisite packages installation:
1148
azvyagintsevff089d22018-07-27 16:52:34 +02001149You can simply drop any package pre-installation (before system.linux.repo
1150will be processed) via cluster lvl:
1151
1152.. code-block:: yaml
1153
1154 linux:
1155 system:
1156 pkgs: ~
1157
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001158Package manager proxy global setup:
Petr Michalec10462bb2017-03-23 19:18:08 +01001159
1160.. code-block:: yaml
1161
1162 linux:
1163 system:
1164 ...
1165 repo:
1166 apt-mk:
1167 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1168 ...
1169 proxy:
1170 pkg:
1171 enabled: true
1172 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1173 ...
1174 # NOTE: Global defaults for any other componet that configure proxy on the system.
1175 # If your environment has just one simple proxy, set it on linux:system:proxy.
1176 #
1177 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1178 # as for https and http
1179 ftp: ftp://proxy.host.local:2121
1180 http: http://proxy.host.local:3142
1181 https: https://proxy.host.local:3143
1182
Taras Khlivnyak344de402021-02-17 09:10:16 +02001183Package manager direct access setup:
1184
1185.. code-block:: yaml
1186
1187 linux:
1188 system:
1189 ...
1190 repo:
1191 apt-mk:
1192 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1193 ...
1194 proxy:
1195 pkg:
1196 enabled: true
1197 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1198 ...
1199 # NOTE: Global defaults for any other componet that configure proxy on the system.
1200 # If your environment has just one simple proxy, set it on linux:system:proxy.
1201 #
1202 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1203 # as for https and http
1204 ftp: ftp://proxy.host.local:2121
1205 http: http://proxy.host.local:3142
1206 https: https://proxy.host.local:3143
1207 direct:
1208 - 192.168.0.100
1209 - repo.wo.proxy.local
1210
1211
Petr Michalec10462bb2017-03-23 19:18:08 +01001212Package manager proxy setup per repository:
1213
1214.. code-block:: yaml
1215
1216 linux:
1217 system:
1218 ...
1219 repo:
1220 debian:
1221 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1222 ...
1223 apt-mk:
1224 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1225 # per repository proxy
1226 proxy:
1227 enabled: true
1228 http: http://maas-01:8080
1229 https: http://maas-01:8080
1230 ...
1231 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001232 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +01001233 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
1234 pkg:
1235 enabled: true
1236 ftp: ftp://proxy.host.local:2121
1237 #http: http://proxy.host.local:3142
1238 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001239 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001240 # global system fallback system defaults
1241 ftp: ftp://proxy.host.local:2121
1242 http: http://proxy.host.local:3142
1243 https: https://proxy.host.local:3143
1244
Ivan Berezovskiycfd58a22019-06-25 20:15:51 +04001245
1246Add secured apt repository:
1247
1248.. code-block:: yaml
1249
1250 linux:
1251 system:
1252 ...
1253 repo:
1254 test:
1255 secure: true
1256 url: example.org/ubuntu
1257 arch: deb
1258 protocol: http
1259 user: foo
1260 password: bar
1261 distribution: stable
1262 component: main
1263
1264Add multiply secured apt repositories with same credentials:
1265
1266.. code-block:: yaml
1267
1268 linux:
1269 system:
1270 ...
1271 common_repo_secured:
1272 arch: deb
1273 protocol: http
1274 user: foo
1275 password: bar
1276 distribution: stable
1277 component: main
1278 repo:
1279 test1:
1280 secure: true
1281 url: example1.org/ubuntu
1282 test2:
1283 secure: true
1284 url: example2.org/ubuntu
1285
Denis Egorenkoe29a04f2019-12-05 15:46:06 +04001286Also it is possible to specify list of repos, which should be secured
1287within ``common_repo_secured`` block and without changing current
1288existing repo source parameter:
1289
1290.. code-block:: yaml
1291
1292 linux:
1293 system:
1294 ...
1295 common_repo_secured:
1296 user: foo
1297 password: bar
1298 secured_repos: [ 'test1', 'test2' ]
1299 repo:
1300 test1:
1301 ...
1302 test2:
1303 ...
1304 test3:
1305 ...
1306
1307Repos ``test1, test2`` will be secured. In case if you want secure all
1308available repos use ``secured_repos: [ 'all' ]``. But repo parameters have
1309precedence over parameters from ``common_repo_secured``. In next case:
1310
1311 linux:
1312 system:
1313 ...
1314 common_repo_secured:
1315 user: foo
1316 password: bar
1317 secured_repos: [ 'all' ]
1318 repo:
1319 test1:
1320 ...
1321 test2:
1322 ...
1323 test3:
1324 secure: False
1325 ...
1326
1327Repo ``test3`` will not be secured.
1328
Jiri Broulik34a29b42017-04-25 14:42:54 +02001329Remove all repositories:
1330
1331.. code-block:: yaml
1332
1333 linux:
1334 system:
1335 purge_repos: true
1336
azvyagintsevff089d22018-07-27 16:52:34 +02001337Refresh repositories metada, after configuration:
1338
1339.. code-block:: yaml
1340
1341 linux:
1342 system:
1343 refresh_repos_meta: true
1344
Filip Pytlounc512e6c2017-11-22 14:28:10 +01001345Setup custom apt config options:
1346
1347.. code-block:: yaml
1348
1349 linux:
1350 system:
1351 apt:
1352 config:
1353 compression-workaround:
1354 "Acquire::CompressionTypes::Order": "gz"
1355 docker-clean:
1356 "DPkg::Post-Invoke":
1357 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
1358 "APT::Update::Post-Invoke":
1359 - "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 +02001360
Petr Michalec10462bb2017-03-23 19:18:08 +01001361RC
1362~~
1363
Jakub Pavlik78859382016-01-21 11:26:39 +01001364rc.local example
1365
1366.. code-block:: yaml
1367
1368 linux:
1369 system:
1370 rc:
1371 local: |
1372 #!/bin/sh -e
1373 #
1374 # rc.local
1375 #
1376 # This script is executed at the end of each multiuser runlevel.
1377 # Make sure that the script will "exit 0" on success or any other
1378 # value on error.
1379 #
1380 # In order to enable or disable this script just change the execution
1381 # bits.
1382 #
1383 # By default this script does nothing.
1384 exit 0
1385
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001386Prompt
1387~~~~~~
1388
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001389Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``.
1390Every user can have different prompt:
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001391
1392.. code-block:: yaml
1393
1394 linux:
1395 system:
1396 prompt:
1397 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\\]
1398 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
1399
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001400On Debian systems, to set prompt system-wide, it's necessary to
1401remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``,
1402which comes from ``/etc/skel/.bashrc``. This formula will do
1403this automatically, but will not touch existing user's
1404``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +01001405
Filip Pytlouneef11c12016-03-25 11:00:23 +01001406Bash
1407~~~~
1408
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001409Fix bash configuration to preserve history across sessions
1410like ZSH does by default:
Filip Pytlouneef11c12016-03-25 11:00:23 +01001411
1412.. code-block:: yaml
1413
1414 linux:
1415 system:
1416 bash:
1417 preserve_history: true
1418
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001419Login banner message
1420~~~~~~~~~~~~~~~~~~~~
1421
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001422``/etc/issue`` is a text file which contains a message or system
1423identification to be printed before the login prompt. It may contain
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001424various @char and \char sequences, if supported by the getty-type
1425program employed on the system.
1426
1427Setting logon banner message is easy:
1428
1429.. code-block:: yaml
1430
1431 liunx:
1432 system:
1433 banner:
1434 enabled: true
1435 contents: |
1436 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1437
1438 You must have explicit, authorized permission to access or configure this
1439 device. Unauthorized attempts and actions to access or use this system may
1440 result in civil and/or criminal penalties.
1441 All activities performed on this system are logged and monitored.
1442
Filip Pytloune874dfb2016-01-22 16:57:34 +01001443Message of the day
1444~~~~~~~~~~~~~~~~~~
1445
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001446``pam_motd`` from package ``libpam-modules`` is used for dynamic
1447messages of the day. Setting custom ``motd`` will clean up existing ones.
Filip Pytloune874dfb2016-01-22 16:57:34 +01001448
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001449Setting static ``motd`` will replace existing ``/etc/motd`` and remove
1450scripts from ``/etc/update-motd.d``.
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001451
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001452Setting static ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001453
1454.. code-block:: yaml
1455
1456 linux:
1457 system:
1458 motd: |
1459 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1460
1461 You must have explicit, authorized permission to access or configure this
1462 device. Unauthorized attempts and actions to access or use this system may
1463 result in civil and/or criminal penalties.
1464 All activities performed on this system are logged and monitored.
1465
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001466Setting dynamic ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001467
Filip Pytloune874dfb2016-01-22 16:57:34 +01001468.. code-block:: yaml
1469
1470 linux:
1471 system:
1472 motd:
1473 - release: |
1474 #!/bin/sh
1475 [ -r /etc/lsb-release ] && . /etc/lsb-release
1476
1477 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
1478 # Fall back to using the very slow lsb_release utility
1479 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
1480 fi
1481
1482 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
1483 - warning: |
1484 #!/bin/sh
1485 printf "This is [company name] network.\n"
1486 printf "Unauthorized access strictly prohibited.\n"
1487
Marek Celoud713e9072017-05-18 15:20:25 +02001488Services
1489~~~~~~~~
1490
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001491Stop and disable the ``linux`` service:
Marek Celoud713e9072017-05-18 15:20:25 +02001492
1493.. code-block:: yaml
1494
1495 linux:
1496 system:
1497 service:
1498 apt-daily.timer:
1499 status: dead
1500
Dzmitry Stremkouski70d09782018-11-30 16:04:59 +01001501Override systemd service unit:
1502
1503.. code-block:: yaml
1504
1505 parameters:
1506
1507 linux:
1508 system:
1509 service:
1510 tgt:
1511 name: tgt
1512 status: running
1513 enabled: True
1514 override:
1515 50:
1516 target: tgt.service.d
1517 name: bind
1518 content: |
1519 [Service]
1520 ExecStart=
1521 ExecStart=/usr/sbin/tgtd -f --iscsi portal=${_param:single_address}:3260
1522
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001523Possible statuses are ``dead`` (disable service by default), ``running``
1524(enable service by default), ``enabled``, ``disabled``:
Marek Celoud713e9072017-05-18 15:20:25 +02001525
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001526Linux with the ``atop`` service:
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +03001527
1528.. code-block:: yaml
1529
1530 linux:
1531 system:
1532 atop:
1533 enabled: true
1534 interval: 20
1535 logpath: "/var/log/atop"
1536 outfile: "/var/log/atop/daily.log"
1537
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001538Linux with the ``mcelog`` service:
Oleksii Chupryn144432b2018-05-22 10:34:48 +03001539
1540.. code-block:: yaml
1541
1542 linux:
1543 system:
1544 mcelog:
1545 enabled: true
1546 logging:
1547 syslog: true
1548 syslog_error: true
1549
Denis Egorenko394ae072019-11-22 17:26:30 +04001550Linux Sosreport
1551^^^^^^^^^^^^^^^
1552
1553Sosreport is an extensible, portable, support data collection tool
1554primarily aimed at Linux distributions and other UNIX-like operating systems,
1555which allows to create diagnostic snapshot of system.
1556
1557Works out of box and additional pillars are not needed by default:
1558
1559.. code-block:: bash
1560
1561 salt-call state.sls linux.system.sosreport.report
1562
1563or from Salt Master:
1564
1565.. code-block:: bash
1566
1567 salt -C '<target>' state.sls linux.system.sosreport.report
1568
1569Sosreport configuration may be extended with next pillar data:
1570
1571.. code-block:: yaml
1572
1573 linux:
1574 system:
1575 sosreport:
1576 cmd_options:
1577 tmp-dir: /root/reportdir
1578 no_arg_opts: [ '-q' ]
1579 config_options:
1580 general:
1581 all-logs: true
1582 plugins:
1583 disabled: [ docker ]
1584 tunables:
1585 apache.log: true
1586
1587Where is ``cmd_options`` additional provided arguments for cli cmd call,
1588``general`` desribes parameters for sos.conf ``general`` section,
1589``plugins`` desribes which plugins should be ``enabled`` or ``disabled``
1590and ``tunables`` has custom plugin options which can be additionally set.
1591
1592Also it is possible to pass cmd_options through pillar override:
1593
1594.. code-block:: bash
1595
1596 salt -C '<target>' state.sls linux.system.sosreport.report pillar='{ "sosreport" : { "ticket-number": 12345, "tmp-dir": "/root/reportdir2" } }'
1597
1598Run ``sosreport --help`` to get full list of possible options.
1599
1600Once state ``linux.system.sosreport.report`` is executed on targets, it is
1601possible to collect all reports by using next command on Salt Master:
1602
1603.. code-block:: bash
1604
1605 salt -C 'I@salt:master' state.sls linux.system.sosreport.collect pillar='{ "sosreport_collect" : { "target": "<target>", "archiveName": "sosreport_<env_name>_<customer>_<ticket>" } }'
1606
1607This will generate one common archive for all ``<target>`` nodes with name
1608``sosreport_<env_name>_<customer>_<ticket>.tar.gz``. It is required to specify
1609target nodes through model (``linux.system.sosreport.collect``) or pillar
1610override. Also possible options are: ``nodeIp`` which allows you to use IP from another
1611interface on node (should be available from minions), ``port`` for NetCat if
1612you see that default port is busy, ``archiveName`` for your archive and
1613``reportWorkDir`` directory to keeping all reports for current case.
1614
Filip Pytloun2f70b492016-02-19 15:55:25 +01001615RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +01001616^^^^^^^^^^^^^
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001617Currently, ``update-motd`` is not available
1618for RHEL. So there is no native support for dynamic ``motd``.
1619You can still set a static one, with a different pillar structure:
Filip Pytloun2f70b492016-02-19 15:55:25 +01001620
1621.. code-block:: yaml
1622
1623 linux:
1624 system:
1625 motd: |
1626 This is [company name] network.
1627 Unauthorized access strictly prohibited.
1628
Filip Pytloun8296bb92016-02-19 18:42:09 +01001629Haveged
1630~~~~~~~
1631
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001632If you are running headless server and are low on entropy,
1633you may set up Haveged:
Filip Pytloun8296bb92016-02-19 18:42:09 +01001634
1635.. code-block:: yaml
1636
1637 linux:
1638 system:
1639 haveged:
1640 enabled: true
1641
Filip Pytlounf5383a42015-10-06 16:28:32 +02001642Linux network
1643-------------
1644
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001645Linux with network manager:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001646
1647.. code-block:: yaml
1648
1649 linux:
1650 network:
1651 enabled: true
1652 network_manager: true
1653
Dzmitry Stremkouski00cdbe62018-10-31 16:41:54 +01001654Execute linux.network.interface state without ifupdown activity:
1655
1656.. code-block:: bash
1657
1658 salt-call linux.network.interface pillar='{"linux":{"network":{"noifupdown":True}}}'
1659
1660
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001661Linux with default static network interfaces, default gateway
1662interface and DNS servers:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001663
1664.. code-block:: yaml
1665
1666 linux:
1667 network:
1668 enabled: true
1669 interface:
1670 eth0:
1671 enabled: true
1672 type: eth
1673 address: 192.168.0.102
1674 netmask: 255.255.255.0
1675 gateway: 192.168.0.1
1676 name_servers:
1677 - 8.8.8.8
1678 - 8.8.4.4
1679 mtu: 1500
1680
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001681Linux with bonded interfaces and disabled ``NetworkManager``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001682
1683.. code-block:: yaml
1684
1685 linux:
1686 network:
1687 enabled: true
1688 interface:
1689 eth0:
1690 type: eth
1691 ...
1692 eth1:
1693 type: eth
1694 ...
1695 bond0:
1696 enabled: true
1697 type: bond
1698 address: 192.168.0.102
1699 netmask: 255.255.255.0
1700 mtu: 1500
1701 use_in:
1702 - interface: ${linux:interface:eth0}
1703 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +01001704 network_manager:
1705 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001706
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001707Linux with VLAN ``interface_params``:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001708
1709.. code-block:: yaml
1710
1711 linux:
1712 network:
1713 enabled: true
1714 interface:
1715 vlan69:
1716 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001717 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001718 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001719
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001720Linux with wireless interface parameters:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001721
1722.. code-block:: yaml
1723
1724 linux:
1725 network:
1726 enabled: true
1727 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001728 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001729 interface:
1730 wlan0:
1731 type: eth
1732 wireless:
1733 essid: example
1734 key: example_key
1735 security: wpa
1736 priority: 1
1737
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001738Linux networks with routes defined:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001739
1740.. code-block:: yaml
1741
1742 linux:
1743 network:
1744 enabled: true
1745 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001746 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001747 interface:
1748 eth0:
1749 type: eth
1750 route:
1751 default:
1752 address: 192.168.0.123
1753 netmask: 255.255.255.0
1754 gateway: 192.168.0.1
1755
ivce5011da2019-01-23 07:56:53 +03001756Linux networks with implicit routes definition:
1757
1758- on node 1:
1759
1760.. code-block:: yaml
1761
1762 linux:
1763 network:
1764 enabled: true
1765 router:
1766 ctl:
1767 # router that connects 10.0.1.0/24 and 10.0.2.0/24
1768 addresses:
1769 - 10.0.1.1/24
1770 - 10.0.2.1/24
1771 test:
1772 addresses:
1773 - 10.0.1.2/24
1774 networks:
1775 - 10.100.0.0/16
1776 interface:
1777 ctl:
1778 name: eth0
1779 address: 10.0.1.101
1780 netmask: 255.255.255.0
1781
1782- on node2:
1783
1784.. code-block:: yaml
1785
1786 linux:
1787 network:
1788 enabled: true
1789 router:
1790 ctl:
1791 # equivalent of node1's ctl router with 'implicit_routes = false'
1792 options:
1793 implicit_routes: false
1794 addresses:
1795 - 10.0.1.1/24
1796 - 10.0.2.1/24
1797 networks:
1798 - 10.0.1.0/24
1799 - 10.0.2.0/24
1800 interface:
1801 ctl:
1802 name: eth0
1803 address: 10.0.2.101
1804 netmask: 255.255.255.0
1805
1806
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001807Native Linux Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001808
1809.. code-block:: yaml
1810
1811 linux:
1812 network:
1813 interface:
1814 eth1:
1815 enabled: true
1816 type: eth
1817 proto: manual
1818 up_cmds:
1819 - ip address add 0/0 dev $IFACE
1820 - ip link set $IFACE up
1821 down_cmds:
1822 - ip link set $IFACE down
1823 br-ex:
1824 enabled: true
1825 type: bridge
1826 address: ${linux:network:host:public_local:address}
1827 netmask: 255.255.255.0
1828 use_interfaces:
1829 - eth1
1830
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001831Open vSwitch Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001832
1833.. code-block:: yaml
1834
1835 linux:
1836 network:
1837 bridge: openvswitch
1838 interface:
1839 eth1:
1840 enabled: true
1841 type: eth
1842 proto: manual
1843 up_cmds:
1844 - ip address add 0/0 dev $IFACE
1845 - ip link set $IFACE up
1846 down_cmds:
1847 - ip link set $IFACE down
1848 br-ex:
1849 enabled: true
1850 type: bridge
1851 address: ${linux:network:host:public_local:address}
1852 netmask: 255.255.255.0
1853 use_interfaces:
1854 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001855 br-prv:
1856 enabled: true
1857 type: ovs_bridge
1858 mtu: 65000
1859 br-ens7:
1860 enabled: true
1861 name: br-ens7
1862 type: ovs_bridge
1863 proto: manual
1864 mtu: 9000
1865 use_interfaces:
1866 - ens7
1867 patch-br-ens7-br-prv:
1868 enabled: true
1869 name: ens7-prv
1870 ovs_type: ovs_port
1871 type: ovs_port
1872 bridge: br-ens7
1873 port_type: patch
1874 peer: prv-ens7
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001875 tag: 109 # [] to unset a tag
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001876 mtu: 65000
1877 patch-br-prv-br-ens7:
1878 enabled: true
1879 name: prv-ens7
1880 bridge: br-prv
1881 ovs_type: ovs_port
1882 type: ovs_port
1883 port_type: patch
1884 peer: ens7-prv
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001885 tag: 109
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001886 mtu: 65000
1887 ens7:
1888 enabled: true
1889 name: ens7
1890 proto: manual
1891 ovs_port_type: OVSPort
1892 type: ovs_port
1893 ovs_bridge: br-ens7
1894 bridge: br-ens7
Oleg Gelbukh36f01072019-07-01 15:26:16 -07001895 ens6:
1896 enabled: true
1897 proto: manual
1898 type: eth
1899 ovs_bridge: br-ctl
1900 br-ctl:
1901 enabled: true
1902 type: ovs_bridge
1903 internal-br-ctl-port:
1904 enabled: true
1905 proto: static
1906 address: 172.172.0.10
1907 netmask: 255.255.0.0
1908 name_servers:
1909 - 8.8.8.8
1910 - 172.172.172.172
1911 name: port-br-ctl
1912 bridge: br-ctl
1913 ovs_type: ovs_port
1914 type: ovs_port
1915 port_type: internal
1916 mtu: 65000
Filip Pytlounf5383a42015-10-06 16:28:32 +02001917
Petr Jediný8f8ae542017-07-13 16:19:12 +02001918Debian manual proto interfaces
1919
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001920When you are changing interface proto from static in up state
1921to manual, you may need to flush ip addresses. For example,
1922if you want to use the interface and the ip on the bridge.
1923This can be done by setting the ``ipflush_onchange`` to true.
Petr Jediný8f8ae542017-07-13 16:19:12 +02001924
1925.. code-block:: yaml
1926
1927 linux:
1928 network:
1929 interface:
1930 eth1:
1931 enabled: true
1932 type: eth
1933 proto: manual
1934 mtu: 9100
1935 ipflush_onchange: true
1936
Jiri Broulik1a191e32018-01-15 15:54:21 +01001937Debian static proto interfaces
1938
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001939When you are changing interface proto from dhcp in up state to
1940static, you may need to flush ip addresses and restart interface
1941to assign ip address from a managed file. For example, if you wantto
1942use the interface and the ip on the bridge. This can be done by
1943setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
1944param set to true.
Jiri Broulik1a191e32018-01-15 15:54:21 +01001945
1946.. code-block:: yaml
1947
1948 linux:
1949 network:
1950 interface:
1951 eth1:
1952 enabled: true
1953 type: eth
1954 proto: static
1955 address: 10.1.0.22
1956 netmask: 255.255.255.0
1957 ipflush_onchange: true
1958 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001959
Petr Jedinýd577cb52017-06-28 20:17:49 +02001960Concatinating and removing interface files
1961
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001962Debian based distributions have ``/etc/network/interfaces.d/``
1963directory, where you can store configuration of network
1964interfaces in separate files. You can concatinate the files
1965to the defined destination when needed, this operation removes
1966the file from the ``/etc/network/interfaces.d/``. If you just need
1967to remove iface files, you can use the ``remove_iface_files`` key.
Petr Jedinýd577cb52017-06-28 20:17:49 +02001968
1969.. code-block:: yaml
1970
1971 linux:
1972 network:
1973 concat_iface_files:
1974 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1975 dst: '/etc/network/interfaces'
1976 remove_iface_files:
1977 - '/etc/network/interfaces.d/90-custom.cfg'
1978
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001979Configure DHCP client
Petr Jedinýd577cb52017-06-28 20:17:49 +02001980
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001981None of the keys is mandatory, include only those you really need.
1982For full list of available options under send, supersede, prepend,
1983append refer to dhcp-options(5).
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001984
1985.. code-block:: yaml
1986
1987 linux:
1988 network:
1989 dhclient:
1990 enabled: true
1991 backoff_cutoff: 15
1992 initial_interval: 10
1993 reboot: 10
1994 retry: 60
1995 select_timeout: 0
1996 timeout: 120
1997 send:
1998 - option: host-name
1999 declaration: "= gethostname()"
2000 supersede:
2001 - option: host-name
2002 declaration: "spaceship"
2003 - option: domain-name
2004 declaration: "domain.home"
2005 #- option: arp-cache-timeout
2006 # declaration: 20
2007 prepend:
2008 - option: domain-name-servers
2009 declaration:
2010 - 8.8.8.8
2011 - 8.8.4.4
2012 - option: domain-search
2013 declaration:
2014 - example.com
2015 - eng.example.com
2016 #append:
2017 #- option: domain-name-servers
2018 # declaration: 127.0.0.1
2019 # ip or subnet to reject dhcp offer from
2020 reject:
2021 - 192.33.137.209
2022 - 10.0.2.0/24
2023 request:
2024 - subnet-mask
2025 - broadcast-address
2026 - time-offset
2027 - routers
2028 - domain-name
2029 - domain-name-servers
2030 - domain-search
2031 - host-name
2032 - dhcp6.name-servers
2033 - dhcp6.domain-search
2034 - dhcp6.fqdn
2035 - dhcp6.sntp-servers
2036 - netbios-name-servers
2037 - netbios-scope
2038 - interface-mtu
2039 - rfc3442-classless-static-routes
2040 - ntp-servers
2041 require:
2042 - subnet-mask
2043 - domain-name-servers
2044 # if per interface configuration required add below
2045 interface:
2046 ens2:
2047 initial_interval: 11
2048 reject:
2049 - 192.33.137.210
2050 ens3:
2051 initial_interval: 12
2052 reject:
2053 - 192.33.137.211
2054
Petr Michaleceb14b552017-06-01 10:27:05 +02002055Linux network systemd settings:
2056
2057.. code-block:: yaml
2058
2059 linux:
2060 network:
2061 ...
2062 systemd:
2063 link:
2064 10-iface-dmz:
2065 Match:
2066 MACAddress: c8:5b:67:fa:1a:af
2067 OriginalName: eth0
2068 Link:
2069 Name: dmz0
2070 netdev:
2071 20-bridge-dmz:
2072 match:
2073 name: dmz0
2074 network:
2075 mescription: bridge
2076 bridge: br-dmz0
2077 network:
2078 # works with lowercase, keys are by default capitalized
2079 40-dhcp:
2080 match:
2081 name: '*'
2082 network:
2083 DHCP: yes
2084
Petr Michalec10462bb2017-03-23 19:18:08 +01002085Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01002086
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002087Use ``/etc/environment`` for static system wide variable assignment
2088after boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002089
2090.. code-block:: yaml
2091
2092 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01002093 system:
2094 env:
2095 BOB_VARIABLE: Alice
2096 ...
2097 BOB_PATH:
2098 - /srv/alice/bin
2099 - /srv/bob/bin
2100 ...
2101 ftp_proxy: none
2102 http_proxy: http://global-http-proxy.host.local:8080
2103 https_proxy: ${linux:system:proxy:https}
2104 no_proxy:
2105 - 192.168.0.80
2106 - 192.168.1.80
2107 - .domain.com
2108 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02002109 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01002110 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002111 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01002112 ftp: ftp://proxy.host.local:2121
2113 http: http://proxy.host.local:3142
2114 https: https://proxy.host.local:3143
2115 noproxy:
2116 - .domain.com
2117 - .local
2118
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002119Configure the ``profile.d`` scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01002120
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002121The ``profile.d`` scripts are being sourced during ``.sh`` execution
2122and support variable expansion in opposite to /etc/environment global
2123settings in ``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01002124
2125.. code-block:: yaml
2126
2127 linux:
2128 system:
2129 profile:
2130 locales: |
2131 export LANG=C
2132 export LC_ALL=C
2133 ...
2134 vi_flavors.sh: |
2135 export PAGER=view
2136 export EDITOR=vim
2137 alias vi=vim
2138 shell_locales.sh: |
2139 export LANG=en_US
2140 export LC_ALL=en_US.UTF-8
2141 shell_proxies.sh: |
2142 export FTP_PROXY=ftp://127.0.3.3:2121
2143 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02002144
Dmitry Teselkina0d31d12018-09-04 14:43:09 +03002145
2146Configure login.defs parameters
2147-------------------------------
2148
2149.. code-block:: yaml
2150
2151 linux:
2152 system:
2153 login_defs:
2154 <opt_name>:
2155 enabled: true
2156 value: <opt_value>
2157
2158<opt_name> is a configurational option defined in 'man login.defs'.
2159<opt_name> is case sensitive, should be UPPERCASE only!
2160
2161
Filip Pytlounf5383a42015-10-06 16:28:32 +02002162Linux with hosts
2163
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002164Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
2165removing entries that are not defined in model except defaults
2166for both IPv4 and IPv6 localhost and hostname as well as FQDN.
Ales Komarek417e8c52017-08-25 15:10:29 +02002167
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002168We recommend using this option to verify that ``/etc/hosts``
2169is always in a clean state. However it is not enabled by default
2170for security reasons.
Filip Pytloun86506fe2017-01-26 14:36:16 +01002171
Filip Pytlounf5383a42015-10-06 16:28:32 +02002172.. code-block:: yaml
2173
2174 linux:
2175 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002176 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002177 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002178 # No need to define this one if purge_hosts is true
2179 hostname:
2180 address: 127.0.1.1
2181 names:
2182 - ${linux:network:fqdn}
2183 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02002184 node1:
2185 address: 192.168.10.200
2186 names:
2187 - node2.domain.com
2188 - service2.domain.com
2189 node2:
2190 address: 192.168.10.201
2191 names:
2192 - node2.domain.com
2193 - service2.domain.com
2194
Ales Komarek417e8c52017-08-25 15:10:29 +02002195Linux with hosts collected from mine
2196
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002197All DNS records defined within infrastrucuture
2198are passed to the local hosts records or any DNS server. Only
2199hosts with the ``grain`` parameter set to ``true`` will be propagated
2200to the mine.
Ales Komarek417e8c52017-08-25 15:10:29 +02002201
2202.. code-block:: yaml
2203
2204 linux:
2205 network:
2206 purge_hosts: true
2207 mine_dns_records: true
2208 host:
2209 node1:
2210 address: 192.168.10.200
2211 grain: true
2212 names:
2213 - node2.domain.com
2214 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01002215
Valeriy Sakharovd5f14372022-06-23 18:21:16 +04002216Set up ``resolvconf's basic resolver info``, e.g. nameservers, search/domain and options.
2217Parameter ``update_head`` will move changes to the top of resolv.conf if set to ``True``:
Filip Pytlounde9bea52016-01-11 15:39:10 +01002218
2219.. code-block:: yaml
2220
2221 linux:
2222 network:
2223 resolv:
2224 dns:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002225 - 8.8.4.4
2226 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01002227 domain: my.example.com
Valeriy Sakharovd5f14372022-06-23 18:21:16 +04002228 update_head: False
Filip Pytlounde9bea52016-01-11 15:39:10 +01002229 search:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002230 - my.example.com
2231 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01002232 options:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002233 - ndots:5
2234 - timeout:2
2235 - attempts:2
Filip Pytlounde9bea52016-01-11 15:39:10 +01002236
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002237Set up custom TX queue length for tap interfaces:
Andrii Petrenko735761d2017-03-21 17:17:35 -07002238
2239.. code-block:: yaml
2240
2241 linux:
2242 network:
Dzmitry Stremkouskif76e8092020-09-14 17:41:49 +02002243 custom_txqueuelen
2244 tap:
2245 queue_length: 10000
2246 enabled: true
2247 device_filter: 'tap[0-9a-z\-]*'
2248 ten:
2249 enabled: false
2250 veth:
2251 queue_length: 20000
Andrii Petrenko735761d2017-03-21 17:17:35 -07002252
Michael Polenchukc37bd4a2019-04-22 15:20:03 +04002253Auto repair/re-attach libvirt's vnet interfaces:
2254
2255.. code-block:: yaml
2256
2257 linux:
2258 network:
2259 libvirt_vnet_repair: true
2260
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002261DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002262
2263**DPDK OVS NIC**
2264
2265.. code-block:: yaml
2266
2267 linux:
2268 network:
2269 bridge: openvswitch
2270 dpdk:
2271 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002272 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002273 openvswitch:
2274 pmd_cpu_mask: "0x6"
2275 dpdk_socket_mem: "1024,1024"
2276 dpdk_lcore_mask: "0x400"
2277 memory_channels: 2
2278 interface:
2279 dpkd0:
2280 name: ${_param:dpdk_nic}
2281 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002282 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002283 enabled: true
2284 type: dpdk_ovs_port
2285 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002286 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002287 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01002288 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002289 br-prv:
2290 enabled: true
2291 type: dpdk_ovs_bridge
Michael Polenchuk70147482018-12-29 16:46:50 +04002292 br-floating:
2293 enabled: true
2294 type: ovs_bridge
2295 name_servers:
2296 - 1.1.1.1
2297 - 9.9.9.9
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002298
2299**DPDK OVS Bond**
2300
2301.. code-block:: yaml
2302
2303 linux:
2304 network:
2305 bridge: openvswitch
2306 dpdk:
2307 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002308 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002309 openvswitch:
2310 pmd_cpu_mask: "0x6"
2311 dpdk_socket_mem: "1024,1024"
2312 dpdk_lcore_mask: "0x400"
2313 memory_channels: 2
2314 interface:
2315 dpdk_second_nic:
2316 name: ${_param:primary_second_nic}
2317 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002318 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002319 bond: dpdkbond0
2320 enabled: true
2321 type: dpdk_ovs_port
2322 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002323 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002324 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002325 dpdk_first_nic:
2326 name: ${_param:primary_first_nic}
2327 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002328 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002329 bond: dpdkbond0
2330 enabled: true
2331 type: dpdk_ovs_port
2332 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002333 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002334 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002335 dpdkbond0:
2336 enabled: true
2337 bridge: br-prv
2338 type: dpdk_ovs_bond
2339 mode: active-backup
2340 br-prv:
2341 enabled: true
2342 type: dpdk_ovs_bridge
2343
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01002344**DPDK OVS LACP Bond with vlan tag**
2345
2346.. code-block:: yaml
2347
2348 linux:
2349 network:
2350 bridge: openvswitch
2351 dpdk:
2352 enabled: true
2353 driver: uio
2354 openvswitch:
2355 pmd_cpu_mask: "0x6"
2356 dpdk_socket_mem: "1024,1024"
2357 dpdk_lcore_mask: "0x400"
2358 memory_channels: "2"
2359 interface:
2360 eth3:
2361 enabled: true
2362 type: eth
2363 proto: manual
2364 name: ${_param:tenant_first_nic}
2365 eth4:
2366 enabled: true
2367 type: eth
2368 proto: manual
2369 name: ${_param:tenant_second_nic}
2370 dpdk0:
2371 name: ${_param:tenant_first_nic}
2372 pci: "0000:81:00.0"
2373 driver: igb_uio
2374 bond: bond1
2375 enabled: true
2376 type: dpdk_ovs_port
2377 n_rxq: 2
2378 dpdk1:
2379 name: ${_param:tenant_second_nic}
2380 pci: "0000:81:00.1"
2381 driver: igb_uio
2382 bond: bond1
2383 enabled: true
2384 type: dpdk_ovs_port
2385 n_rxq: 2
2386 bond1:
2387 enabled: true
2388 bridge: br-prv
2389 type: dpdk_ovs_bond
2390 mode: balance-slb
2391 br-prv:
2392 enabled: true
2393 type: dpdk_ovs_bridge
2394 tag: ${_param:tenant_vlan}
2395 address: ${_param:tenant_address}
2396 netmask: ${_param:tenant_network_netmask}
2397
Jakub Pavlikaa759062017-03-13 15:57:26 +01002398**DPDK OVS bridge for VXLAN**
2399
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002400If VXLAN is used as tenant segmentation, IP address must
2401be set on ``br-prv``.
Jakub Pavlikaa759062017-03-13 15:57:26 +01002402
2403.. code-block:: yaml
2404
2405 linux:
2406 network:
2407 ...
2408 interface:
2409 br-prv:
2410 enabled: true
2411 type: dpdk_ovs_bridge
2412 address: 192.168.50.0
2413 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04002414 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01002415 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002416
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02002417**DPDK OVS bridge with Linux network interface**
2418
2419.. code-block:: yaml
2420
2421 linux:
2422 network:
2423 ...
2424 interface:
2425 eth0:
2426 type: eth
2427 ovs_bridge: br-prv
2428 ...
2429 br-prv:
2430 enabled: true
2431 type: dpdk_ovs_bridge
2432 ...
2433
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002434Linux storage
2435-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02002436
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002437Linux with mounted Samba:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002438
2439.. code-block:: yaml
2440
2441 linux:
2442 storage:
2443 enabled: true
2444 mount:
2445 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01002446 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002447 - path: /media/myuser/public/
2448 - device: //192.168.0.1/storage
2449 - file_system: cifs
2450 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
2451
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002452NFS mount:
Jiri Broulikb017f932017-03-31 13:55:36 +02002453
2454.. code-block:: yaml
2455
2456 linux:
2457 storage:
2458 enabled: true
2459 mount:
2460 nfs_glance:
2461 enabled: true
2462 path: /var/lib/glance/images
2463 device: 172.16.10.110:/var/nfs/glance
2464 file_system: nfs
2465 opts: rw,sync
2466
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002467File swap configuration:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002468
2469.. code-block:: yaml
2470
2471 linux:
2472 storage:
2473 enabled: true
2474 swap:
2475 file:
2476 enabled: true
2477 engine: file
2478 device: /swapfile
2479 size: 1024
2480
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002481Partition swap configuration:
Lachlan Evenson30676512016-01-22 15:43:28 -08002482
2483.. code-block:: yaml
2484
2485 linux:
2486 storage:
2487 enabled: true
2488 swap:
2489 partition:
2490 enabled: true
2491 engine: partition
2492 device: /dev/vg0/swap
2493
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002494LVM group ``vg1`` with one device and ``data`` volume mounted
2495into ``/mnt/data``.
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002496
2497.. code-block:: yaml
2498
2499 parameters:
2500 linux:
2501 storage:
Dzmitry Stremkouskif94b5852021-03-05 11:53:27 +01002502 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002503 mount:
2504 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01002505 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002506 device: /dev/vg1/data
2507 file_system: ext4
2508 path: /mnt/data
2509 lvm:
2510 vg1:
2511 enabled: true
2512 devices:
2513 - /dev/sdb
2514 volume:
2515 data:
2516 size: 40G
2517 mount: ${linux:storage:mount:data}
root3387f332019-01-11 08:55:32 +00002518 # When set they will take precedence over filters aget from volume groups.
2519 lvm_filters:
2520 10:
2521 enabled: True
2522 value: "a|loop|"
2523 20:
2524 enabled: True
2525 value: "r|/dev/hdc|"
2526 30:
2527 enabled: True
2528 value: "a|/dev/ide|"
2529 40:
2530 enabled: True
2531 value: "r|.*|"
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002532
Jakub Pavlik4f742142017-08-08 15:05:50 +02002533Create partitions on disk. Specify size in MB. It expects empty
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002534disk without any existing partitions.
2535Set ``startsector=1`` if you want to start partitions from ``2048``.
Jakub Pavlik4f742142017-08-08 15:05:50 +02002536
2537.. code-block:: yaml
2538
2539 linux:
2540 storage:
2541 disk:
2542 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01002543 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02002544 name: /dev/loop1
2545 type: gpt
2546 partitions:
2547 - size: 200 #size in MB
2548 type: fat32
2549 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02002550 mkfs: True
2551 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02002552 /dev/vda1:
2553 partitions:
2554 - size: 5
2555 type: ext2
2556 - size: 10
2557 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02002558
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002559Multipath with Fujitsu Eternus DXL:
Ales Komareka634f4b2016-10-02 13:11:04 +02002560
2561.. code-block:: yaml
2562
2563 parameters:
2564 linux:
2565 storage:
2566 multipath:
2567 enabled: true
2568 blacklist_devices:
2569 - /dev/sda
2570 - /dev/sdb
2571 backends:
2572 - fujitsu_eternus_dxl
2573
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002574Multipath with Hitachi VSP 1000:
Ales Komareka634f4b2016-10-02 13:11:04 +02002575
2576.. code-block:: yaml
2577
2578 parameters:
2579 linux:
2580 storage:
2581 multipath:
2582 enabled: true
2583 blacklist_devices:
2584 - /dev/sda
2585 - /dev/sdb
2586 backends:
2587 - hitachi_vsp1000
2588
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002589Multipath with IBM Storwize:
Ales Komareka634f4b2016-10-02 13:11:04 +02002590
2591.. code-block:: yaml
2592
2593 parameters:
2594 linux:
2595 storage:
2596 multipath:
2597 enabled: true
2598 blacklist_devices:
2599 - /dev/sda
2600 - /dev/sdb
2601 backends:
2602 - ibm_storwize
2603
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002604Multipath with multiple backends:
Ales Komareka634f4b2016-10-02 13:11:04 +02002605
2606.. code-block:: yaml
2607
2608 parameters:
2609 linux:
2610 storage:
2611 multipath:
2612 enabled: true
2613 blacklist_devices:
2614 - /dev/sda
2615 - /dev/sdb
2616 - /dev/sdc
2617 - /dev/sdd
2618 backends:
2619 - ibm_storwize
2620 - fujitsu_eternus_dxl
2621 - hitachi_vsp1000
2622
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002623PAM LDAP integration:
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002624
2625.. code-block:: yaml
2626
2627 parameters:
2628 linux:
2629 system:
2630 auth:
2631 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02002632 mkhomedir:
2633 enabled: true
2634 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002635 ldap:
2636 enabled: true
2637 binddn: cn=bind,ou=service_users,dc=example,dc=com
2638 bindpw: secret
2639 uri: ldap://127.0.0.1
2640 base: ou=users,dc=example,dc=com
2641 ldap_version: 3
2642 pagesize: 65536
2643 referrals: off
2644 filter:
2645 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2646 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2647 group: (&(objectClass=group)(gidNumber=*))
2648
Gleb Galkin93b9ae92018-10-18 13:57:30 +03002649PAM duo 2FA integration
2650
2651.. code-block:: yaml
2652
2653 parameters:
2654 linux:
2655 system:
2656 auth:
2657 enabled: true
2658 duo:
2659 enabled: true
2660 duo_host: localhost
2661 duo_ikey: DUO-INTEGRATION-KEY
2662 duo_skey: DUO-SECRET-KEY
2663
2664duo package version may be specified (optional)
2665
2666.. code-block:: yaml
2667
2668 linux:
2669 system:
2670 package:
2671 duo-unix:
2672 version: 1.10.1-0
2673
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002674Disabled multipath (the default setup):
Ales Komareka634f4b2016-10-02 13:11:04 +02002675
2676.. code-block:: yaml
2677
2678 parameters:
2679 linux:
2680 storage:
2681 multipath:
2682 enabled: false
2683
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002684Linux with local loopback device:
Simon Pasquier375001e2017-01-26 13:22:33 +01002685
2686.. code-block:: yaml
2687
2688 linux:
2689 storage:
2690 loopback:
2691 disk1:
2692 file: /srv/disk1
2693 size: 50G
2694
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002695External config generation
2696--------------------------
2697
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002698You are able to use config support metadata between formulas
2699and only generate configuration files for external use, for example, Docker, and so on.
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002700
2701.. code-block:: yaml
2702
2703 parameters:
2704 linux:
2705 system:
2706 config:
2707 pillar:
2708 jenkins:
2709 master:
2710 home: /srv/volumes/jenkins
2711 approved_scripts:
2712 - method java.net.URL openConnection
2713 credentials:
2714 - type: username_password
2715 scope: global
2716 id: test
2717 desc: Testing credentials
2718 username: test
2719 password: test
2720
Vladimir Ereminccf28842017-04-10 23:52:10 +03002721Netconsole Remote Kernel Logging
2722--------------------------------
2723
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002724Netconsole logger can be configured for the configfs-enabled kernels
2725(``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
2726applies both in runtime (if network is already configured),
2727and on-boot after an interface initialization.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002728
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002729.. note::
2730
2731 * Receiver can be located only on the same L3 domain
2732 (or you need to configure gateway MAC manually).
2733 * The Receiver MAC is detected only on configuration time.
2734 * Using broadcast MAC is not recommended.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002735
2736.. code-block:: yaml
2737
2738 parameters:
2739 linux:
2740 system:
2741 netconsole:
2742 enabled: true
2743 port: 514 (optional)
2744 loglevel: debug (optional)
2745 target:
2746 192.168.0.1:
2747 interface: bond0
2748 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02002749
Dzmitry Stremkouskid1a268b2018-10-03 16:36:04 +02002750Check network params on the environment
2751---------------------------------------
2752
2753Grab nics and nics states
2754
2755.. code-block:: bash
2756
2757 salt osd001\* net_checks.get_nics
2758
2759**Example of system output:**
2760
2761.. code-block:: bash
2762
2763 osd001.domain.com:
2764 |_
2765 - bond0
2766 - None
2767 - 1e:c8:64:42:23:b9
2768 - 0
2769 - 1500
2770 |_
2771 - bond1
2772 - None
2773 - 3c:fd:fe:27:3b:00
2774 - 1
2775 - 9100
2776 |_
2777 - fourty1
2778 - None
2779 - 3c:fd:fe:27:3b:00
2780 - 1
2781 - 9100
2782 |_
2783 - fourty2
2784 - None
2785 - 3c:fd:fe:27:3b:02
2786 - 1
2787 - 9100
2788
2789Grab 10G nics PCI addresses for hugepages setup
2790
2791.. code-block:: bash
2792
2793 salt cmp001\* net_checks.get_ten_pci
2794
2795**Example of system output:**
2796
2797.. code-block:: bash
2798
2799 cmp001.domain.com:
2800 |_
2801 - ten1
2802 - 0000:19:00.0
2803 |_
2804 - ten2
2805 - 0000:19:00.1
2806 |_
2807 - ten3
2808 - 0000:19:00.2
2809 |_
2810 - ten4
2811 - 0000:19:00.3
2812
2813Grab ip address for an interface
2814
2815.. code-block:: bash
2816
2817 salt cmp001\* net_checks.get_ip iface=one4
2818
2819**Example of system output:**
2820
2821.. code-block:: bash
2822
2823 cmp001.domain.com:
2824 10.200.177.101
2825
2826Grab ip addresses map
2827
2828.. code-block:: bash
2829
2830 salt-call net_checks.nodes_addresses
2831
2832**Example of system output:**
2833
2834.. code-block:: bash
2835
2836 local:
2837 |_
2838 - cid01.domain.com
2839 |_
2840 |_
2841 - pxe
2842 - 10.200.177.91
2843 |_
2844 - control
2845 - 10.200.178.91
2846 |_
2847 - cmn02.domain.com
2848 |_
2849 |_
2850 - storage_access
2851 - 10.200.181.67
2852 |_
2853 - pxe
2854 - 10.200.177.67
2855 |_
2856 - control
2857 - 10.200.178.67
2858 |_
2859 - cmp010.domain.com
2860 |_
2861 |_
2862 - pxe
2863 - 10.200.177.110
2864 |_
2865 - storage_access
2866 - 10.200.181.110
2867 |_
2868 - control
2869 - 10.200.178.110
2870 |_
2871 - vxlan
2872 - 10.200.179.110
2873
2874Verify full mesh connectivity
2875
2876.. code-block:: bash
2877
2878 salt-call net_checks.ping_check
2879
2880**Example of positive system output:**
2881
2882.. code-block:: bash
2883
2884 ['PASSED']
2885 [INFO ] ['PASSED']
2886 local:
2887 True
2888
2889**Example of system output in case of failure:**
2890
2891.. code-block:: bash
2892
2893 FAILED
2894 [ERROR ] FAILED
2895 ['control: 10.0.1.92 -> 10.0.1.224: Failed']
2896 ['control: 10.0.1.93 -> 10.0.1.224: Failed']
2897 ['control: 10.0.1.51 -> 10.0.1.224: Failed']
2898 ['control: 10.0.1.102 -> 10.0.1.224: Failed']
2899 ['control: 10.0.1.13 -> 10.0.1.224: Failed']
2900 ['control: 10.0.1.81 -> 10.0.1.224: Failed']
2901 local:
2902 False
2903
2904For this feature to work, please mark addresses with some role.
2905Otherwise 'default' role is assumed and mesh would consist of all
2906addresses on the environment.
2907
2908Mesh mark is needed only for interfaces which are enabled and have
2909ip address assigned.
2910
2911Checking dhcp pxe network meaningless, as it is used for salt
2912master vs minion communications, therefore treated as checked.
2913
2914.. code-block:: yaml
2915
2916 parameters:
2917 linux:
2918 network:
2919 interface:
2920 ens3:
2921 enabled: true
2922 type: eth
2923 proto: static
2924 address: ${_param:deploy_address}
2925 netmask: ${_param:deploy_network_netmask}
2926 gateway: ${_param:deploy_network_gateway}
2927 mesh: pxe
2928
2929Check pillars for ip address duplicates
2930
2931.. code-block:: bash
2932
2933 salt-call net_checks.verify_addresses
2934
2935**Example of positive system output:**
2936
2937.. code-block:: bash
2938
2939 ['PASSED']
2940 [INFO ] ['PASSED']
2941 local:
2942 True
2943
2944**Example of system output in case of failure:**
2945
2946.. code-block:: bash
2947
2948 FAILED. Duplicates found
2949 [ERROR ] FAILED. Duplicates found
2950 ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2951 [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2952 local:
2953 False
2954
2955Generate csv report for the env
2956
2957.. code-block:: bash
2958
2959 salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
2960 | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
2961 | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
2962
2963**Example of system output:**
2964
2965.. code-block:: bash
2966
2967 server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
2968 cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
2969 cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
2970 cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
2971 cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
2972 cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
2973 cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
2974 cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
2975 cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
2976 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
2977 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
2978 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
2979 cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
2980 cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
2981 cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
2982 ...
2983
Filip Pytlounf5383a42015-10-06 16:28:32 +02002984Usage
2985=====
2986
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002987Set MTU of the eth0 network interface to 1400:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002988
2989.. code-block:: bash
2990
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002991 ip link set dev eth0 mtu 1400
Filip Pytlounf5383a42015-10-06 16:28:32 +02002992
Denis Egorenko2e6ad0f2019-10-02 14:57:10 +04002993Switch Kernel from non-HWE to HWE
2994==================================
2995
2996It is possible to switch Kernel from non-HWE to HWE by using module
2997linux_kernel_switch. It has few methods:
2998
2999* check_hwe_kernel
3000* switch_kernel
3001* rollback_switch_kernel
3002
3003Method ``check_hwe_kernel`` allows to check whether HWE kernel installed
3004or not:
3005
3006.. code-block:: bash
3007
3008 salt <target> linux_kernel_switch.check_hwe_kernel
3009
3010Output for case HWE is installed:
3011
3012.. code-bloc:: bash
3013
3014 kvm02.cluster-env.local:
3015 ----------
3016 linux-image-extra-virtual-hwe-16.04:
3017 ----------
3018 linux-image-extra-virtual-hwe-16.04:
3019 ----------
3020 architecture:
3021 amd64
3022 description:
3023 Extra drivers for Virtual Linux kernel image
3024 This package will always depend on linux-image-generic.
3025 group:
3026 kernel
3027 install_date:
3028 2019-10-01T11:50:15Z
3029 name:
3030 linux-image-extra-virtual-hwe-16.04
3031 packager:
3032 Ubuntu Kernel Team <kernel-team@lists.ubuntu.com>
3033 source:
3034 linux-meta-hwe
3035 version:
3036 4.15.0.54.75
3037 ...
3038
3039Output for case HWE is not installed:
3040
3041.. code-bloc:: bash
3042
3043 kvm02.cluster-env.local:
3044 ----------
3045 linux-image-extra-virtual-hwe-16.04:
3046 Not installed!
3047 linux-image-generic-hwe-16.04:
3048 Not installed!
3049
3050Method ``switch_kernel`` allows you to switch from non-HWE to HWE. It has
3051two options: ``dry_run`` - to check what packages are going to be installed or
3052removed and ``only_kernel`` - install only Kernel image packages without other
3053HWE packages.
3054
3055Method ``rollback_switch_kernel`` allows you to rollback method
3056``switch_kernel`` which was executed successfully previously. Option
3057``dry_run`` - to check what packages are going to be installed/removed.
3058
Filip Pytlounf5383a42015-10-06 16:28:32 +02003059Read more
3060=========
3061
3062* https://www.archlinux.org/
3063* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu