blob: 1d9cb23e16322b4b0c3d67fd51f8e4754a75348c [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 Polreichb6e6fbc2019-10-22 15:08:01 +020079Remove users data completely and terminate all user's processes:
Dzmitry Stremkouski6839f542019-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 Teselkin8e903562019-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 Teselkin8e903562019-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 Khlivnyak279aa592021-03-25 13:31:03 +0200270Set ssd scheduler on physical nodes:
271Default values are
Taras Khlivnyak559bbc02021-03-31 17:50:57 +0300272 enabled: false
Taras Khlivnyak279aa592021-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 Khlivnyak4f118d72021-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 Berezovskiyf9301e12019-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
agoriunovd7b19ce2019-02-18 11:37:32 +0200636Ensure presence of file to be decoded through file.decode module (see:
637https://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html#salt.states.file.decode):
638
639.. code-block:: yaml
640
641 linux:
642 system:
643 file:
644 /tmp/test4.txt:
645 decode: True
646 encoded_data: |
647 dGVzdDQK
648
Filip Pytloun281034a2016-01-04 18:06:22 +0100649Kernel
650~~~~~~
651
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300652Install always up to date LTS kernel and headers from Ubuntu Trusty:
Filip Pytloun281034a2016-01-04 18:06:22 +0100653
654.. code-block:: yaml
655
656 linux:
657 system:
658 kernel:
659 type: generic
660 lts: trusty
661 headers: true
662
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300663Load kernel modules and add them to ``/etc/modules``:
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100664
665.. code-block:: yaml
666
667 linux:
668 system:
669 kernel:
670 modules:
671 - nf_conntrack
672 - tp_smapi
673 - 8021q
674
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300675Configure or blacklist kernel modules with additional options to
676``/etc/modprobe.d`` following example will add
677``/etc/modprobe.d/nf_conntrack.conf`` file with line
678``options nf_conntrack hashsize=262144``:
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300679
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300680'option' can be a mapping (with 'enabled' and 'value' keys) or a scalar.
681
682Example for 'scalar' option value:
683
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300684.. code-block:: yaml
685
686 linux:
687 system:
688 kernel:
689 module:
690 nf_conntrack:
691 option:
692 hashsize: 262144
693
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300694Example for 'mapping' option value:
695
696.. code-block:: yaml
697
698 linux:
699 system:
700 kernel:
701 module:
702 nf_conntrack:
703 option:
704 hashsize:
705 enabled: true
706 value: 262144
707
708NOTE: 'enabled' key is optional and is True by default.
709
710Blacklist a module:
711
712.. code-block:: yaml
713
714 linux:
715 system:
716 kernel:
717 module:
718 nf_conntrack:
719 blacklist: true
720
721A module can have a number of aliases, wildcards are allowed.
722Define an alias for a module:
723
724.. code-block:: yaml
725
726 linux:
727 system:
728 kernel:
729 module:
730 nf_conntrack:
731 alias:
732 nfct:
733 enabled: true
734 "nf_conn*":
735 enabled: true
736
737NOTE: 'enabled' key is mandatory as there are no other keys exist.
738
739Execute custom command instead of 'insmod' when inserting a module:
740
741.. code-block:: yaml
742
743 linux:
744 system:
745 kernel:
746 module:
747 nf_conntrack:
748 install:
749 enabled: true
750 command: /bin/true
751
752NOTE: 'enabled' key is optional and is True by default.
753
754Execute custom command instead of 'rmmod' when removing a module:
755
756.. code-block:: yaml
757
758 linux:
759 system:
760 kernel:
761 module:
762 nf_conntrack:
763 remove:
764 enabled: true
765 command: /bin/true
766
767NOTE: 'enabled' key is optional and is True by default.
768
769Define module dependencies:
770
771.. code-block:: yaml
772
773 linux:
774 system:
775 kernel:
776 module:
777 nf_conntrack:
778 softdep:
779 pre:
780 1:
781 enabled: true
782 value: a
783 2:
784 enabled: true
785 value: b
786 3:
787 enabled: true
788 value: c
789 post:
790 1:
791 enabled: true
792 value: x
793 2:
794 enabled: true
795 value: y
796 3:
797 enabled: true
798 value: z
799
800NOTE: 'enabled' key is optional and is True by default.
801
802
Filip Pytloun281034a2016-01-04 18:06:22 +0100803Install specific kernel version and ensure all other kernel packages are
804not present. Also install extra modules and headers for this kernel:
805
806.. code-block:: yaml
807
808 linux:
809 system:
810 kernel:
811 type: generic
812 extra: true
813 headers: true
814 version: 4.2.0-22
815
Denis Egorenkofa2ee422019-11-06 14:02:00 +0400816Also it is possible to install Kernel with Hardware Enablement or virtual
817kernel packages. For example, for Xenial:
818
819.. code-block:: yaml
820
821 linux:
822 system:
823 kernel:
824 type: generic
825 extra: true
826 headers: true
827 version: 4.15.0-65
828 hwe:
829 type: hwe
830 version: 16.04
831 kernel_version: 4.15.0.65
832
833Set `linux:system:kernel:hwe:type:virtual` if you need Virtual kernel packages.
834
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300835Systcl kernel parameters:
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100836
837.. code-block:: yaml
838
839 linux:
840 system:
841 kernel:
842 sysctl:
843 net.ipv4.tcp_keepalive_intvl: 3
844 net.ipv4.tcp_keepalive_time: 30
845 net.ipv4.tcp_keepalive_probes: 8
846
Michael Polenchukebf55522018-01-25 13:22:39 +0400847Configure kernel boot options:
848
849.. code-block:: yaml
850
851 linux:
852 system:
853 kernel:
854 boot_options:
855 - elevator=deadline
856 - spectre_v2=off
857 - nopti
858
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100859CPU
860~~~
861
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300862Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100863
864.. code-block:: yaml
865
866 linux:
867 system:
868 cpu:
869 governor: performance
870
Nick Metzf04f5f32018-01-08 15:25:04 +0100871
Jiri Broulik303905d2018-01-11 14:12:48 +0100872CGROUPS
873~~~~~~~
874
875Setup linux cgroups:
876
877.. code-block:: yaml
878
879 linux:
880 system:
881 cgroup:
882 enabled: true
883 group:
884 ceph_group_1:
885 controller:
886 cpu:
887 shares:
888 value: 250
889 cpuacct:
890 usage:
891 value: 0
892 cpuset:
893 cpus:
894 value: 1,2,3
895 memory:
896 limit_in_bytes:
897 value: 2G
898 memsw.limit_in_bytes:
899 value: 3G
900 mapping:
901 subjects:
902 - '@ceph'
903 generic_group_1:
904 controller:
905 cpu:
906 shares:
907 value: 250
908 cpuacct:
909 usage:
910 value: 0
911 mapping:
912 subjects:
913 - '*:firefox'
914 - 'student:cp'
915
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300916Shared libraries
Nick Metzf04f5f32018-01-08 15:25:04 +0100917~~~~~~~~~~~~~~~~
918
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300919Set additional shared library to Linux system library path:
Nick Metzf04f5f32018-01-08 15:25:04 +0100920
921.. code-block:: yaml
922
923 linux:
924 system:
925 ld:
926 library:
927 java:
928 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
929 - /opt/java/jre/lib/amd64/server
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200930
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200931Certificates
932~~~~~~~~~~~~
933
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300934Add certificate authority into system trusted CA bundle:
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200935
936.. code-block:: yaml
937
938 linux:
939 system:
940 ca_certificates:
941 mycert: |
942 -----BEGIN CERTIFICATE-----
943 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
944 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
945 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
946 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
947 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
948 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
949 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
950 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
951 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
952 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
953 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
954 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
955 -----END CERTIFICATE-----
956
Filip Pytloun361096c2017-08-23 10:57:20 +0200957Sysfs
958~~~~~
959
960Install sysfsutils and set sysfs attributes:
961
962.. code-block:: yaml
963
964 linux:
965 system:
966 sysfs:
967 scheduler:
968 block/sda/queue/scheduler: deadline
969 power:
970 mode:
971 power/state: 0660
972 owner:
973 power/state: "root:power"
974 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
975
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200976Optional: You can also use list that will ensure order of items.
977
978.. code-block:: yaml
979
980 linux:
981 system:
982 sysfs:
983 scheduler:
984 block/sda/queue/scheduler: deadline
985 power:
986 - mode:
987 power/state: 0660
988 - owner:
989 power/state: "root:power"
990 - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
991
Martin Polreich148e1b82018-09-13 15:54:25 +0200992Sysfs definition with disabled automatic write. Attributes are saved
993to configuration, but are not applied during the run.
994Thay will be applied automatically after the reboot.
995
996
997.. code-block:: yaml
998
999 linux:
1000 system:
1001 sysfs:
1002 enable_apply: false
1003 scheduler:
1004 block/sda/queue/scheduler: deadline
1005
1006.. note:: The `enable_apply` parameter defaults to `True` if not defined.
1007
Jakub Pavlikb148c8c2017-02-12 21:30:48 +01001008Huge Pages
1009~~~~~~~~~~~~
1010
1011Huge Pages give a performance boost to applications that intensively deal
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001012with memory allocation/deallocation by decreasing memory fragmentation:
Jakub Pavlikb148c8c2017-02-12 21:30:48 +01001013
1014.. code-block:: yaml
1015
1016 linux:
1017 system:
1018 kernel:
1019 hugepages:
1020 small:
1021 size: 2M
1022 count: 107520
1023 mount_point: /mnt/hugepages_2MB
Michael Polenchukd9369fe2018-05-08 17:53:08 +04001024 mount: false/true # default is true (mount immediately) / false (just save in the fstab)
Jakub Pavlikb148c8c2017-02-12 21:30:48 +01001025 large:
1026 default: true # default automatically mounted
1027 size: 1G
1028 count: 210
1029 mount_point: /mnt/hugepages_1GB
1030
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001031.. note:: Not recommended to use both pagesizes concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +01001032
Jakub Pavlik5398d872017-02-13 22:30:47 +01001033Intel SR-IOV
1034~~~~~~~~~~~~
1035
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001036PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV)
1037specification defines a standardized mechanism to virtualize
1038PCIe devices. The mechanism can virtualize a single PCIe
1039Ethernet controller to appear as multiple PCIe devices:
Jakub Pavlik5398d872017-02-13 22:30:47 +01001040
1041.. code-block:: yaml
1042
1043 linux:
1044 system:
1045 kernel:
1046 sriov: True
1047 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
1048 rc:
1049 local: |
1050 #!/bin/sh -e
1051 # Enable 7 VF on eth1
1052 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
1053 exit 0
1054
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001055Isolate CPU options
1056~~~~~~~~~~~~~~~~~~~
1057
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001058Remove the specified CPUs, as defined by the cpu_number values, from
1059the general kernel SMP balancing and scheduler algroithms. The only
1060way to move a process onto or off an *isolated* CPU is via the CPU
1061affinity syscalls. ``cpu_number begins`` at ``0``, so the
1062maximum value is ``1`` less than the number of CPUs on the system.:
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001063
1064.. code-block:: yaml
1065
1066 linux:
1067 system:
1068 kernel:
1069 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +01001070
Filip Pytlounf5383a42015-10-06 16:28:32 +02001071Repositories
1072~~~~~~~~~~~~
1073
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001074RedHat-based Linux with additional OpenStack repo:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001075
1076.. code-block:: yaml
1077
1078 linux:
1079 system:
1080 ...
1081 repo:
1082 rdo-icehouse:
1083 enabled: true
1084 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
1085 pgpcheck: 0
1086
1087Ensure system repository to use czech Debian mirror (``default: true``)
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001088Also pin it's packages with priority ``900``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001089
1090.. code-block:: yaml
1091
1092 linux:
1093 system:
1094 repo:
1095 debian:
1096 default: true
1097 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
1098 # Import signing key from URL if needed
1099 key_url: "http://dummy.com/public.gpg"
1100 pin:
1101 - pin: 'origin "ftp.cz.debian.org"'
1102 priority: 900
1103 package: '*'
1104
azvyagintseva3a73d02018-12-06 14:49:58 +02001105Sometimes better to use one pining rule file, to decrease mistaken
1106ordering. You can use those option ``system:apt:preferences``, which would add opts into
1107``/etc/apt/preferences`` file:
1108
1109.. code-block:: yaml
1110
1111 parameters:
1112 linux:
1113 system:
1114 apt:
1115 preferences:
1116 enabled: true
1117 rules:
1118 100:
1119 enabled: true
1120 name: 'some origin pin'
1121 pin: 'release o=Debian'
1122 priority: 1100
1123 package: '*'
1124
1125
azvyagintsev4494a472018-09-14 19:19:23 +03001126If you need to add multiple pin rules for one repo, please use new,ordered definition format
1127('pinning' definition will be in priotity to use):
1128
1129.. code-block:: yaml
1130
1131 linux:
1132 system:
1133 repo:
1134 mcp_saltstack:
1135 source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main"
1136 architectures: amd64
1137 clean_file: true
1138 pinning:
1139 10:
1140 enabled: true
1141 pin: 'release o=SaltStack'
1142 priority: 50
1143 package: 'libsodium18'
1144 20:
1145 enabled: true
1146 pin: 'release o=SaltStack'
1147 priority: 1100
1148 package: '*'
1149
1150
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001151.. note:: For old Ubuntu releases (<xenial)
azvyagintsevff089d22018-07-27 16:52:34 +02001152 extra packages for apt transport, like ``apt-transport-https``
1153 may be required to be installed manually.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001154 (Chicken-eggs issue: we need to install packages to
azvyagintsevff089d22018-07-27 16:52:34 +02001155 reach repo from where they should be installed)
1156 Otherwise, you still can try 'fortune' and install prereq.packages before
1157 any repo configuration, using list of requires in map.jinja.
1158
1159
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001160Disabling any prerequisite packages installation:
1161
azvyagintsevff089d22018-07-27 16:52:34 +02001162You can simply drop any package pre-installation (before system.linux.repo
1163will be processed) via cluster lvl:
1164
1165.. code-block:: yaml
1166
1167 linux:
1168 system:
1169 pkgs: ~
1170
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001171Package manager proxy global setup:
Petr Michalec10462bb2017-03-23 19:18:08 +01001172
1173.. code-block:: yaml
1174
1175 linux:
1176 system:
1177 ...
1178 repo:
1179 apt-mk:
1180 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1181 ...
1182 proxy:
1183 pkg:
1184 enabled: true
1185 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1186 ...
1187 # NOTE: Global defaults for any other componet that configure proxy on the system.
1188 # If your environment has just one simple proxy, set it on linux:system:proxy.
1189 #
1190 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1191 # as for https and http
1192 ftp: ftp://proxy.host.local:2121
1193 http: http://proxy.host.local:3142
1194 https: https://proxy.host.local:3143
1195
Taras Khlivnyake64d5c92021-02-17 09:10:16 +02001196Package manager direct access setup:
1197
1198.. code-block:: yaml
1199
1200 linux:
1201 system:
1202 ...
1203 repo:
1204 apt-mk:
1205 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1206 ...
1207 proxy:
1208 pkg:
1209 enabled: true
1210 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1211 ...
1212 # NOTE: Global defaults for any other componet that configure proxy on the system.
1213 # If your environment has just one simple proxy, set it on linux:system:proxy.
1214 #
1215 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1216 # as for https and http
1217 ftp: ftp://proxy.host.local:2121
1218 http: http://proxy.host.local:3142
1219 https: https://proxy.host.local:3143
1220 direct:
1221 - 192.168.0.100
1222 - repo.wo.proxy.local
1223
1224
Petr Michalec10462bb2017-03-23 19:18:08 +01001225Package manager proxy setup per repository:
1226
1227.. code-block:: yaml
1228
1229 linux:
1230 system:
1231 ...
1232 repo:
1233 debian:
1234 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1235 ...
1236 apt-mk:
1237 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1238 # per repository proxy
1239 proxy:
1240 enabled: true
1241 http: http://maas-01:8080
1242 https: http://maas-01:8080
1243 ...
1244 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001245 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +01001246 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
1247 pkg:
1248 enabled: true
1249 ftp: ftp://proxy.host.local:2121
1250 #http: http://proxy.host.local:3142
1251 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001252 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001253 # global system fallback system defaults
1254 ftp: ftp://proxy.host.local:2121
1255 http: http://proxy.host.local:3142
1256 https: https://proxy.host.local:3143
1257
Ivan Berezovskiy6335da52019-06-25 20:15:51 +04001258
1259Add secured apt repository:
1260
1261.. code-block:: yaml
1262
1263 linux:
1264 system:
1265 ...
1266 repo:
1267 test:
1268 secure: true
1269 url: example.org/ubuntu
1270 arch: deb
1271 protocol: http
1272 user: foo
1273 password: bar
1274 distribution: stable
1275 component: main
1276
1277Add multiply secured apt repositories with same credentials:
1278
1279.. code-block:: yaml
1280
1281 linux:
1282 system:
1283 ...
1284 common_repo_secured:
1285 arch: deb
1286 protocol: http
1287 user: foo
1288 password: bar
1289 distribution: stable
1290 component: main
1291 repo:
1292 test1:
1293 secure: true
1294 url: example1.org/ubuntu
1295 test2:
1296 secure: true
1297 url: example2.org/ubuntu
1298
Denis Egorenko808bd032019-12-05 15:46:06 +04001299Also it is possible to specify list of repos, which should be secured
1300within ``common_repo_secured`` block and without changing current
1301existing repo source parameter:
1302
1303.. code-block:: yaml
1304
1305 linux:
1306 system:
1307 ...
1308 common_repo_secured:
1309 user: foo
1310 password: bar
1311 secured_repos: [ 'test1', 'test2' ]
1312 repo:
1313 test1:
1314 ...
1315 test2:
1316 ...
1317 test3:
1318 ...
1319
1320Repos ``test1, test2`` will be secured. In case if you want secure all
1321available repos use ``secured_repos: [ 'all' ]``. But repo parameters have
1322precedence over parameters from ``common_repo_secured``. In next case:
1323
1324 linux:
1325 system:
1326 ...
1327 common_repo_secured:
1328 user: foo
1329 password: bar
1330 secured_repos: [ 'all' ]
1331 repo:
1332 test1:
1333 ...
1334 test2:
1335 ...
1336 test3:
1337 secure: False
1338 ...
1339
1340Repo ``test3`` will not be secured.
1341
Jiri Broulik34a29b42017-04-25 14:42:54 +02001342Remove all repositories:
1343
1344.. code-block:: yaml
1345
1346 linux:
1347 system:
1348 purge_repos: true
1349
azvyagintsevff089d22018-07-27 16:52:34 +02001350Refresh repositories metada, after configuration:
1351
1352.. code-block:: yaml
1353
1354 linux:
1355 system:
1356 refresh_repos_meta: true
1357
Filip Pytlounc512e6c2017-11-22 14:28:10 +01001358Setup custom apt config options:
1359
1360.. code-block:: yaml
1361
1362 linux:
1363 system:
1364 apt:
1365 config:
1366 compression-workaround:
1367 "Acquire::CompressionTypes::Order": "gz"
1368 docker-clean:
1369 "DPkg::Post-Invoke":
1370 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
1371 "APT::Update::Post-Invoke":
1372 - "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 +02001373
Petr Michalec10462bb2017-03-23 19:18:08 +01001374RC
1375~~
1376
Jakub Pavlik78859382016-01-21 11:26:39 +01001377rc.local example
1378
1379.. code-block:: yaml
1380
1381 linux:
1382 system:
1383 rc:
1384 local: |
1385 #!/bin/sh -e
1386 #
1387 # rc.local
1388 #
1389 # This script is executed at the end of each multiuser runlevel.
1390 # Make sure that the script will "exit 0" on success or any other
1391 # value on error.
1392 #
1393 # In order to enable or disable this script just change the execution
1394 # bits.
1395 #
1396 # By default this script does nothing.
1397 exit 0
1398
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001399Prompt
1400~~~~~~
1401
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001402Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``.
1403Every user can have different prompt:
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001404
1405.. code-block:: yaml
1406
1407 linux:
1408 system:
1409 prompt:
1410 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\\]
1411 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
1412
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001413On Debian systems, to set prompt system-wide, it's necessary to
1414remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``,
1415which comes from ``/etc/skel/.bashrc``. This formula will do
1416this automatically, but will not touch existing user's
1417``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +01001418
Filip Pytlouneef11c12016-03-25 11:00:23 +01001419Bash
1420~~~~
1421
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001422Fix bash configuration to preserve history across sessions
1423like ZSH does by default:
Filip Pytlouneef11c12016-03-25 11:00:23 +01001424
1425.. code-block:: yaml
1426
1427 linux:
1428 system:
1429 bash:
1430 preserve_history: true
1431
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001432Login banner message
1433~~~~~~~~~~~~~~~~~~~~
1434
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001435``/etc/issue`` is a text file which contains a message or system
1436identification to be printed before the login prompt. It may contain
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001437various @char and \char sequences, if supported by the getty-type
1438program employed on the system.
1439
1440Setting logon banner message is easy:
1441
1442.. code-block:: yaml
1443
1444 liunx:
1445 system:
1446 banner:
1447 enabled: true
1448 contents: |
1449 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1450
1451 You must have explicit, authorized permission to access or configure this
1452 device. Unauthorized attempts and actions to access or use this system may
1453 result in civil and/or criminal penalties.
1454 All activities performed on this system are logged and monitored.
1455
Filip Pytloune874dfb2016-01-22 16:57:34 +01001456Message of the day
1457~~~~~~~~~~~~~~~~~~
1458
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001459``pam_motd`` from package ``libpam-modules`` is used for dynamic
1460messages of the day. Setting custom ``motd`` will clean up existing ones.
Filip Pytloune874dfb2016-01-22 16:57:34 +01001461
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001462Setting static ``motd`` will replace existing ``/etc/motd`` and remove
1463scripts from ``/etc/update-motd.d``.
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001464
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001465Setting static ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001466
1467.. code-block:: yaml
1468
1469 linux:
1470 system:
1471 motd: |
1472 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1473
1474 You must have explicit, authorized permission to access or configure this
1475 device. Unauthorized attempts and actions to access or use this system may
1476 result in civil and/or criminal penalties.
1477 All activities performed on this system are logged and monitored.
1478
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001479Setting dynamic ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001480
Filip Pytloune874dfb2016-01-22 16:57:34 +01001481.. code-block:: yaml
1482
1483 linux:
1484 system:
1485 motd:
1486 - release: |
1487 #!/bin/sh
1488 [ -r /etc/lsb-release ] && . /etc/lsb-release
1489
1490 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
1491 # Fall back to using the very slow lsb_release utility
1492 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
1493 fi
1494
1495 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
1496 - warning: |
1497 #!/bin/sh
1498 printf "This is [company name] network.\n"
1499 printf "Unauthorized access strictly prohibited.\n"
1500
Marek Celoud713e9072017-05-18 15:20:25 +02001501Services
1502~~~~~~~~
1503
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001504Stop and disable the ``linux`` service:
Marek Celoud713e9072017-05-18 15:20:25 +02001505
1506.. code-block:: yaml
1507
1508 linux:
1509 system:
1510 service:
1511 apt-daily.timer:
1512 status: dead
1513
Dzmitry Stremkouski70d09782018-11-30 16:04:59 +01001514Override systemd service unit:
1515
1516.. code-block:: yaml
1517
1518 parameters:
1519
1520 linux:
1521 system:
1522 service:
1523 tgt:
1524 name: tgt
1525 status: running
1526 enabled: True
1527 override:
1528 50:
1529 target: tgt.service.d
1530 name: bind
1531 content: |
1532 [Service]
1533 ExecStart=
1534 ExecStart=/usr/sbin/tgtd -f --iscsi portal=${_param:single_address}:3260
1535
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001536Possible statuses are ``dead`` (disable service by default), ``running``
1537(enable service by default), ``enabled``, ``disabled``:
Marek Celoud713e9072017-05-18 15:20:25 +02001538
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001539Linux with the ``atop`` service:
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +03001540
1541.. code-block:: yaml
1542
1543 linux:
1544 system:
1545 atop:
1546 enabled: true
1547 interval: 20
1548 logpath: "/var/log/atop"
1549 outfile: "/var/log/atop/daily.log"
1550
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001551Linux with the ``mcelog`` service:
Oleksii Chupryn144432b2018-05-22 10:34:48 +03001552
1553.. code-block:: yaml
1554
1555 linux:
1556 system:
1557 mcelog:
1558 enabled: true
1559 logging:
1560 syslog: true
1561 syslog_error: true
1562
Denis Egorenkof0ef8c22019-11-22 17:26:30 +04001563Linux Sosreport
1564^^^^^^^^^^^^^^^
1565
1566Sosreport is an extensible, portable, support data collection tool
1567primarily aimed at Linux distributions and other UNIX-like operating systems,
1568which allows to create diagnostic snapshot of system.
1569
1570Works out of box and additional pillars are not needed by default:
1571
1572.. code-block:: bash
1573
1574 salt-call state.sls linux.system.sosreport.report
1575
1576or from Salt Master:
1577
1578.. code-block:: bash
1579
1580 salt -C '<target>' state.sls linux.system.sosreport.report
1581
1582Sosreport configuration may be extended with next pillar data:
1583
1584.. code-block:: yaml
1585
1586 linux:
1587 system:
1588 sosreport:
1589 cmd_options:
1590 tmp-dir: /root/reportdir
1591 no_arg_opts: [ '-q' ]
1592 config_options:
1593 general:
1594 all-logs: true
1595 plugins:
1596 disabled: [ docker ]
1597 tunables:
1598 apache.log: true
1599
1600Where is ``cmd_options`` additional provided arguments for cli cmd call,
1601``general`` desribes parameters for sos.conf ``general`` section,
1602``plugins`` desribes which plugins should be ``enabled`` or ``disabled``
1603and ``tunables`` has custom plugin options which can be additionally set.
1604
1605Also it is possible to pass cmd_options through pillar override:
1606
1607.. code-block:: bash
1608
1609 salt -C '<target>' state.sls linux.system.sosreport.report pillar='{ "sosreport" : { "ticket-number": 12345, "tmp-dir": "/root/reportdir2" } }'
1610
1611Run ``sosreport --help`` to get full list of possible options.
1612
1613Once state ``linux.system.sosreport.report`` is executed on targets, it is
1614possible to collect all reports by using next command on Salt Master:
1615
1616.. code-block:: bash
1617
1618 salt -C 'I@salt:master' state.sls linux.system.sosreport.collect pillar='{ "sosreport_collect" : { "target": "<target>", "archiveName": "sosreport_<env_name>_<customer>_<ticket>" } }'
1619
1620This will generate one common archive for all ``<target>`` nodes with name
1621``sosreport_<env_name>_<customer>_<ticket>.tar.gz``. It is required to specify
1622target nodes through model (``linux.system.sosreport.collect``) or pillar
1623override. Also possible options are: ``nodeIp`` which allows you to use IP from another
1624interface on node (should be available from minions), ``port`` for NetCat if
1625you see that default port is busy, ``archiveName`` for your archive and
1626``reportWorkDir`` directory to keeping all reports for current case.
1627
Filip Pytloun2f70b492016-02-19 15:55:25 +01001628RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +01001629^^^^^^^^^^^^^
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001630Currently, ``update-motd`` is not available
1631for RHEL. So there is no native support for dynamic ``motd``.
1632You can still set a static one, with a different pillar structure:
Filip Pytloun2f70b492016-02-19 15:55:25 +01001633
1634.. code-block:: yaml
1635
1636 linux:
1637 system:
1638 motd: |
1639 This is [company name] network.
1640 Unauthorized access strictly prohibited.
1641
Filip Pytloun8296bb92016-02-19 18:42:09 +01001642Haveged
1643~~~~~~~
1644
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001645If you are running headless server and are low on entropy,
1646you may set up Haveged:
Filip Pytloun8296bb92016-02-19 18:42:09 +01001647
1648.. code-block:: yaml
1649
1650 linux:
1651 system:
1652 haveged:
1653 enabled: true
1654
Filip Pytlounf5383a42015-10-06 16:28:32 +02001655Linux network
1656-------------
1657
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001658Linux with network manager:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001659
1660.. code-block:: yaml
1661
1662 linux:
1663 network:
1664 enabled: true
1665 network_manager: true
1666
Dzmitry Stremkouski00cdbe62018-10-31 16:41:54 +01001667Execute linux.network.interface state without ifupdown activity:
1668
1669.. code-block:: bash
1670
1671 salt-call linux.network.interface pillar='{"linux":{"network":{"noifupdown":True}}}'
1672
1673
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001674Linux with default static network interfaces, default gateway
1675interface and DNS servers:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001676
1677.. code-block:: yaml
1678
1679 linux:
1680 network:
1681 enabled: true
1682 interface:
1683 eth0:
1684 enabled: true
1685 type: eth
1686 address: 192.168.0.102
1687 netmask: 255.255.255.0
1688 gateway: 192.168.0.1
1689 name_servers:
1690 - 8.8.8.8
1691 - 8.8.4.4
1692 mtu: 1500
1693
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001694Linux with bonded interfaces and disabled ``NetworkManager``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001695
1696.. code-block:: yaml
1697
1698 linux:
1699 network:
1700 enabled: true
1701 interface:
1702 eth0:
1703 type: eth
1704 ...
1705 eth1:
1706 type: eth
1707 ...
1708 bond0:
1709 enabled: true
1710 type: bond
1711 address: 192.168.0.102
1712 netmask: 255.255.255.0
Dzmitry Stremkouskif6fb7212019-08-26 16:48:05 +02001713 proto: manual
1714 mtu: 9000
1715 name: ${_param:vlan_bond_name}
1716 slaves: ${_param:vlan_nic1} ${_param:vlan_nic2}
1717 mode: 802.3ad
1718 lacp_rate: slow
1719 downdelay: 200
1720 xmit_hash_policy: layer3+4
1721 miimon: 100
1722 use_interfaces:
1723 - ${_param:vlan_nic1}
1724 - ${_param:vlan_nic2}
1725 require_interfaces:
1726 - ${_param:vlan_nic1}
1727 - ${_param:vlan_nic2}
jan kaufman6d30adf2016-01-18 17:30:12 +01001728 network_manager:
1729 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001730
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001731Linux with VLAN ``interface_params``:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001732
1733.. code-block:: yaml
1734
1735 linux:
1736 network:
1737 enabled: true
1738 interface:
1739 vlan69:
1740 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001741 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001742 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001743
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001744Linux with wireless interface parameters:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001745
1746.. code-block:: yaml
1747
1748 linux:
1749 network:
1750 enabled: true
1751 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001752 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001753 interface:
1754 wlan0:
1755 type: eth
1756 wireless:
1757 essid: example
1758 key: example_key
1759 security: wpa
1760 priority: 1
1761
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001762Linux networks with routes defined:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001763
1764.. code-block:: yaml
1765
1766 linux:
1767 network:
1768 enabled: true
1769 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001770 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001771 interface:
1772 eth0:
1773 type: eth
1774 route:
1775 default:
1776 address: 192.168.0.123
1777 netmask: 255.255.255.0
1778 gateway: 192.168.0.1
1779
ivcc4730b12019-01-23 07:56:53 +03001780Linux networks with implicit routes definition:
1781
1782- on node 1:
1783
1784.. code-block:: yaml
1785
1786 linux:
1787 network:
1788 enabled: true
1789 router:
1790 ctl:
1791 # router that connects 10.0.1.0/24 and 10.0.2.0/24
1792 addresses:
1793 - 10.0.1.1/24
1794 - 10.0.2.1/24
1795 test:
1796 addresses:
1797 - 10.0.1.2/24
1798 networks:
1799 - 10.100.0.0/16
1800 interface:
1801 ctl:
1802 name: eth0
1803 address: 10.0.1.101
1804 netmask: 255.255.255.0
1805
1806- on node2:
1807
1808.. code-block:: yaml
1809
1810 linux:
1811 network:
1812 enabled: true
1813 router:
1814 ctl:
1815 # equivalent of node1's ctl router with 'implicit_routes = false'
1816 options:
1817 implicit_routes: false
1818 addresses:
1819 - 10.0.1.1/24
1820 - 10.0.2.1/24
1821 networks:
1822 - 10.0.1.0/24
1823 - 10.0.2.0/24
1824 interface:
1825 ctl:
1826 name: eth0
1827 address: 10.0.2.101
1828 netmask: 255.255.255.0
1829
1830
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001831Native Linux Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001832
1833.. code-block:: yaml
1834
1835 linux:
1836 network:
1837 interface:
1838 eth1:
1839 enabled: true
1840 type: eth
1841 proto: manual
1842 up_cmds:
1843 - ip address add 0/0 dev $IFACE
1844 - ip link set $IFACE up
1845 down_cmds:
1846 - ip link set $IFACE down
1847 br-ex:
1848 enabled: true
1849 type: bridge
1850 address: ${linux:network:host:public_local:address}
1851 netmask: 255.255.255.0
1852 use_interfaces:
1853 - eth1
1854
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001855Open vSwitch Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001856
1857.. code-block:: yaml
1858
1859 linux:
1860 network:
1861 bridge: openvswitch
1862 interface:
1863 eth1:
1864 enabled: true
1865 type: eth
1866 proto: manual
1867 up_cmds:
1868 - ip address add 0/0 dev $IFACE
1869 - ip link set $IFACE up
1870 down_cmds:
1871 - ip link set $IFACE down
1872 br-ex:
1873 enabled: true
1874 type: bridge
1875 address: ${linux:network:host:public_local:address}
1876 netmask: 255.255.255.0
1877 use_interfaces:
1878 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001879 br-prv:
1880 enabled: true
1881 type: ovs_bridge
1882 mtu: 65000
1883 br-ens7:
1884 enabled: true
1885 name: br-ens7
1886 type: ovs_bridge
1887 proto: manual
1888 mtu: 9000
1889 use_interfaces:
1890 - ens7
1891 patch-br-ens7-br-prv:
1892 enabled: true
1893 name: ens7-prv
1894 ovs_type: ovs_port
1895 type: ovs_port
1896 bridge: br-ens7
1897 port_type: patch
1898 peer: prv-ens7
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001899 tag: 109 # [] to unset a tag
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001900 mtu: 65000
1901 patch-br-prv-br-ens7:
1902 enabled: true
1903 name: prv-ens7
1904 bridge: br-prv
1905 ovs_type: ovs_port
1906 type: ovs_port
1907 port_type: patch
1908 peer: ens7-prv
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001909 tag: 109
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001910 mtu: 65000
1911 ens7:
1912 enabled: true
1913 name: ens7
1914 proto: manual
1915 ovs_port_type: OVSPort
1916 type: ovs_port
1917 ovs_bridge: br-ens7
1918 bridge: br-ens7
Oleg Gelbukh52f9f762019-07-01 15:26:16 -07001919 ens6:
1920 enabled: true
1921 proto: manual
1922 type: eth
1923 ovs_bridge: br-ctl
1924 br-ctl:
1925 enabled: true
1926 type: ovs_bridge
1927 internal-br-ctl-port:
1928 enabled: true
1929 proto: static
1930 address: 172.172.0.10
1931 netmask: 255.255.0.0
1932 name_servers:
1933 - 8.8.8.8
1934 - 172.172.172.172
1935 name: port-br-ctl
1936 bridge: br-ctl
1937 ovs_type: ovs_port
1938 type: ovs_port
1939 port_type: internal
1940 mtu: 65000
Filip Pytlounf5383a42015-10-06 16:28:32 +02001941
Petr Jediný8f8ae542017-07-13 16:19:12 +02001942Debian manual proto interfaces
1943
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001944When you are changing interface proto from static in up state
1945to manual, you may need to flush ip addresses. For example,
1946if you want to use the interface and the ip on the bridge.
1947This can be done by setting the ``ipflush_onchange`` to true.
Petr Jediný8f8ae542017-07-13 16:19:12 +02001948
1949.. code-block:: yaml
1950
1951 linux:
1952 network:
1953 interface:
1954 eth1:
1955 enabled: true
1956 type: eth
1957 proto: manual
1958 mtu: 9100
1959 ipflush_onchange: true
1960
Jiri Broulik1a191e32018-01-15 15:54:21 +01001961Debian static proto interfaces
1962
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001963When you are changing interface proto from dhcp in up state to
1964static, you may need to flush ip addresses and restart interface
1965to assign ip address from a managed file. For example, if you wantto
1966use the interface and the ip on the bridge. This can be done by
1967setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
1968param set to true.
Jiri Broulik1a191e32018-01-15 15:54:21 +01001969
1970.. code-block:: yaml
1971
1972 linux:
1973 network:
1974 interface:
1975 eth1:
1976 enabled: true
1977 type: eth
1978 proto: static
1979 address: 10.1.0.22
1980 netmask: 255.255.255.0
1981 ipflush_onchange: true
1982 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001983
Petr Jedinýd577cb52017-06-28 20:17:49 +02001984Concatinating and removing interface files
1985
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001986Debian based distributions have ``/etc/network/interfaces.d/``
1987directory, where you can store configuration of network
1988interfaces in separate files. You can concatinate the files
1989to the defined destination when needed, this operation removes
1990the file from the ``/etc/network/interfaces.d/``. If you just need
1991to remove iface files, you can use the ``remove_iface_files`` key.
Petr Jedinýd577cb52017-06-28 20:17:49 +02001992
1993.. code-block:: yaml
1994
1995 linux:
1996 network:
1997 concat_iface_files:
1998 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1999 dst: '/etc/network/interfaces'
2000 remove_iface_files:
2001 - '/etc/network/interfaces.d/90-custom.cfg'
2002
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002003Configure DHCP client
Petr Jedinýd577cb52017-06-28 20:17:49 +02002004
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002005None of the keys is mandatory, include only those you really need.
2006For full list of available options under send, supersede, prepend,
2007append refer to dhcp-options(5).
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06002008
2009.. code-block:: yaml
2010
2011 linux:
2012 network:
2013 dhclient:
2014 enabled: true
2015 backoff_cutoff: 15
2016 initial_interval: 10
2017 reboot: 10
2018 retry: 60
2019 select_timeout: 0
2020 timeout: 120
2021 send:
2022 - option: host-name
2023 declaration: "= gethostname()"
2024 supersede:
2025 - option: host-name
2026 declaration: "spaceship"
2027 - option: domain-name
2028 declaration: "domain.home"
2029 #- option: arp-cache-timeout
2030 # declaration: 20
2031 prepend:
2032 - option: domain-name-servers
2033 declaration:
2034 - 8.8.8.8
2035 - 8.8.4.4
2036 - option: domain-search
2037 declaration:
2038 - example.com
2039 - eng.example.com
2040 #append:
2041 #- option: domain-name-servers
2042 # declaration: 127.0.0.1
2043 # ip or subnet to reject dhcp offer from
2044 reject:
2045 - 192.33.137.209
2046 - 10.0.2.0/24
2047 request:
2048 - subnet-mask
2049 - broadcast-address
2050 - time-offset
2051 - routers
2052 - domain-name
2053 - domain-name-servers
2054 - domain-search
2055 - host-name
2056 - dhcp6.name-servers
2057 - dhcp6.domain-search
2058 - dhcp6.fqdn
2059 - dhcp6.sntp-servers
2060 - netbios-name-servers
2061 - netbios-scope
2062 - interface-mtu
2063 - rfc3442-classless-static-routes
2064 - ntp-servers
2065 require:
2066 - subnet-mask
2067 - domain-name-servers
2068 # if per interface configuration required add below
2069 interface:
2070 ens2:
2071 initial_interval: 11
2072 reject:
2073 - 192.33.137.210
2074 ens3:
2075 initial_interval: 12
2076 reject:
2077 - 192.33.137.211
2078
Petr Michaleceb14b552017-06-01 10:27:05 +02002079Linux network systemd settings:
2080
2081.. code-block:: yaml
2082
2083 linux:
2084 network:
2085 ...
2086 systemd:
2087 link:
2088 10-iface-dmz:
2089 Match:
2090 MACAddress: c8:5b:67:fa:1a:af
2091 OriginalName: eth0
2092 Link:
2093 Name: dmz0
2094 netdev:
2095 20-bridge-dmz:
2096 match:
2097 name: dmz0
2098 network:
2099 mescription: bridge
2100 bridge: br-dmz0
2101 network:
2102 # works with lowercase, keys are by default capitalized
2103 40-dhcp:
2104 match:
2105 name: '*'
2106 network:
2107 DHCP: yes
2108
Petr Michalec10462bb2017-03-23 19:18:08 +01002109Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01002110
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002111Use ``/etc/environment`` for static system wide variable assignment
2112after boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002113
2114.. code-block:: yaml
2115
2116 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01002117 system:
2118 env:
2119 BOB_VARIABLE: Alice
2120 ...
2121 BOB_PATH:
2122 - /srv/alice/bin
2123 - /srv/bob/bin
2124 ...
2125 ftp_proxy: none
2126 http_proxy: http://global-http-proxy.host.local:8080
2127 https_proxy: ${linux:system:proxy:https}
2128 no_proxy:
2129 - 192.168.0.80
2130 - 192.168.1.80
2131 - .domain.com
2132 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02002133 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01002134 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002135 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01002136 ftp: ftp://proxy.host.local:2121
2137 http: http://proxy.host.local:3142
2138 https: https://proxy.host.local:3143
2139 noproxy:
2140 - .domain.com
2141 - .local
2142
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002143Configure the ``profile.d`` scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01002144
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002145The ``profile.d`` scripts are being sourced during ``.sh`` execution
2146and support variable expansion in opposite to /etc/environment global
2147settings in ``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01002148
2149.. code-block:: yaml
2150
2151 linux:
2152 system:
2153 profile:
2154 locales: |
2155 export LANG=C
2156 export LC_ALL=C
2157 ...
2158 vi_flavors.sh: |
2159 export PAGER=view
2160 export EDITOR=vim
2161 alias vi=vim
2162 shell_locales.sh: |
2163 export LANG=en_US
2164 export LC_ALL=en_US.UTF-8
2165 shell_proxies.sh: |
2166 export FTP_PROXY=ftp://127.0.3.3:2121
2167 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02002168
Dmitry Teselkina0d31d12018-09-04 14:43:09 +03002169
2170Configure login.defs parameters
2171-------------------------------
2172
2173.. code-block:: yaml
2174
2175 linux:
2176 system:
2177 login_defs:
2178 <opt_name>:
2179 enabled: true
2180 value: <opt_value>
2181
2182<opt_name> is a configurational option defined in 'man login.defs'.
2183<opt_name> is case sensitive, should be UPPERCASE only!
2184
2185
Filip Pytlounf5383a42015-10-06 16:28:32 +02002186Linux with hosts
2187
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002188Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
2189removing entries that are not defined in model except defaults
2190for both IPv4 and IPv6 localhost and hostname as well as FQDN.
Ales Komarek417e8c52017-08-25 15:10:29 +02002191
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002192We recommend using this option to verify that ``/etc/hosts``
2193is always in a clean state. However it is not enabled by default
2194for security reasons.
Filip Pytloun86506fe2017-01-26 14:36:16 +01002195
Filip Pytlounf5383a42015-10-06 16:28:32 +02002196.. code-block:: yaml
2197
2198 linux:
2199 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002200 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002201 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002202 # No need to define this one if purge_hosts is true
2203 hostname:
2204 address: 127.0.1.1
2205 names:
2206 - ${linux:network:fqdn}
2207 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02002208 node1:
2209 address: 192.168.10.200
2210 names:
2211 - node2.domain.com
2212 - service2.domain.com
2213 node2:
2214 address: 192.168.10.201
2215 names:
2216 - node2.domain.com
2217 - service2.domain.com
2218
Ales Komarek417e8c52017-08-25 15:10:29 +02002219Linux with hosts collected from mine
2220
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002221All DNS records defined within infrastrucuture
2222are passed to the local hosts records or any DNS server. Only
2223hosts with the ``grain`` parameter set to ``true`` will be propagated
2224to the mine.
Ales Komarek417e8c52017-08-25 15:10:29 +02002225
2226.. code-block:: yaml
2227
2228 linux:
2229 network:
2230 purge_hosts: true
2231 mine_dns_records: true
2232 host:
2233 node1:
2234 address: 192.168.10.200
2235 grain: true
2236 names:
2237 - node2.domain.com
2238 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01002239
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002240Set up ``resolvconf's basic resolver info``, e.g. nameservers, search/domain and options:
Filip Pytlounde9bea52016-01-11 15:39:10 +01002241
2242.. code-block:: yaml
2243
2244 linux:
2245 network:
2246 resolv:
2247 dns:
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002248 - 8.8.4.4
2249 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01002250 domain: my.example.com
2251 search:
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002252 - my.example.com
2253 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01002254 options:
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002255 - ndots:5
2256 - timeout:2
2257 - attempts:2
Filip Pytlounde9bea52016-01-11 15:39:10 +01002258
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002259Set up custom TX queue length for tap interfaces:
Andrii Petrenko735761d2017-03-21 17:17:35 -07002260
2261.. code-block:: yaml
2262
2263 linux:
2264 network:
Dzmitry Stremkouskic58cb242020-09-14 17:41:49 +02002265 custom_txqueuelen
2266 tap:
2267 queue_length: 10000
2268 enabled: true
2269 device_filter: 'tap[0-9a-z\-]*'
2270 ten:
2271 enabled: false
2272 veth:
2273 queue_length: 20000
Andrii Petrenko735761d2017-03-21 17:17:35 -07002274
Michael Polenchuk6e3042b2019-04-22 15:20:03 +04002275Auto repair/re-attach libvirt's vnet interfaces:
2276
2277.. code-block:: yaml
2278
2279 linux:
2280 network:
2281 libvirt_vnet_repair: true
2282
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002283DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002284
2285**DPDK OVS NIC**
2286
2287.. code-block:: yaml
2288
2289 linux:
2290 network:
2291 bridge: openvswitch
2292 dpdk:
2293 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002294 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002295 openvswitch:
2296 pmd_cpu_mask: "0x6"
2297 dpdk_socket_mem: "1024,1024"
2298 dpdk_lcore_mask: "0x400"
2299 memory_channels: 2
2300 interface:
2301 dpkd0:
2302 name: ${_param:dpdk_nic}
2303 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002304 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002305 enabled: true
2306 type: dpdk_ovs_port
2307 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002308 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002309 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01002310 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002311 br-prv:
2312 enabled: true
2313 type: dpdk_ovs_bridge
Michael Polenchukd3378db2018-12-29 16:46:50 +04002314 br-floating:
2315 enabled: true
2316 type: ovs_bridge
2317 name_servers:
2318 - 1.1.1.1
2319 - 9.9.9.9
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002320
2321**DPDK OVS Bond**
2322
2323.. code-block:: yaml
2324
2325 linux:
2326 network:
2327 bridge: openvswitch
2328 dpdk:
2329 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002330 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002331 openvswitch:
2332 pmd_cpu_mask: "0x6"
2333 dpdk_socket_mem: "1024,1024"
2334 dpdk_lcore_mask: "0x400"
2335 memory_channels: 2
2336 interface:
2337 dpdk_second_nic:
2338 name: ${_param:primary_second_nic}
2339 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002340 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002341 bond: dpdkbond0
2342 enabled: true
2343 type: dpdk_ovs_port
2344 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002345 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002346 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002347 dpdk_first_nic:
2348 name: ${_param:primary_first_nic}
2349 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002350 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002351 bond: dpdkbond0
2352 enabled: true
2353 type: dpdk_ovs_port
2354 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002355 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002356 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002357 dpdkbond0:
2358 enabled: true
2359 bridge: br-prv
2360 type: dpdk_ovs_bond
2361 mode: active-backup
2362 br-prv:
2363 enabled: true
2364 type: dpdk_ovs_bridge
2365
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01002366**DPDK OVS LACP Bond with vlan tag**
2367
2368.. code-block:: yaml
2369
2370 linux:
2371 network:
2372 bridge: openvswitch
2373 dpdk:
2374 enabled: true
2375 driver: uio
2376 openvswitch:
2377 pmd_cpu_mask: "0x6"
2378 dpdk_socket_mem: "1024,1024"
2379 dpdk_lcore_mask: "0x400"
2380 memory_channels: "2"
2381 interface:
2382 eth3:
2383 enabled: true
2384 type: eth
2385 proto: manual
2386 name: ${_param:tenant_first_nic}
2387 eth4:
2388 enabled: true
2389 type: eth
2390 proto: manual
2391 name: ${_param:tenant_second_nic}
2392 dpdk0:
2393 name: ${_param:tenant_first_nic}
2394 pci: "0000:81:00.0"
2395 driver: igb_uio
2396 bond: bond1
2397 enabled: true
2398 type: dpdk_ovs_port
2399 n_rxq: 2
2400 dpdk1:
2401 name: ${_param:tenant_second_nic}
2402 pci: "0000:81:00.1"
2403 driver: igb_uio
2404 bond: bond1
2405 enabled: true
2406 type: dpdk_ovs_port
2407 n_rxq: 2
2408 bond1:
2409 enabled: true
2410 bridge: br-prv
2411 type: dpdk_ovs_bond
2412 mode: balance-slb
2413 br-prv:
2414 enabled: true
2415 type: dpdk_ovs_bridge
2416 tag: ${_param:tenant_vlan}
2417 address: ${_param:tenant_address}
2418 netmask: ${_param:tenant_network_netmask}
2419
Jakub Pavlikaa759062017-03-13 15:57:26 +01002420**DPDK OVS bridge for VXLAN**
2421
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002422If VXLAN is used as tenant segmentation, IP address must
2423be set on ``br-prv``.
Jakub Pavlikaa759062017-03-13 15:57:26 +01002424
2425.. code-block:: yaml
2426
2427 linux:
2428 network:
2429 ...
2430 interface:
2431 br-prv:
2432 enabled: true
2433 type: dpdk_ovs_bridge
2434 address: 192.168.50.0
2435 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04002436 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01002437 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002438
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02002439**DPDK OVS bridge with Linux network interface**
2440
2441.. code-block:: yaml
2442
2443 linux:
2444 network:
2445 ...
2446 interface:
2447 eth0:
2448 type: eth
2449 ovs_bridge: br-prv
2450 ...
2451 br-prv:
2452 enabled: true
2453 type: dpdk_ovs_bridge
2454 ...
2455
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002456Linux storage
2457-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02002458
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002459Linux with mounted Samba:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002460
2461.. code-block:: yaml
2462
2463 linux:
2464 storage:
2465 enabled: true
2466 mount:
2467 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01002468 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002469 - path: /media/myuser/public/
2470 - device: //192.168.0.1/storage
2471 - file_system: cifs
2472 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
2473
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002474NFS mount:
Jiri Broulikb017f932017-03-31 13:55:36 +02002475
2476.. code-block:: yaml
2477
2478 linux:
2479 storage:
2480 enabled: true
2481 mount:
2482 nfs_glance:
2483 enabled: true
2484 path: /var/lib/glance/images
2485 device: 172.16.10.110:/var/nfs/glance
2486 file_system: nfs
2487 opts: rw,sync
2488
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002489File swap configuration:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002490
2491.. code-block:: yaml
2492
2493 linux:
2494 storage:
2495 enabled: true
2496 swap:
2497 file:
2498 enabled: true
2499 engine: file
2500 device: /swapfile
2501 size: 1024
2502
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002503Partition swap configuration:
Lachlan Evenson30676512016-01-22 15:43:28 -08002504
2505.. code-block:: yaml
2506
2507 linux:
2508 storage:
2509 enabled: true
2510 swap:
2511 partition:
2512 enabled: true
2513 engine: partition
2514 device: /dev/vg0/swap
2515
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002516LVM group ``vg1`` with one device and ``data`` volume mounted
2517into ``/mnt/data``.
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002518
2519.. code-block:: yaml
2520
2521 parameters:
2522 linux:
2523 storage:
Dzmitry Stremkouski08cb4c82021-03-05 11:53:27 +01002524 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002525 mount:
2526 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01002527 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002528 device: /dev/vg1/data
2529 file_system: ext4
2530 path: /mnt/data
2531 lvm:
2532 vg1:
2533 enabled: true
2534 devices:
2535 - /dev/sdb
2536 volume:
2537 data:
2538 size: 40G
2539 mount: ${linux:storage:mount:data}
root40bb5e72019-01-11 08:55:32 +00002540 # When set they will take precedence over filters aget from volume groups.
2541 lvm_filters:
2542 10:
2543 enabled: True
2544 value: "a|loop|"
2545 20:
2546 enabled: True
2547 value: "r|/dev/hdc|"
2548 30:
2549 enabled: True
2550 value: "a|/dev/ide|"
2551 40:
2552 enabled: True
2553 value: "r|.*|"
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002554
Jakub Pavlik4f742142017-08-08 15:05:50 +02002555Create partitions on disk. Specify size in MB. It expects empty
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002556disk without any existing partitions.
2557Set ``startsector=1`` if you want to start partitions from ``2048``.
Jakub Pavlik4f742142017-08-08 15:05:50 +02002558
2559.. code-block:: yaml
2560
2561 linux:
2562 storage:
2563 disk:
2564 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01002565 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02002566 name: /dev/loop1
2567 type: gpt
2568 partitions:
2569 - size: 200 #size in MB
2570 type: fat32
2571 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02002572 mkfs: True
2573 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02002574 /dev/vda1:
2575 partitions:
2576 - size: 5
2577 type: ext2
2578 - size: 10
2579 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02002580
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002581Multipath with Fujitsu Eternus DXL:
Ales Komareka634f4b2016-10-02 13:11:04 +02002582
2583.. code-block:: yaml
2584
2585 parameters:
2586 linux:
2587 storage:
2588 multipath:
2589 enabled: true
2590 blacklist_devices:
2591 - /dev/sda
2592 - /dev/sdb
2593 backends:
2594 - fujitsu_eternus_dxl
2595
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002596Multipath with Hitachi VSP 1000:
Ales Komareka634f4b2016-10-02 13:11:04 +02002597
2598.. code-block:: yaml
2599
2600 parameters:
2601 linux:
2602 storage:
2603 multipath:
2604 enabled: true
2605 blacklist_devices:
2606 - /dev/sda
2607 - /dev/sdb
2608 backends:
2609 - hitachi_vsp1000
2610
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002611Multipath with IBM Storwize:
Ales Komareka634f4b2016-10-02 13:11:04 +02002612
2613.. code-block:: yaml
2614
2615 parameters:
2616 linux:
2617 storage:
2618 multipath:
2619 enabled: true
2620 blacklist_devices:
2621 - /dev/sda
2622 - /dev/sdb
2623 backends:
2624 - ibm_storwize
2625
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002626Multipath with multiple backends:
Ales Komareka634f4b2016-10-02 13:11:04 +02002627
2628.. code-block:: yaml
2629
2630 parameters:
2631 linux:
2632 storage:
2633 multipath:
2634 enabled: true
2635 blacklist_devices:
2636 - /dev/sda
2637 - /dev/sdb
2638 - /dev/sdc
2639 - /dev/sdd
2640 backends:
2641 - ibm_storwize
2642 - fujitsu_eternus_dxl
2643 - hitachi_vsp1000
2644
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002645PAM LDAP integration:
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002646
2647.. code-block:: yaml
2648
2649 parameters:
2650 linux:
2651 system:
2652 auth:
2653 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02002654 mkhomedir:
2655 enabled: true
2656 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002657 ldap:
2658 enabled: true
2659 binddn: cn=bind,ou=service_users,dc=example,dc=com
2660 bindpw: secret
2661 uri: ldap://127.0.0.1
2662 base: ou=users,dc=example,dc=com
2663 ldap_version: 3
2664 pagesize: 65536
2665 referrals: off
2666 filter:
2667 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2668 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2669 group: (&(objectClass=group)(gidNumber=*))
2670
Gleb Galkin93b9ae92018-10-18 13:57:30 +03002671PAM duo 2FA integration
2672
2673.. code-block:: yaml
2674
2675 parameters:
2676 linux:
2677 system:
2678 auth:
2679 enabled: true
2680 duo:
2681 enabled: true
2682 duo_host: localhost
2683 duo_ikey: DUO-INTEGRATION-KEY
2684 duo_skey: DUO-SECRET-KEY
2685
2686duo package version may be specified (optional)
2687
2688.. code-block:: yaml
2689
2690 linux:
2691 system:
2692 package:
2693 duo-unix:
2694 version: 1.10.1-0
2695
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002696Disabled multipath (the default setup):
Ales Komareka634f4b2016-10-02 13:11:04 +02002697
2698.. code-block:: yaml
2699
2700 parameters:
2701 linux:
2702 storage:
2703 multipath:
2704 enabled: false
2705
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002706Linux with local loopback device:
Simon Pasquier375001e2017-01-26 13:22:33 +01002707
2708.. code-block:: yaml
2709
2710 linux:
2711 storage:
2712 loopback:
2713 disk1:
2714 file: /srv/disk1
2715 size: 50G
2716
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002717External config generation
2718--------------------------
2719
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002720You are able to use config support metadata between formulas
2721and only generate configuration files for external use, for example, Docker, and so on.
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002722
2723.. code-block:: yaml
2724
2725 parameters:
2726 linux:
2727 system:
2728 config:
2729 pillar:
2730 jenkins:
2731 master:
2732 home: /srv/volumes/jenkins
2733 approved_scripts:
2734 - method java.net.URL openConnection
2735 credentials:
2736 - type: username_password
2737 scope: global
2738 id: test
2739 desc: Testing credentials
2740 username: test
2741 password: test
2742
Vladimir Ereminccf28842017-04-10 23:52:10 +03002743Netconsole Remote Kernel Logging
2744--------------------------------
2745
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002746Netconsole logger can be configured for the configfs-enabled kernels
2747(``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
2748applies both in runtime (if network is already configured),
2749and on-boot after an interface initialization.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002750
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002751.. note::
2752
2753 * Receiver can be located only on the same L3 domain
2754 (or you need to configure gateway MAC manually).
2755 * The Receiver MAC is detected only on configuration time.
2756 * Using broadcast MAC is not recommended.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002757
2758.. code-block:: yaml
2759
2760 parameters:
2761 linux:
2762 system:
2763 netconsole:
2764 enabled: true
2765 port: 514 (optional)
2766 loglevel: debug (optional)
2767 target:
2768 192.168.0.1:
2769 interface: bond0
2770 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02002771
Dzmitry Stremkouskid1a268b2018-10-03 16:36:04 +02002772Check network params on the environment
2773---------------------------------------
2774
2775Grab nics and nics states
2776
2777.. code-block:: bash
2778
2779 salt osd001\* net_checks.get_nics
2780
2781**Example of system output:**
2782
2783.. code-block:: bash
2784
2785 osd001.domain.com:
2786 |_
2787 - bond0
2788 - None
2789 - 1e:c8:64:42:23:b9
2790 - 0
2791 - 1500
2792 |_
2793 - bond1
2794 - None
2795 - 3c:fd:fe:27:3b:00
2796 - 1
2797 - 9100
2798 |_
2799 - fourty1
2800 - None
2801 - 3c:fd:fe:27:3b:00
2802 - 1
2803 - 9100
2804 |_
2805 - fourty2
2806 - None
2807 - 3c:fd:fe:27:3b:02
2808 - 1
2809 - 9100
2810
2811Grab 10G nics PCI addresses for hugepages setup
2812
2813.. code-block:: bash
2814
2815 salt cmp001\* net_checks.get_ten_pci
2816
2817**Example of system output:**
2818
2819.. code-block:: bash
2820
2821 cmp001.domain.com:
2822 |_
2823 - ten1
2824 - 0000:19:00.0
2825 |_
2826 - ten2
2827 - 0000:19:00.1
2828 |_
2829 - ten3
2830 - 0000:19:00.2
2831 |_
2832 - ten4
2833 - 0000:19:00.3
2834
2835Grab ip address for an interface
2836
2837.. code-block:: bash
2838
2839 salt cmp001\* net_checks.get_ip iface=one4
2840
2841**Example of system output:**
2842
2843.. code-block:: bash
2844
2845 cmp001.domain.com:
2846 10.200.177.101
2847
2848Grab ip addresses map
2849
2850.. code-block:: bash
2851
2852 salt-call net_checks.nodes_addresses
2853
2854**Example of system output:**
2855
2856.. code-block:: bash
2857
2858 local:
2859 |_
2860 - cid01.domain.com
2861 |_
2862 |_
2863 - pxe
2864 - 10.200.177.91
2865 |_
2866 - control
2867 - 10.200.178.91
2868 |_
2869 - cmn02.domain.com
2870 |_
2871 |_
2872 - storage_access
2873 - 10.200.181.67
2874 |_
2875 - pxe
2876 - 10.200.177.67
2877 |_
2878 - control
2879 - 10.200.178.67
2880 |_
2881 - cmp010.domain.com
2882 |_
2883 |_
2884 - pxe
2885 - 10.200.177.110
2886 |_
2887 - storage_access
2888 - 10.200.181.110
2889 |_
2890 - control
2891 - 10.200.178.110
2892 |_
2893 - vxlan
2894 - 10.200.179.110
2895
2896Verify full mesh connectivity
2897
2898.. code-block:: bash
2899
2900 salt-call net_checks.ping_check
2901
2902**Example of positive system output:**
2903
2904.. code-block:: bash
2905
2906 ['PASSED']
2907 [INFO ] ['PASSED']
2908 local:
2909 True
2910
2911**Example of system output in case of failure:**
2912
2913.. code-block:: bash
2914
2915 FAILED
2916 [ERROR ] FAILED
2917 ['control: 10.0.1.92 -> 10.0.1.224: Failed']
2918 ['control: 10.0.1.93 -> 10.0.1.224: Failed']
2919 ['control: 10.0.1.51 -> 10.0.1.224: Failed']
2920 ['control: 10.0.1.102 -> 10.0.1.224: Failed']
2921 ['control: 10.0.1.13 -> 10.0.1.224: Failed']
2922 ['control: 10.0.1.81 -> 10.0.1.224: Failed']
2923 local:
2924 False
2925
2926For this feature to work, please mark addresses with some role.
2927Otherwise 'default' role is assumed and mesh would consist of all
2928addresses on the environment.
2929
2930Mesh mark is needed only for interfaces which are enabled and have
2931ip address assigned.
2932
2933Checking dhcp pxe network meaningless, as it is used for salt
2934master vs minion communications, therefore treated as checked.
2935
2936.. code-block:: yaml
2937
2938 parameters:
2939 linux:
2940 network:
2941 interface:
2942 ens3:
2943 enabled: true
2944 type: eth
2945 proto: static
2946 address: ${_param:deploy_address}
2947 netmask: ${_param:deploy_network_netmask}
2948 gateway: ${_param:deploy_network_gateway}
2949 mesh: pxe
2950
2951Check pillars for ip address duplicates
2952
2953.. code-block:: bash
2954
2955 salt-call net_checks.verify_addresses
2956
2957**Example of positive system output:**
2958
2959.. code-block:: bash
2960
2961 ['PASSED']
2962 [INFO ] ['PASSED']
2963 local:
2964 True
2965
2966**Example of system output in case of failure:**
2967
2968.. code-block:: bash
2969
2970 FAILED. Duplicates found
2971 [ERROR ] FAILED. Duplicates found
2972 ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2973 [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2974 local:
2975 False
2976
2977Generate csv report for the env
2978
2979.. code-block:: bash
2980
2981 salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
2982 | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
2983 | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
2984
2985**Example of system output:**
2986
2987.. code-block:: bash
2988
2989 server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
2990 cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
2991 cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
2992 cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
2993 cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
2994 cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
2995 cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
2996 cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
2997 cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
2998 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
2999 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
3000 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
3001 cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
3002 cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
3003 cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
3004 ...
3005
Filip Pytlounf5383a42015-10-06 16:28:32 +02003006Usage
3007=====
3008
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03003009Set MTU of the eth0 network interface to 1400:
Filip Pytlounf5383a42015-10-06 16:28:32 +02003010
3011.. code-block:: bash
3012
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03003013 ip link set dev eth0 mtu 1400
Filip Pytlounf5383a42015-10-06 16:28:32 +02003014
Denis Egorenko4e45a702019-10-02 14:57:10 +04003015Switch Kernel from non-HWE to HWE
3016==================================
3017
3018It is possible to switch Kernel from non-HWE to HWE by using module
3019linux_kernel_switch. It has few methods:
3020
3021* check_hwe_kernel
3022* switch_kernel
3023* rollback_switch_kernel
3024
3025Method ``check_hwe_kernel`` allows to check whether HWE kernel installed
3026or not:
3027
3028.. code-block:: bash
3029
3030 salt <target> linux_kernel_switch.check_hwe_kernel
3031
3032Output for case HWE is installed:
3033
3034.. code-bloc:: bash
3035
3036 kvm02.cluster-env.local:
3037 ----------
3038 linux-image-extra-virtual-hwe-16.04:
3039 ----------
3040 linux-image-extra-virtual-hwe-16.04:
3041 ----------
3042 architecture:
3043 amd64
3044 description:
3045 Extra drivers for Virtual Linux kernel image
3046 This package will always depend on linux-image-generic.
3047 group:
3048 kernel
3049 install_date:
3050 2019-10-01T11:50:15Z
3051 name:
3052 linux-image-extra-virtual-hwe-16.04
3053 packager:
3054 Ubuntu Kernel Team <kernel-team@lists.ubuntu.com>
3055 source:
3056 linux-meta-hwe
3057 version:
3058 4.15.0.54.75
3059 ...
3060
3061Output for case HWE is not installed:
3062
3063.. code-bloc:: bash
3064
3065 kvm02.cluster-env.local:
3066 ----------
3067 linux-image-extra-virtual-hwe-16.04:
3068 Not installed!
3069 linux-image-generic-hwe-16.04:
3070 Not installed!
3071
3072Method ``switch_kernel`` allows you to switch from non-HWE to HWE. It has
3073two options: ``dry_run`` - to check what packages are going to be installed or
3074removed and ``only_kernel`` - install only Kernel image packages without other
3075HWE packages.
3076
3077Method ``rollback_switch_kernel`` allows you to rollback method
3078``switch_kernel`` which was executed successfully previously. Option
3079``dry_run`` - to check what packages are going to be installed/removed.
3080
Filip Pytlounf5383a42015-10-06 16:28:32 +02003081Read more
3082=========
3083
3084* https://www.archlinux.org/
3085* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu