blob: 03dc3d5660f2d0e91fd8a91bbc3985fb13c2519a [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
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300270Linux with package, latest version:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200271
272.. code-block:: yaml
273
274 linux:
275 system:
276 ...
277 package:
278 package-name:
279 version: latest
280
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300281Linux with package from certail repo, version with no upgrades:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200282
283.. code-block:: yaml
284
285 linux:
286 system:
287 ...
288 package:
289 package-name:
290 version: 2132.323
291 repo: 'custom-repo'
292 hold: true
293
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300294Linux with package from certail repo, version with no GPG
295verification:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200296
297.. code-block:: yaml
298
299 linux:
300 system:
301 ...
302 package:
303 package-name:
304 version: 2132.323
305 repo: 'custom-repo'
306 verify: false
307
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300308Linux with autoupdates (automatically install security package
309updates):
Bruno Binet69a9d8d2017-02-16 22:34:32 +0100310
311.. code-block:: yaml
312
313 linux:
314 system:
315 ...
316 autoupdates:
317 enabled: true
318 mail: root@localhost
319 mail_only_on_error: true
320 remove_unused_dependencies: false
321 automatic_reboot: true
322 automatic_reboot_time: "02:00"
323
Dmitry Teselkin0f084a02018-08-29 14:46:38 +0300324Managing cron tasks
325-------------------
326
327There are two data structures that are related to managing cron itself and
328cron tasks:
329
330.. code-block:: yaml
331
332 linux:
333 system:
334 cron:
335
336and
337
338.. code-block:: yaml
339
340 linux:
341 system:
342 job:
343
344`linux:system:cron` manages cron packages, services, and '/etc/cron.allow' file.
345
346'deny' files are managed the only way - we're ensuring they are absent, that's
347a requirement from CIS 5.1.8
348
349'cron' pillar structure is the following:
350
351.. code-block:: yaml
352
353 linux:
354 system:
355 cron:
356 enabled: true
357 pkgs: [ <cron packages> ]
358 services: [ <cron services> ]
359 user:
360 <username>:
361 enabled: true
362
363To add user to '/etc/cron.allow' use 'enabled' key as shown above.
364
365'/etc/cron.deny' is not managed as CIS 5.1.8 requires it was removed.
366
367A user would be ignored if any of the following is true:
368* user is disabled in `linux:system:user:<username>`
369* user is disabled in `linux:system:cron:user:<username>`
370
371`linux:system:job` manages individual cron tasks.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300372
373By default, it will use name as an identifier, unless identifier key is
Filip Pytloun91222222017-08-04 10:55:27 +0200374explicitly set or False (then it will use Salt's default behavior which is
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300375identifier same as command resulting in not being able to change it):
Filip Pytlounf5383a42015-10-06 16:28:32 +0200376
377.. code-block:: yaml
378
379 linux:
380 system:
381 ...
382 job:
383 cmd1:
384 command: '/cmd/to/run'
Filip Pytloun91222222017-08-04 10:55:27 +0200385 identifier: cmd1
Filip Pytlounf5383a42015-10-06 16:28:32 +0200386 enabled: true
387 user: 'root'
388 hour: 2
389 minute: 0
390
Dmitry Teselkin0f084a02018-08-29 14:46:38 +0300391Managing 'at' tasks
392-------------------
393
394Pillar for managing `at` tasks is similar to one for `cron` tasks:
395
396.. code-block:: yaml
397
398 linux:
399 system:
400 at:
401 enabled: true
402 pkgs: [ <at packages> ]
403 services: [ <at services> ]
404 user:
405 <username>:
406 enabled: true
407
408To add a user to '/etc/at.allow' use 'enabled' key as shown above.
409
410'/etc/at.deny' is not managed as CIS 5.1.8 requires it was removed.
411
412A user will be ignored if any of the following is true:
413* user is disabled in `linux:system:user:<username>`
414* user is disabled in `linux:system:at:user:<username>`
415
416
Filip Pytlound0a29e72015-11-30 15:23:34 +0100417Linux security limits (limit sensu user memory usage to max 1GB):
418
419.. code-block:: yaml
420
421 linux:
422 system:
423 ...
424 limit:
425 sensu:
426 enabled: true
427 domain: sensu
428 limits:
429 - type: hard
430 item: as
431 value: 1000000
432
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300433Enable autologin on ``tty1`` (may work only for Ubuntu 14.04):
Filip Pytloun7fee0542015-10-15 11:19:24 +0200434
435.. code-block:: yaml
436
437 linux:
438 system:
439 console:
440 tty1:
441 autologin: root
Filip Pytloun281d0202016-01-29 14:03:51 +0100442 # Enable serial console
443 ttyS0:
444 autologin: root
445 rate: 115200
446 term: xterm
Filip Pytloun7fee0542015-10-15 11:19:24 +0200447
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300448To disable set autologin to ``false``.
Filip Pytloun7fee0542015-10-15 11:19:24 +0200449
Filip Pytloun7731b852016-02-01 11:13:47 +0100450Set ``policy-rc.d`` on Debian-based systems. Action can be any available
451command in ``while true`` loop and ``case`` context.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300452Following will disallow dpkg to stop/start services for the Cassandra
453package automatically:
Filip Pytloun7731b852016-02-01 11:13:47 +0100454
455.. code-block:: yaml
456
457 linux:
458 system:
459 policyrcd:
460 - package: cassandra
461 action: exit 101
462 - package: '*'
463 action: switch
464
Filip Pytlounc49445a2016-04-04 14:23:20 +0200465Set system locales:
466
467.. code-block:: yaml
468
469 linux:
470 system:
471 locale:
472 en_US.UTF-8:
473 default: true
Filip Pytlounee1745f2016-04-04 17:39:41 +0200474 "cs_CZ.UTF-8 UTF-8":
Filip Pytlounc49445a2016-04-04 14:23:20 +0200475 enabled: true
476
Andrey Shestakove7cca052017-05-24 23:06:24 +0300477Systemd settings:
478
479.. code-block:: yaml
480
481 linux:
482 system:
483 ...
484 systemd:
485 system:
486 Manager:
487 DefaultLimitNOFILE: 307200
488 DefaultLimitNPROC: 307200
489 user:
490 Manager:
491 DefaultLimitCPU: 2
492 DefaultLimitNPROC: 4
493
Filip Pytloun8b2131e2017-11-08 13:29:03 +0100494Ensure presence of directory:
495
496.. code-block:: yaml
497
498 linux:
499 system:
500 directory:
501 /tmp/test:
502 user: root
503 group: root
504 mode: 700
505 makedirs: true
506
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300507Ensure presence of file by specifying its source:
Richard Felkl2e07d652018-01-19 10:19:06 +0100508
509.. code-block:: yaml
510
511 linux:
512 system:
513 file:
514 /tmp/test.txt:
515 source: http://example.com/test.txt
Richard Felklf40599a2018-02-06 22:56:41 +0100516 user: root #optional
517 group: root #optional
518 mode: 700 #optional
519 dir_mode: 700 #optional
520 encoding: utf-8 #optional
521 hash: <<hash>> or <<URI to hash>> #optional
522 makedirs: true #optional
523
524 linux:
525 system:
526 file:
527 test.txt:
528 name: /tmp/test.txt
529 source: http://example.com/test.txt
Richard Felkl2e07d652018-01-19 10:19:06 +0100530
Gabor Orosz35815c02018-09-07 17:31:05 +0200531 linux:
532 system:
533 file:
534 test2:
535 name: /tmp/test2.txt
536 source: http://example.com/test2.jinja
537 template: jinja
538
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300539Ensure presence of file by specifying its contents:
Richard Felkl2e07d652018-01-19 10:19:06 +0100540
541.. code-block:: yaml
542
543 linux:
544 system:
545 file:
546 /tmp/test.txt:
547 contents: |
548 line1
549 line2
Richard Felklf40599a2018-02-06 22:56:41 +0100550
551 linux:
552 system:
553 file:
554 /tmp/test.txt:
555 contents_pillar: linux:network:hostname
556
557 linux:
558 system:
559 file:
560 /tmp/test.txt:
561 contents_grains: motd
562
Ivan Berezovskiyf9301e12019-07-22 13:14:14 +0400563Ensure presence of file by specifying its secured source:
564
565.. code-block:: yaml
566
567 linux:
568 system:
569 file:
570 /tmp/test.txt:
571 secured_source:
572 protocol: http #optional
573 user: foo
574 password: bar
575 url: example.com/test.txt
576 secured_hash: #optional
577 url: example.com/test.txt.md5
578 user: root #optional
579 group: root #optional
580 mode: 700 #optional
581 dir_mode: 700 #optional
582 encoding: utf-8 #optional
583 makedirs: true #optional
584
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300585Ensure presence of file to be serialized through one of the
586serializer modules (see:
587https://docs.saltstack.com/en/latest/ref/serializers/all/index.html):
Bruno Binet9c2fe222018-06-08 16:57:32 +0200588
589.. code-block:: yaml
590
591 linux:
592 system:
593 file:
594 /tmp/test.json:
595 serialize: json
596 contents:
597 foo: 1
598 bar: 'bar'
599
agoriunovd7b19ce2019-02-18 11:37:32 +0200600Ensure presence of file to be decoded through file.decode module (see:
601https://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html#salt.states.file.decode):
602
603.. code-block:: yaml
604
605 linux:
606 system:
607 file:
608 /tmp/test4.txt:
609 decode: True
610 encoded_data: |
611 dGVzdDQK
612
Filip Pytloun281034a2016-01-04 18:06:22 +0100613Kernel
614~~~~~~
615
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300616Install always up to date LTS kernel and headers from Ubuntu Trusty:
Filip Pytloun281034a2016-01-04 18:06:22 +0100617
618.. code-block:: yaml
619
620 linux:
621 system:
622 kernel:
623 type: generic
624 lts: trusty
625 headers: true
626
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300627Load kernel modules and add them to ``/etc/modules``:
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100628
629.. code-block:: yaml
630
631 linux:
632 system:
633 kernel:
634 modules:
635 - nf_conntrack
636 - tp_smapi
637 - 8021q
638
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300639Configure or blacklist kernel modules with additional options to
640``/etc/modprobe.d`` following example will add
641``/etc/modprobe.d/nf_conntrack.conf`` file with line
642``options nf_conntrack hashsize=262144``:
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300643
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300644'option' can be a mapping (with 'enabled' and 'value' keys) or a scalar.
645
646Example for 'scalar' option value:
647
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300648.. code-block:: yaml
649
650 linux:
651 system:
652 kernel:
653 module:
654 nf_conntrack:
655 option:
656 hashsize: 262144
657
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300658Example for 'mapping' option value:
659
660.. code-block:: yaml
661
662 linux:
663 system:
664 kernel:
665 module:
666 nf_conntrack:
667 option:
668 hashsize:
669 enabled: true
670 value: 262144
671
672NOTE: 'enabled' key is optional and is True by default.
673
674Blacklist a module:
675
676.. code-block:: yaml
677
678 linux:
679 system:
680 kernel:
681 module:
682 nf_conntrack:
683 blacklist: true
684
685A module can have a number of aliases, wildcards are allowed.
686Define an alias for a module:
687
688.. code-block:: yaml
689
690 linux:
691 system:
692 kernel:
693 module:
694 nf_conntrack:
695 alias:
696 nfct:
697 enabled: true
698 "nf_conn*":
699 enabled: true
700
701NOTE: 'enabled' key is mandatory as there are no other keys exist.
702
703Execute custom command instead of 'insmod' when inserting a module:
704
705.. code-block:: yaml
706
707 linux:
708 system:
709 kernel:
710 module:
711 nf_conntrack:
712 install:
713 enabled: true
714 command: /bin/true
715
716NOTE: 'enabled' key is optional and is True by default.
717
718Execute custom command instead of 'rmmod' when removing a module:
719
720.. code-block:: yaml
721
722 linux:
723 system:
724 kernel:
725 module:
726 nf_conntrack:
727 remove:
728 enabled: true
729 command: /bin/true
730
731NOTE: 'enabled' key is optional and is True by default.
732
733Define module dependencies:
734
735.. code-block:: yaml
736
737 linux:
738 system:
739 kernel:
740 module:
741 nf_conntrack:
742 softdep:
743 pre:
744 1:
745 enabled: true
746 value: a
747 2:
748 enabled: true
749 value: b
750 3:
751 enabled: true
752 value: c
753 post:
754 1:
755 enabled: true
756 value: x
757 2:
758 enabled: true
759 value: y
760 3:
761 enabled: true
762 value: z
763
764NOTE: 'enabled' key is optional and is True by default.
765
766
Filip Pytloun281034a2016-01-04 18:06:22 +0100767Install specific kernel version and ensure all other kernel packages are
768not present. Also install extra modules and headers for this kernel:
769
770.. code-block:: yaml
771
772 linux:
773 system:
774 kernel:
775 type: generic
776 extra: true
777 headers: true
778 version: 4.2.0-22
779
Denis Egorenkofa2ee422019-11-06 14:02:00 +0400780Also it is possible to install Kernel with Hardware Enablement or virtual
781kernel packages. For example, for Xenial:
782
783.. code-block:: yaml
784
785 linux:
786 system:
787 kernel:
788 type: generic
789 extra: true
790 headers: true
791 version: 4.15.0-65
792 hwe:
793 type: hwe
794 version: 16.04
795 kernel_version: 4.15.0.65
796
797Set `linux:system:kernel:hwe:type:virtual` if you need Virtual kernel packages.
798
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300799Systcl kernel parameters:
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100800
801.. code-block:: yaml
802
803 linux:
804 system:
805 kernel:
806 sysctl:
807 net.ipv4.tcp_keepalive_intvl: 3
808 net.ipv4.tcp_keepalive_time: 30
809 net.ipv4.tcp_keepalive_probes: 8
810
Michael Polenchukebf55522018-01-25 13:22:39 +0400811Configure kernel boot options:
812
813.. code-block:: yaml
814
815 linux:
816 system:
817 kernel:
818 boot_options:
819 - elevator=deadline
820 - spectre_v2=off
821 - nopti
822
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100823CPU
824~~~
825
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300826Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100827
828.. code-block:: yaml
829
830 linux:
831 system:
832 cpu:
833 governor: performance
834
Nick Metzf04f5f32018-01-08 15:25:04 +0100835
Jiri Broulik303905d2018-01-11 14:12:48 +0100836CGROUPS
837~~~~~~~
838
839Setup linux cgroups:
840
841.. code-block:: yaml
842
843 linux:
844 system:
845 cgroup:
846 enabled: true
847 group:
848 ceph_group_1:
849 controller:
850 cpu:
851 shares:
852 value: 250
853 cpuacct:
854 usage:
855 value: 0
856 cpuset:
857 cpus:
858 value: 1,2,3
859 memory:
860 limit_in_bytes:
861 value: 2G
862 memsw.limit_in_bytes:
863 value: 3G
864 mapping:
865 subjects:
866 - '@ceph'
867 generic_group_1:
868 controller:
869 cpu:
870 shares:
871 value: 250
872 cpuacct:
873 usage:
874 value: 0
875 mapping:
876 subjects:
877 - '*:firefox'
878 - 'student:cp'
879
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300880Shared libraries
Nick Metzf04f5f32018-01-08 15:25:04 +0100881~~~~~~~~~~~~~~~~
882
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300883Set additional shared library to Linux system library path:
Nick Metzf04f5f32018-01-08 15:25:04 +0100884
885.. code-block:: yaml
886
887 linux:
888 system:
889 ld:
890 library:
891 java:
892 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
893 - /opt/java/jre/lib/amd64/server
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200894
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200895Certificates
896~~~~~~~~~~~~
897
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300898Add certificate authority into system trusted CA bundle:
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200899
900.. code-block:: yaml
901
902 linux:
903 system:
904 ca_certificates:
905 mycert: |
906 -----BEGIN CERTIFICATE-----
907 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
908 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
909 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
910 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
911 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
912 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
913 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
914 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
915 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
916 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
917 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
918 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
919 -----END CERTIFICATE-----
920
Filip Pytloun361096c2017-08-23 10:57:20 +0200921Sysfs
922~~~~~
923
924Install sysfsutils and set sysfs attributes:
925
926.. code-block:: yaml
927
928 linux:
929 system:
930 sysfs:
931 scheduler:
932 block/sda/queue/scheduler: deadline
933 power:
934 mode:
935 power/state: 0660
936 owner:
937 power/state: "root:power"
938 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
939
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200940Optional: You can also use list that will ensure order of items.
941
942.. code-block:: yaml
943
944 linux:
945 system:
946 sysfs:
947 scheduler:
948 block/sda/queue/scheduler: deadline
949 power:
950 - mode:
951 power/state: 0660
952 - owner:
953 power/state: "root:power"
954 - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
955
Martin Polreich148e1b82018-09-13 15:54:25 +0200956Sysfs definition with disabled automatic write. Attributes are saved
957to configuration, but are not applied during the run.
958Thay will be applied automatically after the reboot.
959
960
961.. code-block:: yaml
962
963 linux:
964 system:
965 sysfs:
966 enable_apply: false
967 scheduler:
968 block/sda/queue/scheduler: deadline
969
970.. note:: The `enable_apply` parameter defaults to `True` if not defined.
971
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100972Huge Pages
973~~~~~~~~~~~~
974
975Huge Pages give a performance boost to applications that intensively deal
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300976with memory allocation/deallocation by decreasing memory fragmentation:
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100977
978.. code-block:: yaml
979
980 linux:
981 system:
982 kernel:
983 hugepages:
984 small:
985 size: 2M
986 count: 107520
987 mount_point: /mnt/hugepages_2MB
Michael Polenchukd9369fe2018-05-08 17:53:08 +0400988 mount: false/true # default is true (mount immediately) / false (just save in the fstab)
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100989 large:
990 default: true # default automatically mounted
991 size: 1G
992 count: 210
993 mount_point: /mnt/hugepages_1GB
994
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300995.. note:: Not recommended to use both pagesizes concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100996
Jakub Pavlik5398d872017-02-13 22:30:47 +0100997Intel SR-IOV
998~~~~~~~~~~~~
999
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001000PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV)
1001specification defines a standardized mechanism to virtualize
1002PCIe devices. The mechanism can virtualize a single PCIe
1003Ethernet controller to appear as multiple PCIe devices:
Jakub Pavlik5398d872017-02-13 22:30:47 +01001004
1005.. code-block:: yaml
1006
1007 linux:
1008 system:
1009 kernel:
1010 sriov: True
1011 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
1012 rc:
1013 local: |
1014 #!/bin/sh -e
1015 # Enable 7 VF on eth1
1016 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
1017 exit 0
1018
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001019Isolate CPU options
1020~~~~~~~~~~~~~~~~~~~
1021
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001022Remove the specified CPUs, as defined by the cpu_number values, from
1023the general kernel SMP balancing and scheduler algroithms. The only
1024way to move a process onto or off an *isolated* CPU is via the CPU
1025affinity syscalls. ``cpu_number begins`` at ``0``, so the
1026maximum value is ``1`` less than the number of CPUs on the system.:
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001027
1028.. code-block:: yaml
1029
1030 linux:
1031 system:
1032 kernel:
1033 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +01001034
Filip Pytlounf5383a42015-10-06 16:28:32 +02001035Repositories
1036~~~~~~~~~~~~
1037
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001038RedHat-based Linux with additional OpenStack repo:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001039
1040.. code-block:: yaml
1041
1042 linux:
1043 system:
1044 ...
1045 repo:
1046 rdo-icehouse:
1047 enabled: true
1048 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
1049 pgpcheck: 0
1050
1051Ensure system repository to use czech Debian mirror (``default: true``)
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001052Also pin it's packages with priority ``900``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001053
1054.. code-block:: yaml
1055
1056 linux:
1057 system:
1058 repo:
1059 debian:
1060 default: true
1061 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
1062 # Import signing key from URL if needed
1063 key_url: "http://dummy.com/public.gpg"
1064 pin:
1065 - pin: 'origin "ftp.cz.debian.org"'
1066 priority: 900
1067 package: '*'
1068
azvyagintseva3a73d02018-12-06 14:49:58 +02001069Sometimes better to use one pining rule file, to decrease mistaken
1070ordering. You can use those option ``system:apt:preferences``, which would add opts into
1071``/etc/apt/preferences`` file:
1072
1073.. code-block:: yaml
1074
1075 parameters:
1076 linux:
1077 system:
1078 apt:
1079 preferences:
1080 enabled: true
1081 rules:
1082 100:
1083 enabled: true
1084 name: 'some origin pin'
1085 pin: 'release o=Debian'
1086 priority: 1100
1087 package: '*'
1088
1089
azvyagintsev4494a472018-09-14 19:19:23 +03001090If you need to add multiple pin rules for one repo, please use new,ordered definition format
1091('pinning' definition will be in priotity to use):
1092
1093.. code-block:: yaml
1094
1095 linux:
1096 system:
1097 repo:
1098 mcp_saltstack:
1099 source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main"
1100 architectures: amd64
1101 clean_file: true
1102 pinning:
1103 10:
1104 enabled: true
1105 pin: 'release o=SaltStack'
1106 priority: 50
1107 package: 'libsodium18'
1108 20:
1109 enabled: true
1110 pin: 'release o=SaltStack'
1111 priority: 1100
1112 package: '*'
1113
1114
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001115.. note:: For old Ubuntu releases (<xenial)
azvyagintsevff089d22018-07-27 16:52:34 +02001116 extra packages for apt transport, like ``apt-transport-https``
1117 may be required to be installed manually.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001118 (Chicken-eggs issue: we need to install packages to
azvyagintsevff089d22018-07-27 16:52:34 +02001119 reach repo from where they should be installed)
1120 Otherwise, you still can try 'fortune' and install prereq.packages before
1121 any repo configuration, using list of requires in map.jinja.
1122
1123
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001124Disabling any prerequisite packages installation:
1125
azvyagintsevff089d22018-07-27 16:52:34 +02001126You can simply drop any package pre-installation (before system.linux.repo
1127will be processed) via cluster lvl:
1128
1129.. code-block:: yaml
1130
1131 linux:
1132 system:
1133 pkgs: ~
1134
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001135Package manager proxy global setup:
Petr Michalec10462bb2017-03-23 19:18:08 +01001136
1137.. code-block:: yaml
1138
1139 linux:
1140 system:
1141 ...
1142 repo:
1143 apt-mk:
1144 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1145 ...
1146 proxy:
1147 pkg:
1148 enabled: true
1149 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1150 ...
1151 # NOTE: Global defaults for any other componet that configure proxy on the system.
1152 # If your environment has just one simple proxy, set it on linux:system:proxy.
1153 #
1154 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1155 # as for https and http
1156 ftp: ftp://proxy.host.local:2121
1157 http: http://proxy.host.local:3142
1158 https: https://proxy.host.local:3143
1159
Taras Khlivnyake64d5c92021-02-17 09:10:16 +02001160Package manager direct access setup:
1161
1162.. code-block:: yaml
1163
1164 linux:
1165 system:
1166 ...
1167 repo:
1168 apt-mk:
1169 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1170 ...
1171 proxy:
1172 pkg:
1173 enabled: true
1174 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1175 ...
1176 # NOTE: Global defaults for any other componet that configure proxy on the system.
1177 # If your environment has just one simple proxy, set it on linux:system:proxy.
1178 #
1179 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1180 # as for https and http
1181 ftp: ftp://proxy.host.local:2121
1182 http: http://proxy.host.local:3142
1183 https: https://proxy.host.local:3143
1184 direct:
1185 - 192.168.0.100
1186 - repo.wo.proxy.local
1187
1188
Petr Michalec10462bb2017-03-23 19:18:08 +01001189Package manager proxy setup per repository:
1190
1191.. code-block:: yaml
1192
1193 linux:
1194 system:
1195 ...
1196 repo:
1197 debian:
1198 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1199 ...
1200 apt-mk:
1201 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1202 # per repository proxy
1203 proxy:
1204 enabled: true
1205 http: http://maas-01:8080
1206 https: http://maas-01:8080
1207 ...
1208 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001209 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +01001210 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
1211 pkg:
1212 enabled: true
1213 ftp: ftp://proxy.host.local:2121
1214 #http: http://proxy.host.local:3142
1215 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001216 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001217 # global system fallback system defaults
1218 ftp: ftp://proxy.host.local:2121
1219 http: http://proxy.host.local:3142
1220 https: https://proxy.host.local:3143
1221
Ivan Berezovskiy6335da52019-06-25 20:15:51 +04001222
1223Add secured apt repository:
1224
1225.. code-block:: yaml
1226
1227 linux:
1228 system:
1229 ...
1230 repo:
1231 test:
1232 secure: true
1233 url: example.org/ubuntu
1234 arch: deb
1235 protocol: http
1236 user: foo
1237 password: bar
1238 distribution: stable
1239 component: main
1240
1241Add multiply secured apt repositories with same credentials:
1242
1243.. code-block:: yaml
1244
1245 linux:
1246 system:
1247 ...
1248 common_repo_secured:
1249 arch: deb
1250 protocol: http
1251 user: foo
1252 password: bar
1253 distribution: stable
1254 component: main
1255 repo:
1256 test1:
1257 secure: true
1258 url: example1.org/ubuntu
1259 test2:
1260 secure: true
1261 url: example2.org/ubuntu
1262
Denis Egorenko808bd032019-12-05 15:46:06 +04001263Also it is possible to specify list of repos, which should be secured
1264within ``common_repo_secured`` block and without changing current
1265existing repo source parameter:
1266
1267.. code-block:: yaml
1268
1269 linux:
1270 system:
1271 ...
1272 common_repo_secured:
1273 user: foo
1274 password: bar
1275 secured_repos: [ 'test1', 'test2' ]
1276 repo:
1277 test1:
1278 ...
1279 test2:
1280 ...
1281 test3:
1282 ...
1283
1284Repos ``test1, test2`` will be secured. In case if you want secure all
1285available repos use ``secured_repos: [ 'all' ]``. But repo parameters have
1286precedence over parameters from ``common_repo_secured``. In next case:
1287
1288 linux:
1289 system:
1290 ...
1291 common_repo_secured:
1292 user: foo
1293 password: bar
1294 secured_repos: [ 'all' ]
1295 repo:
1296 test1:
1297 ...
1298 test2:
1299 ...
1300 test3:
1301 secure: False
1302 ...
1303
1304Repo ``test3`` will not be secured.
1305
Jiri Broulik34a29b42017-04-25 14:42:54 +02001306Remove all repositories:
1307
1308.. code-block:: yaml
1309
1310 linux:
1311 system:
1312 purge_repos: true
1313
azvyagintsevff089d22018-07-27 16:52:34 +02001314Refresh repositories metada, after configuration:
1315
1316.. code-block:: yaml
1317
1318 linux:
1319 system:
1320 refresh_repos_meta: true
1321
Filip Pytlounc512e6c2017-11-22 14:28:10 +01001322Setup custom apt config options:
1323
1324.. code-block:: yaml
1325
1326 linux:
1327 system:
1328 apt:
1329 config:
1330 compression-workaround:
1331 "Acquire::CompressionTypes::Order": "gz"
1332 docker-clean:
1333 "DPkg::Post-Invoke":
1334 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
1335 "APT::Update::Post-Invoke":
1336 - "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 +02001337
Petr Michalec10462bb2017-03-23 19:18:08 +01001338RC
1339~~
1340
Jakub Pavlik78859382016-01-21 11:26:39 +01001341rc.local example
1342
1343.. code-block:: yaml
1344
1345 linux:
1346 system:
1347 rc:
1348 local: |
1349 #!/bin/sh -e
1350 #
1351 # rc.local
1352 #
1353 # This script is executed at the end of each multiuser runlevel.
1354 # Make sure that the script will "exit 0" on success or any other
1355 # value on error.
1356 #
1357 # In order to enable or disable this script just change the execution
1358 # bits.
1359 #
1360 # By default this script does nothing.
1361 exit 0
1362
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001363Prompt
1364~~~~~~
1365
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001366Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``.
1367Every user can have different prompt:
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001368
1369.. code-block:: yaml
1370
1371 linux:
1372 system:
1373 prompt:
1374 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\\]
1375 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
1376
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001377On Debian systems, to set prompt system-wide, it's necessary to
1378remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``,
1379which comes from ``/etc/skel/.bashrc``. This formula will do
1380this automatically, but will not touch existing user's
1381``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +01001382
Filip Pytlouneef11c12016-03-25 11:00:23 +01001383Bash
1384~~~~
1385
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001386Fix bash configuration to preserve history across sessions
1387like ZSH does by default:
Filip Pytlouneef11c12016-03-25 11:00:23 +01001388
1389.. code-block:: yaml
1390
1391 linux:
1392 system:
1393 bash:
1394 preserve_history: true
1395
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001396Login banner message
1397~~~~~~~~~~~~~~~~~~~~
1398
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001399``/etc/issue`` is a text file which contains a message or system
1400identification to be printed before the login prompt. It may contain
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001401various @char and \char sequences, if supported by the getty-type
1402program employed on the system.
1403
1404Setting logon banner message is easy:
1405
1406.. code-block:: yaml
1407
1408 liunx:
1409 system:
1410 banner:
1411 enabled: true
1412 contents: |
1413 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1414
1415 You must have explicit, authorized permission to access or configure this
1416 device. Unauthorized attempts and actions to access or use this system may
1417 result in civil and/or criminal penalties.
1418 All activities performed on this system are logged and monitored.
1419
Filip Pytloune874dfb2016-01-22 16:57:34 +01001420Message of the day
1421~~~~~~~~~~~~~~~~~~
1422
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001423``pam_motd`` from package ``libpam-modules`` is used for dynamic
1424messages of the day. Setting custom ``motd`` will clean up existing ones.
Filip Pytloune874dfb2016-01-22 16:57:34 +01001425
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001426Setting static ``motd`` will replace existing ``/etc/motd`` and remove
1427scripts from ``/etc/update-motd.d``.
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001428
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001429Setting static ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001430
1431.. code-block:: yaml
1432
1433 linux:
1434 system:
1435 motd: |
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
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001443Setting dynamic ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001444
Filip Pytloune874dfb2016-01-22 16:57:34 +01001445.. code-block:: yaml
1446
1447 linux:
1448 system:
1449 motd:
1450 - release: |
1451 #!/bin/sh
1452 [ -r /etc/lsb-release ] && . /etc/lsb-release
1453
1454 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
1455 # Fall back to using the very slow lsb_release utility
1456 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
1457 fi
1458
1459 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
1460 - warning: |
1461 #!/bin/sh
1462 printf "This is [company name] network.\n"
1463 printf "Unauthorized access strictly prohibited.\n"
1464
Marek Celoud713e9072017-05-18 15:20:25 +02001465Services
1466~~~~~~~~
1467
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001468Stop and disable the ``linux`` service:
Marek Celoud713e9072017-05-18 15:20:25 +02001469
1470.. code-block:: yaml
1471
1472 linux:
1473 system:
1474 service:
1475 apt-daily.timer:
1476 status: dead
1477
Dzmitry Stremkouski70d09782018-11-30 16:04:59 +01001478Override systemd service unit:
1479
1480.. code-block:: yaml
1481
1482 parameters:
1483
1484 linux:
1485 system:
1486 service:
1487 tgt:
1488 name: tgt
1489 status: running
1490 enabled: True
1491 override:
1492 50:
1493 target: tgt.service.d
1494 name: bind
1495 content: |
1496 [Service]
1497 ExecStart=
1498 ExecStart=/usr/sbin/tgtd -f --iscsi portal=${_param:single_address}:3260
1499
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001500Possible statuses are ``dead`` (disable service by default), ``running``
1501(enable service by default), ``enabled``, ``disabled``:
Marek Celoud713e9072017-05-18 15:20:25 +02001502
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001503Linux with the ``atop`` service:
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +03001504
1505.. code-block:: yaml
1506
1507 linux:
1508 system:
1509 atop:
1510 enabled: true
1511 interval: 20
1512 logpath: "/var/log/atop"
1513 outfile: "/var/log/atop/daily.log"
1514
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001515Linux with the ``mcelog`` service:
Oleksii Chupryn144432b2018-05-22 10:34:48 +03001516
1517.. code-block:: yaml
1518
1519 linux:
1520 system:
1521 mcelog:
1522 enabled: true
1523 logging:
1524 syslog: true
1525 syslog_error: true
1526
Denis Egorenkof0ef8c22019-11-22 17:26:30 +04001527Linux Sosreport
1528^^^^^^^^^^^^^^^
1529
1530Sosreport is an extensible, portable, support data collection tool
1531primarily aimed at Linux distributions and other UNIX-like operating systems,
1532which allows to create diagnostic snapshot of system.
1533
1534Works out of box and additional pillars are not needed by default:
1535
1536.. code-block:: bash
1537
1538 salt-call state.sls linux.system.sosreport.report
1539
1540or from Salt Master:
1541
1542.. code-block:: bash
1543
1544 salt -C '<target>' state.sls linux.system.sosreport.report
1545
1546Sosreport configuration may be extended with next pillar data:
1547
1548.. code-block:: yaml
1549
1550 linux:
1551 system:
1552 sosreport:
1553 cmd_options:
1554 tmp-dir: /root/reportdir
1555 no_arg_opts: [ '-q' ]
1556 config_options:
1557 general:
1558 all-logs: true
1559 plugins:
1560 disabled: [ docker ]
1561 tunables:
1562 apache.log: true
1563
1564Where is ``cmd_options`` additional provided arguments for cli cmd call,
1565``general`` desribes parameters for sos.conf ``general`` section,
1566``plugins`` desribes which plugins should be ``enabled`` or ``disabled``
1567and ``tunables`` has custom plugin options which can be additionally set.
1568
1569Also it is possible to pass cmd_options through pillar override:
1570
1571.. code-block:: bash
1572
1573 salt -C '<target>' state.sls linux.system.sosreport.report pillar='{ "sosreport" : { "ticket-number": 12345, "tmp-dir": "/root/reportdir2" } }'
1574
1575Run ``sosreport --help`` to get full list of possible options.
1576
1577Once state ``linux.system.sosreport.report`` is executed on targets, it is
1578possible to collect all reports by using next command on Salt Master:
1579
1580.. code-block:: bash
1581
1582 salt -C 'I@salt:master' state.sls linux.system.sosreport.collect pillar='{ "sosreport_collect" : { "target": "<target>", "archiveName": "sosreport_<env_name>_<customer>_<ticket>" } }'
1583
1584This will generate one common archive for all ``<target>`` nodes with name
1585``sosreport_<env_name>_<customer>_<ticket>.tar.gz``. It is required to specify
1586target nodes through model (``linux.system.sosreport.collect``) or pillar
1587override. Also possible options are: ``nodeIp`` which allows you to use IP from another
1588interface on node (should be available from minions), ``port`` for NetCat if
1589you see that default port is busy, ``archiveName`` for your archive and
1590``reportWorkDir`` directory to keeping all reports for current case.
1591
Filip Pytloun2f70b492016-02-19 15:55:25 +01001592RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +01001593^^^^^^^^^^^^^
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001594Currently, ``update-motd`` is not available
1595for RHEL. So there is no native support for dynamic ``motd``.
1596You can still set a static one, with a different pillar structure:
Filip Pytloun2f70b492016-02-19 15:55:25 +01001597
1598.. code-block:: yaml
1599
1600 linux:
1601 system:
1602 motd: |
1603 This is [company name] network.
1604 Unauthorized access strictly prohibited.
1605
Filip Pytloun8296bb92016-02-19 18:42:09 +01001606Haveged
1607~~~~~~~
1608
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001609If you are running headless server and are low on entropy,
1610you may set up Haveged:
Filip Pytloun8296bb92016-02-19 18:42:09 +01001611
1612.. code-block:: yaml
1613
1614 linux:
1615 system:
1616 haveged:
1617 enabled: true
1618
Filip Pytlounf5383a42015-10-06 16:28:32 +02001619Linux network
1620-------------
1621
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001622Linux with network manager:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001623
1624.. code-block:: yaml
1625
1626 linux:
1627 network:
1628 enabled: true
1629 network_manager: true
1630
Dzmitry Stremkouski00cdbe62018-10-31 16:41:54 +01001631Execute linux.network.interface state without ifupdown activity:
1632
1633.. code-block:: bash
1634
1635 salt-call linux.network.interface pillar='{"linux":{"network":{"noifupdown":True}}}'
1636
1637
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001638Linux with default static network interfaces, default gateway
1639interface and DNS servers:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001640
1641.. code-block:: yaml
1642
1643 linux:
1644 network:
1645 enabled: true
1646 interface:
1647 eth0:
1648 enabled: true
1649 type: eth
1650 address: 192.168.0.102
1651 netmask: 255.255.255.0
1652 gateway: 192.168.0.1
1653 name_servers:
1654 - 8.8.8.8
1655 - 8.8.4.4
1656 mtu: 1500
1657
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001658Linux with bonded interfaces and disabled ``NetworkManager``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001659
1660.. code-block:: yaml
1661
1662 linux:
1663 network:
1664 enabled: true
1665 interface:
1666 eth0:
1667 type: eth
1668 ...
1669 eth1:
1670 type: eth
1671 ...
1672 bond0:
1673 enabled: true
1674 type: bond
1675 address: 192.168.0.102
1676 netmask: 255.255.255.0
Dzmitry Stremkouskif6fb7212019-08-26 16:48:05 +02001677 proto: manual
1678 mtu: 9000
1679 name: ${_param:vlan_bond_name}
1680 slaves: ${_param:vlan_nic1} ${_param:vlan_nic2}
1681 mode: 802.3ad
1682 lacp_rate: slow
1683 downdelay: 200
1684 xmit_hash_policy: layer3+4
1685 miimon: 100
1686 use_interfaces:
1687 - ${_param:vlan_nic1}
1688 - ${_param:vlan_nic2}
1689 require_interfaces:
1690 - ${_param:vlan_nic1}
1691 - ${_param:vlan_nic2}
jan kaufman6d30adf2016-01-18 17:30:12 +01001692 network_manager:
1693 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001694
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001695Linux with VLAN ``interface_params``:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001696
1697.. code-block:: yaml
1698
1699 linux:
1700 network:
1701 enabled: true
1702 interface:
1703 vlan69:
1704 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001705 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001706 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001707
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001708Linux with wireless interface parameters:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001709
1710.. code-block:: yaml
1711
1712 linux:
1713 network:
1714 enabled: true
1715 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001716 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001717 interface:
1718 wlan0:
1719 type: eth
1720 wireless:
1721 essid: example
1722 key: example_key
1723 security: wpa
1724 priority: 1
1725
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001726Linux networks with routes defined:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001727
1728.. code-block:: yaml
1729
1730 linux:
1731 network:
1732 enabled: true
1733 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001734 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001735 interface:
1736 eth0:
1737 type: eth
1738 route:
1739 default:
1740 address: 192.168.0.123
1741 netmask: 255.255.255.0
1742 gateway: 192.168.0.1
1743
ivcc4730b12019-01-23 07:56:53 +03001744Linux networks with implicit routes definition:
1745
1746- on node 1:
1747
1748.. code-block:: yaml
1749
1750 linux:
1751 network:
1752 enabled: true
1753 router:
1754 ctl:
1755 # router that connects 10.0.1.0/24 and 10.0.2.0/24
1756 addresses:
1757 - 10.0.1.1/24
1758 - 10.0.2.1/24
1759 test:
1760 addresses:
1761 - 10.0.1.2/24
1762 networks:
1763 - 10.100.0.0/16
1764 interface:
1765 ctl:
1766 name: eth0
1767 address: 10.0.1.101
1768 netmask: 255.255.255.0
1769
1770- on node2:
1771
1772.. code-block:: yaml
1773
1774 linux:
1775 network:
1776 enabled: true
1777 router:
1778 ctl:
1779 # equivalent of node1's ctl router with 'implicit_routes = false'
1780 options:
1781 implicit_routes: false
1782 addresses:
1783 - 10.0.1.1/24
1784 - 10.0.2.1/24
1785 networks:
1786 - 10.0.1.0/24
1787 - 10.0.2.0/24
1788 interface:
1789 ctl:
1790 name: eth0
1791 address: 10.0.2.101
1792 netmask: 255.255.255.0
1793
1794
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001795Native Linux Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001796
1797.. code-block:: yaml
1798
1799 linux:
1800 network:
1801 interface:
1802 eth1:
1803 enabled: true
1804 type: eth
1805 proto: manual
1806 up_cmds:
1807 - ip address add 0/0 dev $IFACE
1808 - ip link set $IFACE up
1809 down_cmds:
1810 - ip link set $IFACE down
1811 br-ex:
1812 enabled: true
1813 type: bridge
1814 address: ${linux:network:host:public_local:address}
1815 netmask: 255.255.255.0
1816 use_interfaces:
1817 - eth1
1818
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001819Open vSwitch Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001820
1821.. code-block:: yaml
1822
1823 linux:
1824 network:
1825 bridge: openvswitch
1826 interface:
1827 eth1:
1828 enabled: true
1829 type: eth
1830 proto: manual
1831 up_cmds:
1832 - ip address add 0/0 dev $IFACE
1833 - ip link set $IFACE up
1834 down_cmds:
1835 - ip link set $IFACE down
1836 br-ex:
1837 enabled: true
1838 type: bridge
1839 address: ${linux:network:host:public_local:address}
1840 netmask: 255.255.255.0
1841 use_interfaces:
1842 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001843 br-prv:
1844 enabled: true
1845 type: ovs_bridge
1846 mtu: 65000
1847 br-ens7:
1848 enabled: true
1849 name: br-ens7
1850 type: ovs_bridge
1851 proto: manual
1852 mtu: 9000
1853 use_interfaces:
1854 - ens7
1855 patch-br-ens7-br-prv:
1856 enabled: true
1857 name: ens7-prv
1858 ovs_type: ovs_port
1859 type: ovs_port
1860 bridge: br-ens7
1861 port_type: patch
1862 peer: prv-ens7
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001863 tag: 109 # [] to unset a tag
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001864 mtu: 65000
1865 patch-br-prv-br-ens7:
1866 enabled: true
1867 name: prv-ens7
1868 bridge: br-prv
1869 ovs_type: ovs_port
1870 type: ovs_port
1871 port_type: patch
1872 peer: ens7-prv
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001873 tag: 109
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001874 mtu: 65000
1875 ens7:
1876 enabled: true
1877 name: ens7
1878 proto: manual
1879 ovs_port_type: OVSPort
1880 type: ovs_port
1881 ovs_bridge: br-ens7
1882 bridge: br-ens7
Oleg Gelbukh52f9f762019-07-01 15:26:16 -07001883 ens6:
1884 enabled: true
1885 proto: manual
1886 type: eth
1887 ovs_bridge: br-ctl
1888 br-ctl:
1889 enabled: true
1890 type: ovs_bridge
1891 internal-br-ctl-port:
1892 enabled: true
1893 proto: static
1894 address: 172.172.0.10
1895 netmask: 255.255.0.0
1896 name_servers:
1897 - 8.8.8.8
1898 - 172.172.172.172
1899 name: port-br-ctl
1900 bridge: br-ctl
1901 ovs_type: ovs_port
1902 type: ovs_port
1903 port_type: internal
1904 mtu: 65000
Filip Pytlounf5383a42015-10-06 16:28:32 +02001905
Petr Jediný8f8ae542017-07-13 16:19:12 +02001906Debian manual proto interfaces
1907
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001908When you are changing interface proto from static in up state
1909to manual, you may need to flush ip addresses. For example,
1910if you want to use the interface and the ip on the bridge.
1911This can be done by setting the ``ipflush_onchange`` to true.
Petr Jediný8f8ae542017-07-13 16:19:12 +02001912
1913.. code-block:: yaml
1914
1915 linux:
1916 network:
1917 interface:
1918 eth1:
1919 enabled: true
1920 type: eth
1921 proto: manual
1922 mtu: 9100
1923 ipflush_onchange: true
1924
Jiri Broulik1a191e32018-01-15 15:54:21 +01001925Debian static proto interfaces
1926
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001927When you are changing interface proto from dhcp in up state to
1928static, you may need to flush ip addresses and restart interface
1929to assign ip address from a managed file. For example, if you wantto
1930use the interface and the ip on the bridge. This can be done by
1931setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
1932param set to true.
Jiri Broulik1a191e32018-01-15 15:54:21 +01001933
1934.. code-block:: yaml
1935
1936 linux:
1937 network:
1938 interface:
1939 eth1:
1940 enabled: true
1941 type: eth
1942 proto: static
1943 address: 10.1.0.22
1944 netmask: 255.255.255.0
1945 ipflush_onchange: true
1946 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001947
Petr Jedinýd577cb52017-06-28 20:17:49 +02001948Concatinating and removing interface files
1949
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001950Debian based distributions have ``/etc/network/interfaces.d/``
1951directory, where you can store configuration of network
1952interfaces in separate files. You can concatinate the files
1953to the defined destination when needed, this operation removes
1954the file from the ``/etc/network/interfaces.d/``. If you just need
1955to remove iface files, you can use the ``remove_iface_files`` key.
Petr Jedinýd577cb52017-06-28 20:17:49 +02001956
1957.. code-block:: yaml
1958
1959 linux:
1960 network:
1961 concat_iface_files:
1962 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1963 dst: '/etc/network/interfaces'
1964 remove_iface_files:
1965 - '/etc/network/interfaces.d/90-custom.cfg'
1966
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001967Configure DHCP client
Petr Jedinýd577cb52017-06-28 20:17:49 +02001968
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001969None of the keys is mandatory, include only those you really need.
1970For full list of available options under send, supersede, prepend,
1971append refer to dhcp-options(5).
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001972
1973.. code-block:: yaml
1974
1975 linux:
1976 network:
1977 dhclient:
1978 enabled: true
1979 backoff_cutoff: 15
1980 initial_interval: 10
1981 reboot: 10
1982 retry: 60
1983 select_timeout: 0
1984 timeout: 120
1985 send:
1986 - option: host-name
1987 declaration: "= gethostname()"
1988 supersede:
1989 - option: host-name
1990 declaration: "spaceship"
1991 - option: domain-name
1992 declaration: "domain.home"
1993 #- option: arp-cache-timeout
1994 # declaration: 20
1995 prepend:
1996 - option: domain-name-servers
1997 declaration:
1998 - 8.8.8.8
1999 - 8.8.4.4
2000 - option: domain-search
2001 declaration:
2002 - example.com
2003 - eng.example.com
2004 #append:
2005 #- option: domain-name-servers
2006 # declaration: 127.0.0.1
2007 # ip or subnet to reject dhcp offer from
2008 reject:
2009 - 192.33.137.209
2010 - 10.0.2.0/24
2011 request:
2012 - subnet-mask
2013 - broadcast-address
2014 - time-offset
2015 - routers
2016 - domain-name
2017 - domain-name-servers
2018 - domain-search
2019 - host-name
2020 - dhcp6.name-servers
2021 - dhcp6.domain-search
2022 - dhcp6.fqdn
2023 - dhcp6.sntp-servers
2024 - netbios-name-servers
2025 - netbios-scope
2026 - interface-mtu
2027 - rfc3442-classless-static-routes
2028 - ntp-servers
2029 require:
2030 - subnet-mask
2031 - domain-name-servers
2032 # if per interface configuration required add below
2033 interface:
2034 ens2:
2035 initial_interval: 11
2036 reject:
2037 - 192.33.137.210
2038 ens3:
2039 initial_interval: 12
2040 reject:
2041 - 192.33.137.211
2042
Petr Michaleceb14b552017-06-01 10:27:05 +02002043Linux network systemd settings:
2044
2045.. code-block:: yaml
2046
2047 linux:
2048 network:
2049 ...
2050 systemd:
2051 link:
2052 10-iface-dmz:
2053 Match:
2054 MACAddress: c8:5b:67:fa:1a:af
2055 OriginalName: eth0
2056 Link:
2057 Name: dmz0
2058 netdev:
2059 20-bridge-dmz:
2060 match:
2061 name: dmz0
2062 network:
2063 mescription: bridge
2064 bridge: br-dmz0
2065 network:
2066 # works with lowercase, keys are by default capitalized
2067 40-dhcp:
2068 match:
2069 name: '*'
2070 network:
2071 DHCP: yes
2072
Petr Michalec10462bb2017-03-23 19:18:08 +01002073Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01002074
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002075Use ``/etc/environment`` for static system wide variable assignment
2076after boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002077
2078.. code-block:: yaml
2079
2080 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01002081 system:
2082 env:
2083 BOB_VARIABLE: Alice
2084 ...
2085 BOB_PATH:
2086 - /srv/alice/bin
2087 - /srv/bob/bin
2088 ...
2089 ftp_proxy: none
2090 http_proxy: http://global-http-proxy.host.local:8080
2091 https_proxy: ${linux:system:proxy:https}
2092 no_proxy:
2093 - 192.168.0.80
2094 - 192.168.1.80
2095 - .domain.com
2096 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02002097 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01002098 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002099 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01002100 ftp: ftp://proxy.host.local:2121
2101 http: http://proxy.host.local:3142
2102 https: https://proxy.host.local:3143
2103 noproxy:
2104 - .domain.com
2105 - .local
2106
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002107Configure the ``profile.d`` scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01002108
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002109The ``profile.d`` scripts are being sourced during ``.sh`` execution
2110and support variable expansion in opposite to /etc/environment global
2111settings in ``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01002112
2113.. code-block:: yaml
2114
2115 linux:
2116 system:
2117 profile:
2118 locales: |
2119 export LANG=C
2120 export LC_ALL=C
2121 ...
2122 vi_flavors.sh: |
2123 export PAGER=view
2124 export EDITOR=vim
2125 alias vi=vim
2126 shell_locales.sh: |
2127 export LANG=en_US
2128 export LC_ALL=en_US.UTF-8
2129 shell_proxies.sh: |
2130 export FTP_PROXY=ftp://127.0.3.3:2121
2131 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02002132
Dmitry Teselkina0d31d12018-09-04 14:43:09 +03002133
2134Configure login.defs parameters
2135-------------------------------
2136
2137.. code-block:: yaml
2138
2139 linux:
2140 system:
2141 login_defs:
2142 <opt_name>:
2143 enabled: true
2144 value: <opt_value>
2145
2146<opt_name> is a configurational option defined in 'man login.defs'.
2147<opt_name> is case sensitive, should be UPPERCASE only!
2148
2149
Filip Pytlounf5383a42015-10-06 16:28:32 +02002150Linux with hosts
2151
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002152Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
2153removing entries that are not defined in model except defaults
2154for both IPv4 and IPv6 localhost and hostname as well as FQDN.
Ales Komarek417e8c52017-08-25 15:10:29 +02002155
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002156We recommend using this option to verify that ``/etc/hosts``
2157is always in a clean state. However it is not enabled by default
2158for security reasons.
Filip Pytloun86506fe2017-01-26 14:36:16 +01002159
Filip Pytlounf5383a42015-10-06 16:28:32 +02002160.. code-block:: yaml
2161
2162 linux:
2163 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002164 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002165 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002166 # No need to define this one if purge_hosts is true
2167 hostname:
2168 address: 127.0.1.1
2169 names:
2170 - ${linux:network:fqdn}
2171 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02002172 node1:
2173 address: 192.168.10.200
2174 names:
2175 - node2.domain.com
2176 - service2.domain.com
2177 node2:
2178 address: 192.168.10.201
2179 names:
2180 - node2.domain.com
2181 - service2.domain.com
2182
Ales Komarek417e8c52017-08-25 15:10:29 +02002183Linux with hosts collected from mine
2184
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002185All DNS records defined within infrastrucuture
2186are passed to the local hosts records or any DNS server. Only
2187hosts with the ``grain`` parameter set to ``true`` will be propagated
2188to the mine.
Ales Komarek417e8c52017-08-25 15:10:29 +02002189
2190.. code-block:: yaml
2191
2192 linux:
2193 network:
2194 purge_hosts: true
2195 mine_dns_records: true
2196 host:
2197 node1:
2198 address: 192.168.10.200
2199 grain: true
2200 names:
2201 - node2.domain.com
2202 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01002203
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002204Set up ``resolvconf's basic resolver info``, e.g. nameservers, search/domain and options:
Filip Pytlounde9bea52016-01-11 15:39:10 +01002205
2206.. code-block:: yaml
2207
2208 linux:
2209 network:
2210 resolv:
2211 dns:
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002212 - 8.8.4.4
2213 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01002214 domain: my.example.com
2215 search:
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002216 - my.example.com
2217 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01002218 options:
Michael Polenchuk95bc83a2019-01-15 18:47:48 +04002219 - ndots:5
2220 - timeout:2
2221 - attempts:2
Filip Pytlounde9bea52016-01-11 15:39:10 +01002222
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002223Set up custom TX queue length for tap interfaces:
Andrii Petrenko735761d2017-03-21 17:17:35 -07002224
2225.. code-block:: yaml
2226
2227 linux:
2228 network:
Dzmitry Stremkouskic58cb242020-09-14 17:41:49 +02002229 custom_txqueuelen
2230 tap:
2231 queue_length: 10000
2232 enabled: true
2233 device_filter: 'tap[0-9a-z\-]*'
2234 ten:
2235 enabled: false
2236 veth:
2237 queue_length: 20000
Andrii Petrenko735761d2017-03-21 17:17:35 -07002238
Michael Polenchuk6e3042b2019-04-22 15:20:03 +04002239Auto repair/re-attach libvirt's vnet interfaces:
2240
2241.. code-block:: yaml
2242
2243 linux:
2244 network:
2245 libvirt_vnet_repair: true
2246
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002247DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002248
2249**DPDK OVS NIC**
2250
2251.. code-block:: yaml
2252
2253 linux:
2254 network:
2255 bridge: openvswitch
2256 dpdk:
2257 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002258 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002259 openvswitch:
2260 pmd_cpu_mask: "0x6"
2261 dpdk_socket_mem: "1024,1024"
2262 dpdk_lcore_mask: "0x400"
2263 memory_channels: 2
2264 interface:
2265 dpkd0:
2266 name: ${_param:dpdk_nic}
2267 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002268 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002269 enabled: true
2270 type: dpdk_ovs_port
2271 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002272 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002273 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01002274 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002275 br-prv:
2276 enabled: true
2277 type: dpdk_ovs_bridge
Michael Polenchukd3378db2018-12-29 16:46:50 +04002278 br-floating:
2279 enabled: true
2280 type: ovs_bridge
2281 name_servers:
2282 - 1.1.1.1
2283 - 9.9.9.9
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002284
2285**DPDK OVS Bond**
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 dpdk_second_nic:
2302 name: ${_param:primary_second_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 bond: dpdkbond0
2306 enabled: true
2307 type: dpdk_ovs_port
2308 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002309 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002310 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002311 dpdk_first_nic:
2312 name: ${_param:primary_first_nic}
2313 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002314 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002315 bond: dpdkbond0
2316 enabled: true
2317 type: dpdk_ovs_port
2318 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002319 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002320 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002321 dpdkbond0:
2322 enabled: true
2323 bridge: br-prv
2324 type: dpdk_ovs_bond
2325 mode: active-backup
2326 br-prv:
2327 enabled: true
2328 type: dpdk_ovs_bridge
2329
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01002330**DPDK OVS LACP Bond with vlan tag**
2331
2332.. code-block:: yaml
2333
2334 linux:
2335 network:
2336 bridge: openvswitch
2337 dpdk:
2338 enabled: true
2339 driver: uio
2340 openvswitch:
2341 pmd_cpu_mask: "0x6"
2342 dpdk_socket_mem: "1024,1024"
2343 dpdk_lcore_mask: "0x400"
2344 memory_channels: "2"
2345 interface:
2346 eth3:
2347 enabled: true
2348 type: eth
2349 proto: manual
2350 name: ${_param:tenant_first_nic}
2351 eth4:
2352 enabled: true
2353 type: eth
2354 proto: manual
2355 name: ${_param:tenant_second_nic}
2356 dpdk0:
2357 name: ${_param:tenant_first_nic}
2358 pci: "0000:81:00.0"
2359 driver: igb_uio
2360 bond: bond1
2361 enabled: true
2362 type: dpdk_ovs_port
2363 n_rxq: 2
2364 dpdk1:
2365 name: ${_param:tenant_second_nic}
2366 pci: "0000:81:00.1"
2367 driver: igb_uio
2368 bond: bond1
2369 enabled: true
2370 type: dpdk_ovs_port
2371 n_rxq: 2
2372 bond1:
2373 enabled: true
2374 bridge: br-prv
2375 type: dpdk_ovs_bond
2376 mode: balance-slb
2377 br-prv:
2378 enabled: true
2379 type: dpdk_ovs_bridge
2380 tag: ${_param:tenant_vlan}
2381 address: ${_param:tenant_address}
2382 netmask: ${_param:tenant_network_netmask}
2383
Jakub Pavlikaa759062017-03-13 15:57:26 +01002384**DPDK OVS bridge for VXLAN**
2385
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002386If VXLAN is used as tenant segmentation, IP address must
2387be set on ``br-prv``.
Jakub Pavlikaa759062017-03-13 15:57:26 +01002388
2389.. code-block:: yaml
2390
2391 linux:
2392 network:
2393 ...
2394 interface:
2395 br-prv:
2396 enabled: true
2397 type: dpdk_ovs_bridge
2398 address: 192.168.50.0
2399 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04002400 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01002401 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002402
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02002403**DPDK OVS bridge with Linux network interface**
2404
2405.. code-block:: yaml
2406
2407 linux:
2408 network:
2409 ...
2410 interface:
2411 eth0:
2412 type: eth
2413 ovs_bridge: br-prv
2414 ...
2415 br-prv:
2416 enabled: true
2417 type: dpdk_ovs_bridge
2418 ...
2419
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002420Linux storage
2421-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02002422
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002423Linux with mounted Samba:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002424
2425.. code-block:: yaml
2426
2427 linux:
2428 storage:
2429 enabled: true
2430 mount:
2431 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01002432 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002433 - path: /media/myuser/public/
2434 - device: //192.168.0.1/storage
2435 - file_system: cifs
2436 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
2437
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002438NFS mount:
Jiri Broulikb017f932017-03-31 13:55:36 +02002439
2440.. code-block:: yaml
2441
2442 linux:
2443 storage:
2444 enabled: true
2445 mount:
2446 nfs_glance:
2447 enabled: true
2448 path: /var/lib/glance/images
2449 device: 172.16.10.110:/var/nfs/glance
2450 file_system: nfs
2451 opts: rw,sync
2452
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002453File swap configuration:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002454
2455.. code-block:: yaml
2456
2457 linux:
2458 storage:
2459 enabled: true
2460 swap:
2461 file:
2462 enabled: true
2463 engine: file
2464 device: /swapfile
2465 size: 1024
2466
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002467Partition swap configuration:
Lachlan Evenson30676512016-01-22 15:43:28 -08002468
2469.. code-block:: yaml
2470
2471 linux:
2472 storage:
2473 enabled: true
2474 swap:
2475 partition:
2476 enabled: true
2477 engine: partition
2478 device: /dev/vg0/swap
2479
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002480LVM group ``vg1`` with one device and ``data`` volume mounted
2481into ``/mnt/data``.
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002482
2483.. code-block:: yaml
2484
2485 parameters:
2486 linux:
2487 storage:
2488 mount:
2489 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01002490 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002491 device: /dev/vg1/data
2492 file_system: ext4
2493 path: /mnt/data
2494 lvm:
2495 vg1:
2496 enabled: true
2497 devices:
2498 - /dev/sdb
2499 volume:
2500 data:
2501 size: 40G
2502 mount: ${linux:storage:mount:data}
root40bb5e72019-01-11 08:55:32 +00002503 # When set they will take precedence over filters aget from volume groups.
2504 lvm_filters:
2505 10:
2506 enabled: True
2507 value: "a|loop|"
2508 20:
2509 enabled: True
2510 value: "r|/dev/hdc|"
2511 30:
2512 enabled: True
2513 value: "a|/dev/ide|"
2514 40:
2515 enabled: True
2516 value: "r|.*|"
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002517
Jakub Pavlik4f742142017-08-08 15:05:50 +02002518Create partitions on disk. Specify size in MB. It expects empty
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002519disk without any existing partitions.
2520Set ``startsector=1`` if you want to start partitions from ``2048``.
Jakub Pavlik4f742142017-08-08 15:05:50 +02002521
2522.. code-block:: yaml
2523
2524 linux:
2525 storage:
2526 disk:
2527 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01002528 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02002529 name: /dev/loop1
2530 type: gpt
2531 partitions:
2532 - size: 200 #size in MB
2533 type: fat32
2534 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02002535 mkfs: True
2536 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02002537 /dev/vda1:
2538 partitions:
2539 - size: 5
2540 type: ext2
2541 - size: 10
2542 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02002543
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002544Multipath with Fujitsu Eternus DXL:
Ales Komareka634f4b2016-10-02 13:11:04 +02002545
2546.. code-block:: yaml
2547
2548 parameters:
2549 linux:
2550 storage:
2551 multipath:
2552 enabled: true
2553 blacklist_devices:
2554 - /dev/sda
2555 - /dev/sdb
2556 backends:
2557 - fujitsu_eternus_dxl
2558
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002559Multipath with Hitachi VSP 1000:
Ales Komareka634f4b2016-10-02 13:11:04 +02002560
2561.. code-block:: yaml
2562
2563 parameters:
2564 linux:
2565 storage:
2566 multipath:
2567 enabled: true
2568 blacklist_devices:
2569 - /dev/sda
2570 - /dev/sdb
2571 backends:
2572 - hitachi_vsp1000
2573
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002574Multipath with IBM Storwize:
Ales Komareka634f4b2016-10-02 13:11:04 +02002575
2576.. code-block:: yaml
2577
2578 parameters:
2579 linux:
2580 storage:
2581 multipath:
2582 enabled: true
2583 blacklist_devices:
2584 - /dev/sda
2585 - /dev/sdb
2586 backends:
2587 - ibm_storwize
2588
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002589Multipath with multiple backends:
Ales Komareka634f4b2016-10-02 13:11:04 +02002590
2591.. code-block:: yaml
2592
2593 parameters:
2594 linux:
2595 storage:
2596 multipath:
2597 enabled: true
2598 blacklist_devices:
2599 - /dev/sda
2600 - /dev/sdb
2601 - /dev/sdc
2602 - /dev/sdd
2603 backends:
2604 - ibm_storwize
2605 - fujitsu_eternus_dxl
2606 - hitachi_vsp1000
2607
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002608PAM LDAP integration:
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002609
2610.. code-block:: yaml
2611
2612 parameters:
2613 linux:
2614 system:
2615 auth:
2616 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02002617 mkhomedir:
2618 enabled: true
2619 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002620 ldap:
2621 enabled: true
2622 binddn: cn=bind,ou=service_users,dc=example,dc=com
2623 bindpw: secret
2624 uri: ldap://127.0.0.1
2625 base: ou=users,dc=example,dc=com
2626 ldap_version: 3
2627 pagesize: 65536
2628 referrals: off
2629 filter:
2630 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2631 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2632 group: (&(objectClass=group)(gidNumber=*))
2633
Gleb Galkin93b9ae92018-10-18 13:57:30 +03002634PAM duo 2FA integration
2635
2636.. code-block:: yaml
2637
2638 parameters:
2639 linux:
2640 system:
2641 auth:
2642 enabled: true
2643 duo:
2644 enabled: true
2645 duo_host: localhost
2646 duo_ikey: DUO-INTEGRATION-KEY
2647 duo_skey: DUO-SECRET-KEY
2648
2649duo package version may be specified (optional)
2650
2651.. code-block:: yaml
2652
2653 linux:
2654 system:
2655 package:
2656 duo-unix:
2657 version: 1.10.1-0
2658
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002659Disabled multipath (the default setup):
Ales Komareka634f4b2016-10-02 13:11:04 +02002660
2661.. code-block:: yaml
2662
2663 parameters:
2664 linux:
2665 storage:
2666 multipath:
2667 enabled: false
2668
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002669Linux with local loopback device:
Simon Pasquier375001e2017-01-26 13:22:33 +01002670
2671.. code-block:: yaml
2672
2673 linux:
2674 storage:
2675 loopback:
2676 disk1:
2677 file: /srv/disk1
2678 size: 50G
2679
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002680External config generation
2681--------------------------
2682
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002683You are able to use config support metadata between formulas
2684and only generate configuration files for external use, for example, Docker, and so on.
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002685
2686.. code-block:: yaml
2687
2688 parameters:
2689 linux:
2690 system:
2691 config:
2692 pillar:
2693 jenkins:
2694 master:
2695 home: /srv/volumes/jenkins
2696 approved_scripts:
2697 - method java.net.URL openConnection
2698 credentials:
2699 - type: username_password
2700 scope: global
2701 id: test
2702 desc: Testing credentials
2703 username: test
2704 password: test
2705
Vladimir Ereminccf28842017-04-10 23:52:10 +03002706Netconsole Remote Kernel Logging
2707--------------------------------
2708
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002709Netconsole logger can be configured for the configfs-enabled kernels
2710(``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
2711applies both in runtime (if network is already configured),
2712and on-boot after an interface initialization.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002713
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002714.. note::
2715
2716 * Receiver can be located only on the same L3 domain
2717 (or you need to configure gateway MAC manually).
2718 * The Receiver MAC is detected only on configuration time.
2719 * Using broadcast MAC is not recommended.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002720
2721.. code-block:: yaml
2722
2723 parameters:
2724 linux:
2725 system:
2726 netconsole:
2727 enabled: true
2728 port: 514 (optional)
2729 loglevel: debug (optional)
2730 target:
2731 192.168.0.1:
2732 interface: bond0
2733 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02002734
Dzmitry Stremkouskid1a268b2018-10-03 16:36:04 +02002735Check network params on the environment
2736---------------------------------------
2737
2738Grab nics and nics states
2739
2740.. code-block:: bash
2741
2742 salt osd001\* net_checks.get_nics
2743
2744**Example of system output:**
2745
2746.. code-block:: bash
2747
2748 osd001.domain.com:
2749 |_
2750 - bond0
2751 - None
2752 - 1e:c8:64:42:23:b9
2753 - 0
2754 - 1500
2755 |_
2756 - bond1
2757 - None
2758 - 3c:fd:fe:27:3b:00
2759 - 1
2760 - 9100
2761 |_
2762 - fourty1
2763 - None
2764 - 3c:fd:fe:27:3b:00
2765 - 1
2766 - 9100
2767 |_
2768 - fourty2
2769 - None
2770 - 3c:fd:fe:27:3b:02
2771 - 1
2772 - 9100
2773
2774Grab 10G nics PCI addresses for hugepages setup
2775
2776.. code-block:: bash
2777
2778 salt cmp001\* net_checks.get_ten_pci
2779
2780**Example of system output:**
2781
2782.. code-block:: bash
2783
2784 cmp001.domain.com:
2785 |_
2786 - ten1
2787 - 0000:19:00.0
2788 |_
2789 - ten2
2790 - 0000:19:00.1
2791 |_
2792 - ten3
2793 - 0000:19:00.2
2794 |_
2795 - ten4
2796 - 0000:19:00.3
2797
2798Grab ip address for an interface
2799
2800.. code-block:: bash
2801
2802 salt cmp001\* net_checks.get_ip iface=one4
2803
2804**Example of system output:**
2805
2806.. code-block:: bash
2807
2808 cmp001.domain.com:
2809 10.200.177.101
2810
2811Grab ip addresses map
2812
2813.. code-block:: bash
2814
2815 salt-call net_checks.nodes_addresses
2816
2817**Example of system output:**
2818
2819.. code-block:: bash
2820
2821 local:
2822 |_
2823 - cid01.domain.com
2824 |_
2825 |_
2826 - pxe
2827 - 10.200.177.91
2828 |_
2829 - control
2830 - 10.200.178.91
2831 |_
2832 - cmn02.domain.com
2833 |_
2834 |_
2835 - storage_access
2836 - 10.200.181.67
2837 |_
2838 - pxe
2839 - 10.200.177.67
2840 |_
2841 - control
2842 - 10.200.178.67
2843 |_
2844 - cmp010.domain.com
2845 |_
2846 |_
2847 - pxe
2848 - 10.200.177.110
2849 |_
2850 - storage_access
2851 - 10.200.181.110
2852 |_
2853 - control
2854 - 10.200.178.110
2855 |_
2856 - vxlan
2857 - 10.200.179.110
2858
2859Verify full mesh connectivity
2860
2861.. code-block:: bash
2862
2863 salt-call net_checks.ping_check
2864
2865**Example of positive system output:**
2866
2867.. code-block:: bash
2868
2869 ['PASSED']
2870 [INFO ] ['PASSED']
2871 local:
2872 True
2873
2874**Example of system output in case of failure:**
2875
2876.. code-block:: bash
2877
2878 FAILED
2879 [ERROR ] FAILED
2880 ['control: 10.0.1.92 -> 10.0.1.224: Failed']
2881 ['control: 10.0.1.93 -> 10.0.1.224: Failed']
2882 ['control: 10.0.1.51 -> 10.0.1.224: Failed']
2883 ['control: 10.0.1.102 -> 10.0.1.224: Failed']
2884 ['control: 10.0.1.13 -> 10.0.1.224: Failed']
2885 ['control: 10.0.1.81 -> 10.0.1.224: Failed']
2886 local:
2887 False
2888
2889For this feature to work, please mark addresses with some role.
2890Otherwise 'default' role is assumed and mesh would consist of all
2891addresses on the environment.
2892
2893Mesh mark is needed only for interfaces which are enabled and have
2894ip address assigned.
2895
2896Checking dhcp pxe network meaningless, as it is used for salt
2897master vs minion communications, therefore treated as checked.
2898
2899.. code-block:: yaml
2900
2901 parameters:
2902 linux:
2903 network:
2904 interface:
2905 ens3:
2906 enabled: true
2907 type: eth
2908 proto: static
2909 address: ${_param:deploy_address}
2910 netmask: ${_param:deploy_network_netmask}
2911 gateway: ${_param:deploy_network_gateway}
2912 mesh: pxe
2913
2914Check pillars for ip address duplicates
2915
2916.. code-block:: bash
2917
2918 salt-call net_checks.verify_addresses
2919
2920**Example of positive system output:**
2921
2922.. code-block:: bash
2923
2924 ['PASSED']
2925 [INFO ] ['PASSED']
2926 local:
2927 True
2928
2929**Example of system output in case of failure:**
2930
2931.. code-block:: bash
2932
2933 FAILED. Duplicates found
2934 [ERROR ] FAILED. Duplicates found
2935 ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2936 [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2937 local:
2938 False
2939
2940Generate csv report for the env
2941
2942.. code-block:: bash
2943
2944 salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
2945 | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
2946 | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
2947
2948**Example of system output:**
2949
2950.. code-block:: bash
2951
2952 server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
2953 cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
2954 cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
2955 cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
2956 cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
2957 cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
2958 cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
2959 cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
2960 cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
2961 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
2962 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
2963 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
2964 cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
2965 cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
2966 cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
2967 ...
2968
Filip Pytlounf5383a42015-10-06 16:28:32 +02002969Usage
2970=====
2971
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002972Set MTU of the eth0 network interface to 1400:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002973
2974.. code-block:: bash
2975
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002976 ip link set dev eth0 mtu 1400
Filip Pytlounf5383a42015-10-06 16:28:32 +02002977
Denis Egorenko4e45a702019-10-02 14:57:10 +04002978Switch Kernel from non-HWE to HWE
2979==================================
2980
2981It is possible to switch Kernel from non-HWE to HWE by using module
2982linux_kernel_switch. It has few methods:
2983
2984* check_hwe_kernel
2985* switch_kernel
2986* rollback_switch_kernel
2987
2988Method ``check_hwe_kernel`` allows to check whether HWE kernel installed
2989or not:
2990
2991.. code-block:: bash
2992
2993 salt <target> linux_kernel_switch.check_hwe_kernel
2994
2995Output for case HWE is installed:
2996
2997.. code-bloc:: bash
2998
2999 kvm02.cluster-env.local:
3000 ----------
3001 linux-image-extra-virtual-hwe-16.04:
3002 ----------
3003 linux-image-extra-virtual-hwe-16.04:
3004 ----------
3005 architecture:
3006 amd64
3007 description:
3008 Extra drivers for Virtual Linux kernel image
3009 This package will always depend on linux-image-generic.
3010 group:
3011 kernel
3012 install_date:
3013 2019-10-01T11:50:15Z
3014 name:
3015 linux-image-extra-virtual-hwe-16.04
3016 packager:
3017 Ubuntu Kernel Team <kernel-team@lists.ubuntu.com>
3018 source:
3019 linux-meta-hwe
3020 version:
3021 4.15.0.54.75
3022 ...
3023
3024Output for case HWE is not installed:
3025
3026.. code-bloc:: bash
3027
3028 kvm02.cluster-env.local:
3029 ----------
3030 linux-image-extra-virtual-hwe-16.04:
3031 Not installed!
3032 linux-image-generic-hwe-16.04:
3033 Not installed!
3034
3035Method ``switch_kernel`` allows you to switch from non-HWE to HWE. It has
3036two options: ``dry_run`` - to check what packages are going to be installed or
3037removed and ``only_kernel`` - install only Kernel image packages without other
3038HWE packages.
3039
3040Method ``rollback_switch_kernel`` allows you to rollback method
3041``switch_kernel`` which was executed successfully previously. Option
3042``dry_run`` - to check what packages are going to be installed/removed.
3043
Filip Pytlounf5383a42015-10-06 16:28:32 +02003044Read more
3045=========
3046
3047* https://www.archlinux.org/
3048* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu