blob: 9a6b24ba38f4dd14a74221b5ef21832b02510e10 [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
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002216Set up ``resolvconf's basic resolver info``, e.g. nameservers, search/domain and options:
Filip Pytlounde9bea52016-01-11 15:39:10 +01002217
2218.. code-block:: yaml
2219
2220 linux:
2221 network:
2222 resolv:
2223 dns:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002224 - 8.8.4.4
2225 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01002226 domain: my.example.com
2227 search:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002228 - my.example.com
2229 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01002230 options:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002231 - ndots:5
2232 - timeout:2
2233 - attempts:2
Filip Pytlounde9bea52016-01-11 15:39:10 +01002234
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002235Set up custom TX queue length for tap interfaces:
Andrii Petrenko735761d2017-03-21 17:17:35 -07002236
2237.. code-block:: yaml
2238
2239 linux:
2240 network:
Dzmitry Stremkouskif76e8092020-09-14 17:41:49 +02002241 custom_txqueuelen
2242 tap:
2243 queue_length: 10000
2244 enabled: true
2245 device_filter: 'tap[0-9a-z\-]*'
2246 ten:
2247 enabled: false
2248 veth:
2249 queue_length: 20000
Andrii Petrenko735761d2017-03-21 17:17:35 -07002250
Michael Polenchukc37bd4a2019-04-22 15:20:03 +04002251Auto repair/re-attach libvirt's vnet interfaces:
2252
2253.. code-block:: yaml
2254
2255 linux:
2256 network:
2257 libvirt_vnet_repair: true
2258
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002259DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002260
2261**DPDK OVS NIC**
2262
2263.. code-block:: yaml
2264
2265 linux:
2266 network:
2267 bridge: openvswitch
2268 dpdk:
2269 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002270 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002271 openvswitch:
2272 pmd_cpu_mask: "0x6"
2273 dpdk_socket_mem: "1024,1024"
2274 dpdk_lcore_mask: "0x400"
2275 memory_channels: 2
2276 interface:
2277 dpkd0:
2278 name: ${_param:dpdk_nic}
2279 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002280 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002281 enabled: true
2282 type: dpdk_ovs_port
2283 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002284 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002285 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01002286 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002287 br-prv:
2288 enabled: true
2289 type: dpdk_ovs_bridge
Michael Polenchuk70147482018-12-29 16:46:50 +04002290 br-floating:
2291 enabled: true
2292 type: ovs_bridge
2293 name_servers:
2294 - 1.1.1.1
2295 - 9.9.9.9
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002296
2297**DPDK OVS Bond**
2298
2299.. code-block:: yaml
2300
2301 linux:
2302 network:
2303 bridge: openvswitch
2304 dpdk:
2305 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002306 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002307 openvswitch:
2308 pmd_cpu_mask: "0x6"
2309 dpdk_socket_mem: "1024,1024"
2310 dpdk_lcore_mask: "0x400"
2311 memory_channels: 2
2312 interface:
2313 dpdk_second_nic:
2314 name: ${_param:primary_second_nic}
2315 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002316 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002317 bond: dpdkbond0
2318 enabled: true
2319 type: dpdk_ovs_port
2320 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002321 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002322 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002323 dpdk_first_nic:
2324 name: ${_param:primary_first_nic}
2325 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002326 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002327 bond: dpdkbond0
2328 enabled: true
2329 type: dpdk_ovs_port
2330 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002331 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002332 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002333 dpdkbond0:
2334 enabled: true
2335 bridge: br-prv
2336 type: dpdk_ovs_bond
2337 mode: active-backup
2338 br-prv:
2339 enabled: true
2340 type: dpdk_ovs_bridge
2341
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01002342**DPDK OVS LACP Bond with vlan tag**
2343
2344.. code-block:: yaml
2345
2346 linux:
2347 network:
2348 bridge: openvswitch
2349 dpdk:
2350 enabled: true
2351 driver: uio
2352 openvswitch:
2353 pmd_cpu_mask: "0x6"
2354 dpdk_socket_mem: "1024,1024"
2355 dpdk_lcore_mask: "0x400"
2356 memory_channels: "2"
2357 interface:
2358 eth3:
2359 enabled: true
2360 type: eth
2361 proto: manual
2362 name: ${_param:tenant_first_nic}
2363 eth4:
2364 enabled: true
2365 type: eth
2366 proto: manual
2367 name: ${_param:tenant_second_nic}
2368 dpdk0:
2369 name: ${_param:tenant_first_nic}
2370 pci: "0000:81:00.0"
2371 driver: igb_uio
2372 bond: bond1
2373 enabled: true
2374 type: dpdk_ovs_port
2375 n_rxq: 2
2376 dpdk1:
2377 name: ${_param:tenant_second_nic}
2378 pci: "0000:81:00.1"
2379 driver: igb_uio
2380 bond: bond1
2381 enabled: true
2382 type: dpdk_ovs_port
2383 n_rxq: 2
2384 bond1:
2385 enabled: true
2386 bridge: br-prv
2387 type: dpdk_ovs_bond
2388 mode: balance-slb
2389 br-prv:
2390 enabled: true
2391 type: dpdk_ovs_bridge
2392 tag: ${_param:tenant_vlan}
2393 address: ${_param:tenant_address}
2394 netmask: ${_param:tenant_network_netmask}
2395
Jakub Pavlikaa759062017-03-13 15:57:26 +01002396**DPDK OVS bridge for VXLAN**
2397
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002398If VXLAN is used as tenant segmentation, IP address must
2399be set on ``br-prv``.
Jakub Pavlikaa759062017-03-13 15:57:26 +01002400
2401.. code-block:: yaml
2402
2403 linux:
2404 network:
2405 ...
2406 interface:
2407 br-prv:
2408 enabled: true
2409 type: dpdk_ovs_bridge
2410 address: 192.168.50.0
2411 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04002412 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01002413 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002414
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02002415**DPDK OVS bridge with Linux network interface**
2416
2417.. code-block:: yaml
2418
2419 linux:
2420 network:
2421 ...
2422 interface:
2423 eth0:
2424 type: eth
2425 ovs_bridge: br-prv
2426 ...
2427 br-prv:
2428 enabled: true
2429 type: dpdk_ovs_bridge
2430 ...
2431
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002432Linux storage
2433-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02002434
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002435Linux with mounted Samba:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002436
2437.. code-block:: yaml
2438
2439 linux:
2440 storage:
2441 enabled: true
2442 mount:
2443 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01002444 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002445 - path: /media/myuser/public/
2446 - device: //192.168.0.1/storage
2447 - file_system: cifs
2448 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
2449
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002450NFS mount:
Jiri Broulikb017f932017-03-31 13:55:36 +02002451
2452.. code-block:: yaml
2453
2454 linux:
2455 storage:
2456 enabled: true
2457 mount:
2458 nfs_glance:
2459 enabled: true
2460 path: /var/lib/glance/images
2461 device: 172.16.10.110:/var/nfs/glance
2462 file_system: nfs
2463 opts: rw,sync
2464
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002465File swap configuration:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002466
2467.. code-block:: yaml
2468
2469 linux:
2470 storage:
2471 enabled: true
2472 swap:
2473 file:
2474 enabled: true
2475 engine: file
2476 device: /swapfile
2477 size: 1024
2478
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002479Partition swap configuration:
Lachlan Evenson30676512016-01-22 15:43:28 -08002480
2481.. code-block:: yaml
2482
2483 linux:
2484 storage:
2485 enabled: true
2486 swap:
2487 partition:
2488 enabled: true
2489 engine: partition
2490 device: /dev/vg0/swap
2491
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002492LVM group ``vg1`` with one device and ``data`` volume mounted
2493into ``/mnt/data``.
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002494
2495.. code-block:: yaml
2496
2497 parameters:
2498 linux:
2499 storage:
Dzmitry Stremkouskif94b5852021-03-05 11:53:27 +01002500 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002501 mount:
2502 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01002503 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002504 device: /dev/vg1/data
2505 file_system: ext4
2506 path: /mnt/data
2507 lvm:
2508 vg1:
2509 enabled: true
2510 devices:
2511 - /dev/sdb
2512 volume:
2513 data:
2514 size: 40G
2515 mount: ${linux:storage:mount:data}
root3387f332019-01-11 08:55:32 +00002516 # When set they will take precedence over filters aget from volume groups.
2517 lvm_filters:
2518 10:
2519 enabled: True
2520 value: "a|loop|"
2521 20:
2522 enabled: True
2523 value: "r|/dev/hdc|"
2524 30:
2525 enabled: True
2526 value: "a|/dev/ide|"
2527 40:
2528 enabled: True
2529 value: "r|.*|"
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002530
Jakub Pavlik4f742142017-08-08 15:05:50 +02002531Create partitions on disk. Specify size in MB. It expects empty
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002532disk without any existing partitions.
2533Set ``startsector=1`` if you want to start partitions from ``2048``.
Jakub Pavlik4f742142017-08-08 15:05:50 +02002534
2535.. code-block:: yaml
2536
2537 linux:
2538 storage:
2539 disk:
2540 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01002541 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02002542 name: /dev/loop1
2543 type: gpt
2544 partitions:
2545 - size: 200 #size in MB
2546 type: fat32
2547 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02002548 mkfs: True
2549 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02002550 /dev/vda1:
2551 partitions:
2552 - size: 5
2553 type: ext2
2554 - size: 10
2555 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02002556
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002557Multipath with Fujitsu Eternus DXL:
Ales Komareka634f4b2016-10-02 13:11:04 +02002558
2559.. code-block:: yaml
2560
2561 parameters:
2562 linux:
2563 storage:
2564 multipath:
2565 enabled: true
2566 blacklist_devices:
2567 - /dev/sda
2568 - /dev/sdb
2569 backends:
2570 - fujitsu_eternus_dxl
2571
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002572Multipath with Hitachi VSP 1000:
Ales Komareka634f4b2016-10-02 13:11:04 +02002573
2574.. code-block:: yaml
2575
2576 parameters:
2577 linux:
2578 storage:
2579 multipath:
2580 enabled: true
2581 blacklist_devices:
2582 - /dev/sda
2583 - /dev/sdb
2584 backends:
2585 - hitachi_vsp1000
2586
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002587Multipath with IBM Storwize:
Ales Komareka634f4b2016-10-02 13:11:04 +02002588
2589.. code-block:: yaml
2590
2591 parameters:
2592 linux:
2593 storage:
2594 multipath:
2595 enabled: true
2596 blacklist_devices:
2597 - /dev/sda
2598 - /dev/sdb
2599 backends:
2600 - ibm_storwize
2601
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002602Multipath with multiple backends:
Ales Komareka634f4b2016-10-02 13:11:04 +02002603
2604.. code-block:: yaml
2605
2606 parameters:
2607 linux:
2608 storage:
2609 multipath:
2610 enabled: true
2611 blacklist_devices:
2612 - /dev/sda
2613 - /dev/sdb
2614 - /dev/sdc
2615 - /dev/sdd
2616 backends:
2617 - ibm_storwize
2618 - fujitsu_eternus_dxl
2619 - hitachi_vsp1000
2620
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002621PAM LDAP integration:
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002622
2623.. code-block:: yaml
2624
2625 parameters:
2626 linux:
2627 system:
2628 auth:
2629 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02002630 mkhomedir:
2631 enabled: true
2632 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002633 ldap:
2634 enabled: true
2635 binddn: cn=bind,ou=service_users,dc=example,dc=com
2636 bindpw: secret
2637 uri: ldap://127.0.0.1
2638 base: ou=users,dc=example,dc=com
2639 ldap_version: 3
2640 pagesize: 65536
2641 referrals: off
2642 filter:
2643 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2644 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2645 group: (&(objectClass=group)(gidNumber=*))
2646
Gleb Galkin93b9ae92018-10-18 13:57:30 +03002647PAM duo 2FA integration
2648
2649.. code-block:: yaml
2650
2651 parameters:
2652 linux:
2653 system:
2654 auth:
2655 enabled: true
2656 duo:
2657 enabled: true
2658 duo_host: localhost
2659 duo_ikey: DUO-INTEGRATION-KEY
2660 duo_skey: DUO-SECRET-KEY
2661
2662duo package version may be specified (optional)
2663
2664.. code-block:: yaml
2665
2666 linux:
2667 system:
2668 package:
2669 duo-unix:
2670 version: 1.10.1-0
2671
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002672Disabled multipath (the default setup):
Ales Komareka634f4b2016-10-02 13:11:04 +02002673
2674.. code-block:: yaml
2675
2676 parameters:
2677 linux:
2678 storage:
2679 multipath:
2680 enabled: false
2681
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002682Linux with local loopback device:
Simon Pasquier375001e2017-01-26 13:22:33 +01002683
2684.. code-block:: yaml
2685
2686 linux:
2687 storage:
2688 loopback:
2689 disk1:
2690 file: /srv/disk1
2691 size: 50G
2692
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002693External config generation
2694--------------------------
2695
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002696You are able to use config support metadata between formulas
2697and only generate configuration files for external use, for example, Docker, and so on.
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002698
2699.. code-block:: yaml
2700
2701 parameters:
2702 linux:
2703 system:
2704 config:
2705 pillar:
2706 jenkins:
2707 master:
2708 home: /srv/volumes/jenkins
2709 approved_scripts:
2710 - method java.net.URL openConnection
2711 credentials:
2712 - type: username_password
2713 scope: global
2714 id: test
2715 desc: Testing credentials
2716 username: test
2717 password: test
2718
Vladimir Ereminccf28842017-04-10 23:52:10 +03002719Netconsole Remote Kernel Logging
2720--------------------------------
2721
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002722Netconsole logger can be configured for the configfs-enabled kernels
2723(``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
2724applies both in runtime (if network is already configured),
2725and on-boot after an interface initialization.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002726
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002727.. note::
2728
2729 * Receiver can be located only on the same L3 domain
2730 (or you need to configure gateway MAC manually).
2731 * The Receiver MAC is detected only on configuration time.
2732 * Using broadcast MAC is not recommended.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002733
2734.. code-block:: yaml
2735
2736 parameters:
2737 linux:
2738 system:
2739 netconsole:
2740 enabled: true
2741 port: 514 (optional)
2742 loglevel: debug (optional)
2743 target:
2744 192.168.0.1:
2745 interface: bond0
2746 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02002747
Dzmitry Stremkouskid1a268b2018-10-03 16:36:04 +02002748Check network params on the environment
2749---------------------------------------
2750
2751Grab nics and nics states
2752
2753.. code-block:: bash
2754
2755 salt osd001\* net_checks.get_nics
2756
2757**Example of system output:**
2758
2759.. code-block:: bash
2760
2761 osd001.domain.com:
2762 |_
2763 - bond0
2764 - None
2765 - 1e:c8:64:42:23:b9
2766 - 0
2767 - 1500
2768 |_
2769 - bond1
2770 - None
2771 - 3c:fd:fe:27:3b:00
2772 - 1
2773 - 9100
2774 |_
2775 - fourty1
2776 - None
2777 - 3c:fd:fe:27:3b:00
2778 - 1
2779 - 9100
2780 |_
2781 - fourty2
2782 - None
2783 - 3c:fd:fe:27:3b:02
2784 - 1
2785 - 9100
2786
2787Grab 10G nics PCI addresses for hugepages setup
2788
2789.. code-block:: bash
2790
2791 salt cmp001\* net_checks.get_ten_pci
2792
2793**Example of system output:**
2794
2795.. code-block:: bash
2796
2797 cmp001.domain.com:
2798 |_
2799 - ten1
2800 - 0000:19:00.0
2801 |_
2802 - ten2
2803 - 0000:19:00.1
2804 |_
2805 - ten3
2806 - 0000:19:00.2
2807 |_
2808 - ten4
2809 - 0000:19:00.3
2810
2811Grab ip address for an interface
2812
2813.. code-block:: bash
2814
2815 salt cmp001\* net_checks.get_ip iface=one4
2816
2817**Example of system output:**
2818
2819.. code-block:: bash
2820
2821 cmp001.domain.com:
2822 10.200.177.101
2823
2824Grab ip addresses map
2825
2826.. code-block:: bash
2827
2828 salt-call net_checks.nodes_addresses
2829
2830**Example of system output:**
2831
2832.. code-block:: bash
2833
2834 local:
2835 |_
2836 - cid01.domain.com
2837 |_
2838 |_
2839 - pxe
2840 - 10.200.177.91
2841 |_
2842 - control
2843 - 10.200.178.91
2844 |_
2845 - cmn02.domain.com
2846 |_
2847 |_
2848 - storage_access
2849 - 10.200.181.67
2850 |_
2851 - pxe
2852 - 10.200.177.67
2853 |_
2854 - control
2855 - 10.200.178.67
2856 |_
2857 - cmp010.domain.com
2858 |_
2859 |_
2860 - pxe
2861 - 10.200.177.110
2862 |_
2863 - storage_access
2864 - 10.200.181.110
2865 |_
2866 - control
2867 - 10.200.178.110
2868 |_
2869 - vxlan
2870 - 10.200.179.110
2871
2872Verify full mesh connectivity
2873
2874.. code-block:: bash
2875
2876 salt-call net_checks.ping_check
2877
2878**Example of positive system output:**
2879
2880.. code-block:: bash
2881
2882 ['PASSED']
2883 [INFO ] ['PASSED']
2884 local:
2885 True
2886
2887**Example of system output in case of failure:**
2888
2889.. code-block:: bash
2890
2891 FAILED
2892 [ERROR ] FAILED
2893 ['control: 10.0.1.92 -> 10.0.1.224: Failed']
2894 ['control: 10.0.1.93 -> 10.0.1.224: Failed']
2895 ['control: 10.0.1.51 -> 10.0.1.224: Failed']
2896 ['control: 10.0.1.102 -> 10.0.1.224: Failed']
2897 ['control: 10.0.1.13 -> 10.0.1.224: Failed']
2898 ['control: 10.0.1.81 -> 10.0.1.224: Failed']
2899 local:
2900 False
2901
2902For this feature to work, please mark addresses with some role.
2903Otherwise 'default' role is assumed and mesh would consist of all
2904addresses on the environment.
2905
2906Mesh mark is needed only for interfaces which are enabled and have
2907ip address assigned.
2908
2909Checking dhcp pxe network meaningless, as it is used for salt
2910master vs minion communications, therefore treated as checked.
2911
2912.. code-block:: yaml
2913
2914 parameters:
2915 linux:
2916 network:
2917 interface:
2918 ens3:
2919 enabled: true
2920 type: eth
2921 proto: static
2922 address: ${_param:deploy_address}
2923 netmask: ${_param:deploy_network_netmask}
2924 gateway: ${_param:deploy_network_gateway}
2925 mesh: pxe
2926
2927Check pillars for ip address duplicates
2928
2929.. code-block:: bash
2930
2931 salt-call net_checks.verify_addresses
2932
2933**Example of positive system output:**
2934
2935.. code-block:: bash
2936
2937 ['PASSED']
2938 [INFO ] ['PASSED']
2939 local:
2940 True
2941
2942**Example of system output in case of failure:**
2943
2944.. code-block:: bash
2945
2946 FAILED. Duplicates found
2947 [ERROR ] FAILED. Duplicates found
2948 ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2949 [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2950 local:
2951 False
2952
2953Generate csv report for the env
2954
2955.. code-block:: bash
2956
2957 salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
2958 | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
2959 | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
2960
2961**Example of system output:**
2962
2963.. code-block:: bash
2964
2965 server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
2966 cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
2967 cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
2968 cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
2969 cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
2970 cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
2971 cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
2972 cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
2973 cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
2974 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
2975 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
2976 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
2977 cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
2978 cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
2979 cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
2980 ...
2981
Filip Pytlounf5383a42015-10-06 16:28:32 +02002982Usage
2983=====
2984
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002985Set MTU of the eth0 network interface to 1400:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002986
2987.. code-block:: bash
2988
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002989 ip link set dev eth0 mtu 1400
Filip Pytlounf5383a42015-10-06 16:28:32 +02002990
Denis Egorenko2e6ad0f2019-10-02 14:57:10 +04002991Switch Kernel from non-HWE to HWE
2992==================================
2993
2994It is possible to switch Kernel from non-HWE to HWE by using module
2995linux_kernel_switch. It has few methods:
2996
2997* check_hwe_kernel
2998* switch_kernel
2999* rollback_switch_kernel
3000
3001Method ``check_hwe_kernel`` allows to check whether HWE kernel installed
3002or not:
3003
3004.. code-block:: bash
3005
3006 salt <target> linux_kernel_switch.check_hwe_kernel
3007
3008Output for case HWE is installed:
3009
3010.. code-bloc:: bash
3011
3012 kvm02.cluster-env.local:
3013 ----------
3014 linux-image-extra-virtual-hwe-16.04:
3015 ----------
3016 linux-image-extra-virtual-hwe-16.04:
3017 ----------
3018 architecture:
3019 amd64
3020 description:
3021 Extra drivers for Virtual Linux kernel image
3022 This package will always depend on linux-image-generic.
3023 group:
3024 kernel
3025 install_date:
3026 2019-10-01T11:50:15Z
3027 name:
3028 linux-image-extra-virtual-hwe-16.04
3029 packager:
3030 Ubuntu Kernel Team <kernel-team@lists.ubuntu.com>
3031 source:
3032 linux-meta-hwe
3033 version:
3034 4.15.0.54.75
3035 ...
3036
3037Output for case HWE is not installed:
3038
3039.. code-bloc:: bash
3040
3041 kvm02.cluster-env.local:
3042 ----------
3043 linux-image-extra-virtual-hwe-16.04:
3044 Not installed!
3045 linux-image-generic-hwe-16.04:
3046 Not installed!
3047
3048Method ``switch_kernel`` allows you to switch from non-HWE to HWE. It has
3049two options: ``dry_run`` - to check what packages are going to be installed or
3050removed and ``only_kernel`` - install only Kernel image packages without other
3051HWE packages.
3052
3053Method ``rollback_switch_kernel`` allows you to rollback method
3054``switch_kernel`` which was executed successfully previously. Option
3055``dry_run`` - to check what packages are going to be installed/removed.
3056
Filip Pytlounf5383a42015-10-06 16:28:32 +02003057Read more
3058=========
3059
3060* https://www.archlinux.org/
3061* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu