blob: 1b25635f9faa6774074a71012723fcaaee61c597 [file] [log] [blame]
Aleš Komárek63572992017-04-11 13:16:44 +02001============
2Linux Fomula
3============
Filip Pytlounf5383a42015-10-06 16:28:32 +02004
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03005Linux Operating Systems:
Filip Pytlounf5383a42015-10-06 16:28:32 +02006
7* Ubuntu
8* CentOS
9* RedHat
10* Fedora
11* Arch
12
Aleš Komárek63572992017-04-11 13:16:44 +020013Sample Pillars
Filip Pytlounf5383a42015-10-06 16:28:32 +020014==============
15
Aleš Komárek63572992017-04-11 13:16:44 +020016Linux System
Filip Pytlounf5383a42015-10-06 16:28:32 +020017------------
18
19Basic Linux box
20
21.. code-block:: yaml
22
23 linux:
24 system:
25 enabled: true
26 name: 'node1'
27 domain: 'domain.com'
28 cluster: 'system'
29 environment: prod
30 timezone: 'Europe/Prague'
31 utc: true
32
azvyagintsev967af132017-06-12 12:25:24 +030033Linux with system users, some with password set:
OlgaGusarenko2828f5f2018-07-30 19:37:05 +030034
35.. warning:: If no ``password`` variable is passed,
36 any predifined password will be removed.
Filip Pytlounf5383a42015-10-06 16:28:32 +020037
38.. code-block:: yaml
39
40 linux:
41 system:
42 ...
43 user:
44 jdoe:
45 name: 'jdoe'
46 enabled: true
47 sudo: true
48 shell: /bin/bash
49 full_name: 'Jonh Doe'
50 home: '/home/jdoe'
Martin Polreich4fcd5c02018-07-16 09:41:51 +020051 home_dir_mode: 755
Filip Pytlounf5383a42015-10-06 16:28:32 +020052 email: 'jonh@doe.com'
Dzmitry Stremkouskia0d8b2d2018-10-22 14:12:05 +020053 unique: false
Dzmitry Stremkouskifae59fb2018-11-21 10:10:10 +010054 groups:
55 - db-ops
56 - salt-ops
57 optional_groups:
58 - docker
Filip Pytlounf5383a42015-10-06 16:28:32 +020059 jsmith:
60 name: 'jsmith'
61 enabled: true
azvyagintsev967af132017-06-12 12:25:24 +030062 full_name: 'With clear password'
Filip Pytlounf5383a42015-10-06 16:28:32 +020063 home: '/home/jsmith'
azvyagintsev967af132017-06-12 12:25:24 +030064 hash_password: true
65 password: "userpassword"
66 mark:
67 name: 'mark'
68 enabled: true
69 full_name: "unchange password'
70 home: '/home/mark'
71 password: false
72 elizabeth:
73 name: 'elizabeth'
74 enabled: true
75 full_name: 'With hased password'
76 home: '/home/elizabeth'
77 password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10"
Filip Pytlounf5383a42015-10-06 16:28:32 +020078
Martin Polreich4aa3c282019-10-22 15:08:01 +020079Remove users data completely and terminate all user's processes:
Dzmitry Stremkouskia2960ad2019-09-04 14:15:09 +020080
81.. code-block:: yaml
82
83 linux:
84 system:
85 user:
86 example:
87 email: disabled
88 enabled: false
89 full_name: disabled
90 name: example
91 force_delete: True
92
Dmitry Teselkinc7814732019-02-21 16:40:23 +030093Setting user defaults
94---------------------
95Default parameters that will be used by `useradd` command could be configured
96the following way:
97
98.. code-block:: yaml
99
100 linux:
101 system:
102 ...
103 defaults:
104 user:
105 shell: <SHELL>
106 gid: <GROUP>
107 home: <HOME>
108 inactdays: <INACTIVE>
109 expire: <EXPIRE>
110 skeleton: <SKEL>
111 create_mail_spool: <CREATE_MAIL_SPOOL>
112
113Other parameters that are used when creating user profile could be configured
114as well, acting as global defaults:
115
116.. code-block:: yaml
117
118 linux:
119 system:
120 ...
121 defaults:
122 user:
123 ...
124 maxdays: <PASS_MAX_DAYS>
125 mindays: <PASS_MIN_DAYS>
126 warndays: <PASS_WARN_AGE>
127
128.. note::
129
130 The three options above ('maxdays', 'mindays', 'warndays') could be
131 overriden in linux:system:login_defs using their 'real' names.
132 The reason they could be defined here is that it's quite logical to
133 have these parameters related to configuration of user account
134 behaviour in one place.
135
136
Dmitry Teselkin47e41f42018-09-27 14:10:09 +0300137Configure password expiration parameters
138----------------------------------------
139The following login.defs parameters can be overridden per-user:
140
141* PASS_MAX_DAYS
142* PASS_MIN_DAYS
143* PASS_WARN_DAYS
Dmitry Teselkin47e41f42018-09-27 14:10:09 +0300144
145.. code-block:: yaml
146
147 linux:
148 system:
149 ...
150 user:
151 jdoe:
152 name: 'jdoe'
153 enabled: true
154 ...
155 maxdays: <PASS_MAX_DAYS>
156 mindays: <PASS_MIN_DAYS>
Dmitry Teselkinc7814732019-02-21 16:40:23 +0300157 warndays: <PASS_WARN_AGE>
Dmitry Teselkin47e41f42018-09-27 14:10:09 +0300158
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100159Configure sudo for users and groups under ``/etc/sudoers.d/``.
160This ways ``linux.system.sudo`` pillar map to actual sudo attributes:
161
162.. code-block:: jinja
Aleš Komárek63572992017-04-11 13:16:44 +0200163
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100164 # simplified template:
165 Cmds_Alias {{ alias }}={{ commands }}
166 {{ user }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
167 %{{ group }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
168
169 # when rendered:
170 saltuser1 ALL=(ALL) NOPASSWD: ALL
171
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100172.. code-block:: yaml
Aleš Komárek63572992017-04-11 13:16:44 +0200173
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100174 linux:
175 system:
176 sudo:
177 enabled: true
Tomas Kammd8eb3002017-05-08 19:30:29 +0200178 aliases:
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100179 host:
180 LOCAL:
181 - localhost
182 PRODUCTION:
183 - db1
184 - db2
185 runas:
186 DBA:
187 - postgres
188 - mysql
189 SALT:
190 - root
191 command:
192 # Note: This is not 100% safe when ALL keyword is used, user still may modify configs and hide his actions.
193 # Best practice is to specify full list of commands user is allowed to run.
194 SUPPORT_RESTRICTED:
195 - /bin/vi /etc/sudoers*
196 - /bin/vim /etc/sudoers*
197 - /bin/nano /etc/sudoers*
198 - /bin/emacs /etc/sudoers*
199 - /bin/su - root
200 - /bin/su -
201 - /bin/su
202 - /usr/sbin/visudo
203 SUPPORT_SHELLS:
204 - /bin/sh
205 - /bin/ksh
206 - /bin/bash
207 - /bin/rbash
208 - /bin/dash
209 - /bin/zsh
210 - /bin/csh
211 - /bin/fish
212 - /bin/tcsh
213 - /usr/bin/login
214 - /usr/bin/su
215 - /usr/su
216 ALL_SALT_SAFE:
217 - /usr/bin/salt state*
218 - /usr/bin/salt service*
219 - /usr/bin/salt pillar*
220 - /usr/bin/salt grains*
221 - /usr/bin/salt saltutil*
222 - /usr/bin/salt-call state*
223 - /usr/bin/salt-call service*
224 - /usr/bin/salt-call pillar*
225 - /usr/bin/salt-call grains*
226 - /usr/bin/salt-call saltutil*
227 SALT_TRUSTED:
228 - /usr/bin/salt*
229 users:
230 # saltuser1 with default values: saltuser1 ALL=(ALL) NOPASSWD: ALL
231 saltuser1: {}
232 saltuser2:
233 hosts:
234 - LOCAL
235 # User Alias DBA
236 DBA:
237 hosts:
238 - ALL
239 commands:
240 - ALL_SALT_SAFE
241 groups:
242 db-ops:
243 hosts:
244 - ALL
245 - '!PRODUCTION'
246 runas:
247 - DBA
248 commands:
249 - /bin/cat *
250 - /bin/less *
251 - /bin/ls *
252 salt-ops:
253 hosts:
254 - 'ALL'
255 runas:
256 - SALT
257 commands:
258 - SUPPORT_SHELLS
259 salt-ops-2nd:
260 name: salt-ops
261 nopasswd: false
Jakub Josef7a9d9b92017-05-16 11:39:01 +0200262 setenv: true # Enable sudo -E option
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100263 runas:
264 - DBA
265 commands:
266 - ALL
267 - '!SUPPORT_SHELLS'
268 - '!SUPPORT_RESTRICTED'
269
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 Berezovskiy25e177d2019-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
Filip Pytloun281034a2016-01-04 18:06:22 +0100600Kernel
601~~~~~~
602
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300603Install always up to date LTS kernel and headers from Ubuntu Trusty:
Filip Pytloun281034a2016-01-04 18:06:22 +0100604
605.. code-block:: yaml
606
607 linux:
608 system:
609 kernel:
610 type: generic
611 lts: trusty
612 headers: true
613
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300614Load kernel modules and add them to ``/etc/modules``:
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100615
616.. code-block:: yaml
617
618 linux:
619 system:
620 kernel:
621 modules:
622 - nf_conntrack
623 - tp_smapi
624 - 8021q
625
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300626Configure or blacklist kernel modules with additional options to
627``/etc/modprobe.d`` following example will add
628``/etc/modprobe.d/nf_conntrack.conf`` file with line
629``options nf_conntrack hashsize=262144``:
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300630
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300631'option' can be a mapping (with 'enabled' and 'value' keys) or a scalar.
632
633Example for 'scalar' option value:
634
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300635.. code-block:: yaml
636
637 linux:
638 system:
639 kernel:
640 module:
641 nf_conntrack:
642 option:
643 hashsize: 262144
644
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300645Example for 'mapping' option value:
646
647.. code-block:: yaml
648
649 linux:
650 system:
651 kernel:
652 module:
653 nf_conntrack:
654 option:
655 hashsize:
656 enabled: true
657 value: 262144
658
659NOTE: 'enabled' key is optional and is True by default.
660
661Blacklist a module:
662
663.. code-block:: yaml
664
665 linux:
666 system:
667 kernel:
668 module:
669 nf_conntrack:
670 blacklist: true
671
672A module can have a number of aliases, wildcards are allowed.
673Define an alias for a module:
674
675.. code-block:: yaml
676
677 linux:
678 system:
679 kernel:
680 module:
681 nf_conntrack:
682 alias:
683 nfct:
684 enabled: true
685 "nf_conn*":
686 enabled: true
687
688NOTE: 'enabled' key is mandatory as there are no other keys exist.
689
690Execute custom command instead of 'insmod' when inserting a module:
691
692.. code-block:: yaml
693
694 linux:
695 system:
696 kernel:
697 module:
698 nf_conntrack:
699 install:
700 enabled: true
701 command: /bin/true
702
703NOTE: 'enabled' key is optional and is True by default.
704
705Execute custom command instead of 'rmmod' when removing a module:
706
707.. code-block:: yaml
708
709 linux:
710 system:
711 kernel:
712 module:
713 nf_conntrack:
714 remove:
715 enabled: true
716 command: /bin/true
717
718NOTE: 'enabled' key is optional and is True by default.
719
720Define module dependencies:
721
722.. code-block:: yaml
723
724 linux:
725 system:
726 kernel:
727 module:
728 nf_conntrack:
729 softdep:
730 pre:
731 1:
732 enabled: true
733 value: a
734 2:
735 enabled: true
736 value: b
737 3:
738 enabled: true
739 value: c
740 post:
741 1:
742 enabled: true
743 value: x
744 2:
745 enabled: true
746 value: y
747 3:
748 enabled: true
749 value: z
750
751NOTE: 'enabled' key is optional and is True by default.
752
753
Filip Pytloun281034a2016-01-04 18:06:22 +0100754Install specific kernel version and ensure all other kernel packages are
755not present. Also install extra modules and headers for this kernel:
756
757.. code-block:: yaml
758
759 linux:
760 system:
761 kernel:
762 type: generic
763 extra: true
764 headers: true
765 version: 4.2.0-22
766
Denis Egorenko567aa202019-11-06 14:02:00 +0400767Also it is possible to install Kernel with Hardware Enablement or virtual
768kernel packages. For example, for Xenial:
769
770.. code-block:: yaml
771
772 linux:
773 system:
774 kernel:
775 type: generic
776 extra: true
777 headers: true
778 version: 4.15.0-65
779 hwe:
780 type: hwe
781 version: 16.04
782 kernel_version: 4.15.0.65
783
784Set `linux:system:kernel:hwe:type:virtual` if you need Virtual kernel packages.
785
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300786Systcl kernel parameters:
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100787
788.. code-block:: yaml
789
790 linux:
791 system:
792 kernel:
793 sysctl:
794 net.ipv4.tcp_keepalive_intvl: 3
795 net.ipv4.tcp_keepalive_time: 30
796 net.ipv4.tcp_keepalive_probes: 8
797
Michael Polenchukebf55522018-01-25 13:22:39 +0400798Configure kernel boot options:
799
800.. code-block:: yaml
801
802 linux:
803 system:
804 kernel:
805 boot_options:
806 - elevator=deadline
807 - spectre_v2=off
808 - nopti
809
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100810CPU
811~~~
812
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300813Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100814
815.. code-block:: yaml
816
817 linux:
818 system:
819 cpu:
820 governor: performance
821
Nick Metzf04f5f32018-01-08 15:25:04 +0100822
Jiri Broulik303905d2018-01-11 14:12:48 +0100823CGROUPS
824~~~~~~~
825
826Setup linux cgroups:
827
828.. code-block:: yaml
829
830 linux:
831 system:
832 cgroup:
833 enabled: true
834 group:
835 ceph_group_1:
836 controller:
837 cpu:
838 shares:
839 value: 250
840 cpuacct:
841 usage:
842 value: 0
843 cpuset:
844 cpus:
845 value: 1,2,3
846 memory:
847 limit_in_bytes:
848 value: 2G
849 memsw.limit_in_bytes:
850 value: 3G
851 mapping:
852 subjects:
853 - '@ceph'
854 generic_group_1:
855 controller:
856 cpu:
857 shares:
858 value: 250
859 cpuacct:
860 usage:
861 value: 0
862 mapping:
863 subjects:
864 - '*:firefox'
865 - 'student:cp'
866
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300867Shared libraries
Nick Metzf04f5f32018-01-08 15:25:04 +0100868~~~~~~~~~~~~~~~~
869
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300870Set additional shared library to Linux system library path:
Nick Metzf04f5f32018-01-08 15:25:04 +0100871
872.. code-block:: yaml
873
874 linux:
875 system:
876 ld:
877 library:
878 java:
879 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
880 - /opt/java/jre/lib/amd64/server
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200881
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200882Certificates
883~~~~~~~~~~~~
884
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300885Add certificate authority into system trusted CA bundle:
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200886
887.. code-block:: yaml
888
889 linux:
890 system:
891 ca_certificates:
892 mycert: |
893 -----BEGIN CERTIFICATE-----
894 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
895 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
896 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
897 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
898 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
899 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
900 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
901 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
902 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
903 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
904 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
905 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
906 -----END CERTIFICATE-----
907
Filip Pytloun361096c2017-08-23 10:57:20 +0200908Sysfs
909~~~~~
910
911Install sysfsutils and set sysfs attributes:
912
913.. code-block:: yaml
914
915 linux:
916 system:
917 sysfs:
918 scheduler:
919 block/sda/queue/scheduler: deadline
920 power:
921 mode:
922 power/state: 0660
923 owner:
924 power/state: "root:power"
925 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
926
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200927Optional: You can also use list that will ensure order of items.
928
929.. code-block:: yaml
930
931 linux:
932 system:
933 sysfs:
934 scheduler:
935 block/sda/queue/scheduler: deadline
936 power:
937 - mode:
938 power/state: 0660
939 - owner:
940 power/state: "root:power"
941 - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
942
Martin Polreich148e1b82018-09-13 15:54:25 +0200943Sysfs definition with disabled automatic write. Attributes are saved
944to configuration, but are not applied during the run.
945Thay will be applied automatically after the reboot.
946
947
948.. code-block:: yaml
949
950 linux:
951 system:
952 sysfs:
953 enable_apply: false
954 scheduler:
955 block/sda/queue/scheduler: deadline
956
957.. note:: The `enable_apply` parameter defaults to `True` if not defined.
958
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100959Huge Pages
960~~~~~~~~~~~~
961
962Huge Pages give a performance boost to applications that intensively deal
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300963with memory allocation/deallocation by decreasing memory fragmentation:
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100964
965.. code-block:: yaml
966
967 linux:
968 system:
969 kernel:
970 hugepages:
971 small:
972 size: 2M
973 count: 107520
974 mount_point: /mnt/hugepages_2MB
Michael Polenchukd9369fe2018-05-08 17:53:08 +0400975 mount: false/true # default is true (mount immediately) / false (just save in the fstab)
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100976 large:
977 default: true # default automatically mounted
978 size: 1G
979 count: 210
980 mount_point: /mnt/hugepages_1GB
981
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300982.. note:: Not recommended to use both pagesizes concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100983
Jakub Pavlik5398d872017-02-13 22:30:47 +0100984Intel SR-IOV
985~~~~~~~~~~~~
986
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300987PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV)
988specification defines a standardized mechanism to virtualize
989PCIe devices. The mechanism can virtualize a single PCIe
990Ethernet controller to appear as multiple PCIe devices:
Jakub Pavlik5398d872017-02-13 22:30:47 +0100991
992.. code-block:: yaml
993
994 linux:
995 system:
996 kernel:
997 sriov: True
998 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
999 rc:
1000 local: |
1001 #!/bin/sh -e
1002 # Enable 7 VF on eth1
1003 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
1004 exit 0
1005
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001006Isolate CPU options
1007~~~~~~~~~~~~~~~~~~~
1008
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001009Remove the specified CPUs, as defined by the cpu_number values, from
1010the general kernel SMP balancing and scheduler algroithms. The only
1011way to move a process onto or off an *isolated* CPU is via the CPU
1012affinity syscalls. ``cpu_number begins`` at ``0``, so the
1013maximum value is ``1`` less than the number of CPUs on the system.:
Jakub Pavlik6c9ead12017-02-16 21:53:13 +01001014
1015.. code-block:: yaml
1016
1017 linux:
1018 system:
1019 kernel:
1020 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +01001021
Filip Pytlounf5383a42015-10-06 16:28:32 +02001022Repositories
1023~~~~~~~~~~~~
1024
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001025RedHat-based Linux with additional OpenStack repo:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001026
1027.. code-block:: yaml
1028
1029 linux:
1030 system:
1031 ...
1032 repo:
1033 rdo-icehouse:
1034 enabled: true
1035 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
1036 pgpcheck: 0
1037
1038Ensure system repository to use czech Debian mirror (``default: true``)
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001039Also pin it's packages with priority ``900``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001040
1041.. code-block:: yaml
1042
1043 linux:
1044 system:
1045 repo:
1046 debian:
1047 default: true
1048 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
1049 # Import signing key from URL if needed
1050 key_url: "http://dummy.com/public.gpg"
1051 pin:
1052 - pin: 'origin "ftp.cz.debian.org"'
1053 priority: 900
1054 package: '*'
1055
azvyagintseva3a73d02018-12-06 14:49:58 +02001056Sometimes better to use one pining rule file, to decrease mistaken
1057ordering. You can use those option ``system:apt:preferences``, which would add opts into
1058``/etc/apt/preferences`` file:
1059
1060.. code-block:: yaml
1061
1062 parameters:
1063 linux:
1064 system:
1065 apt:
1066 preferences:
1067 enabled: true
1068 rules:
1069 100:
1070 enabled: true
1071 name: 'some origin pin'
1072 pin: 'release o=Debian'
1073 priority: 1100
1074 package: '*'
1075
1076
azvyagintsev4494a472018-09-14 19:19:23 +03001077If you need to add multiple pin rules for one repo, please use new,ordered definition format
1078('pinning' definition will be in priotity to use):
1079
1080.. code-block:: yaml
1081
1082 linux:
1083 system:
1084 repo:
1085 mcp_saltstack:
1086 source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main"
1087 architectures: amd64
1088 clean_file: true
1089 pinning:
1090 10:
1091 enabled: true
1092 pin: 'release o=SaltStack'
1093 priority: 50
1094 package: 'libsodium18'
1095 20:
1096 enabled: true
1097 pin: 'release o=SaltStack'
1098 priority: 1100
1099 package: '*'
1100
1101
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001102.. note:: For old Ubuntu releases (<xenial)
azvyagintsevff089d22018-07-27 16:52:34 +02001103 extra packages for apt transport, like ``apt-transport-https``
1104 may be required to be installed manually.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001105 (Chicken-eggs issue: we need to install packages to
azvyagintsevff089d22018-07-27 16:52:34 +02001106 reach repo from where they should be installed)
1107 Otherwise, you still can try 'fortune' and install prereq.packages before
1108 any repo configuration, using list of requires in map.jinja.
1109
1110
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001111Disabling any prerequisite packages installation:
1112
azvyagintsevff089d22018-07-27 16:52:34 +02001113You can simply drop any package pre-installation (before system.linux.repo
1114will be processed) via cluster lvl:
1115
1116.. code-block:: yaml
1117
1118 linux:
1119 system:
1120 pkgs: ~
1121
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001122Package manager proxy global setup:
Petr Michalec10462bb2017-03-23 19:18:08 +01001123
1124.. code-block:: yaml
1125
1126 linux:
1127 system:
1128 ...
1129 repo:
1130 apt-mk:
1131 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1132 ...
1133 proxy:
1134 pkg:
1135 enabled: true
1136 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1137 ...
1138 # NOTE: Global defaults for any other componet that configure proxy on the system.
1139 # If your environment has just one simple proxy, set it on linux:system:proxy.
1140 #
1141 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1142 # as for https and http
1143 ftp: ftp://proxy.host.local:2121
1144 http: http://proxy.host.local:3142
1145 https: https://proxy.host.local:3143
1146
Taras Khlivnyak344de402021-02-17 09:10:16 +02001147Package manager direct access setup:
1148
1149.. code-block:: yaml
1150
1151 linux:
1152 system:
1153 ...
1154 repo:
1155 apt-mk:
1156 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1157 ...
1158 proxy:
1159 pkg:
1160 enabled: true
1161 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1162 ...
1163 # NOTE: Global defaults for any other componet that configure proxy on the system.
1164 # If your environment has just one simple proxy, set it on linux:system:proxy.
1165 #
1166 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1167 # as for https and http
1168 ftp: ftp://proxy.host.local:2121
1169 http: http://proxy.host.local:3142
1170 https: https://proxy.host.local:3143
1171 direct:
1172 - 192.168.0.100
1173 - repo.wo.proxy.local
1174
1175
Petr Michalec10462bb2017-03-23 19:18:08 +01001176Package manager proxy setup per repository:
1177
1178.. code-block:: yaml
1179
1180 linux:
1181 system:
1182 ...
1183 repo:
1184 debian:
1185 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1186 ...
1187 apt-mk:
1188 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1189 # per repository proxy
1190 proxy:
1191 enabled: true
1192 http: http://maas-01:8080
1193 https: http://maas-01:8080
1194 ...
1195 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001196 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +01001197 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
1198 pkg:
1199 enabled: true
1200 ftp: ftp://proxy.host.local:2121
1201 #http: http://proxy.host.local:3142
1202 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001203 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001204 # global system fallback system defaults
1205 ftp: ftp://proxy.host.local:2121
1206 http: http://proxy.host.local:3142
1207 https: https://proxy.host.local:3143
1208
Ivan Berezovskiycfd58a22019-06-25 20:15:51 +04001209
1210Add secured apt repository:
1211
1212.. code-block:: yaml
1213
1214 linux:
1215 system:
1216 ...
1217 repo:
1218 test:
1219 secure: true
1220 url: example.org/ubuntu
1221 arch: deb
1222 protocol: http
1223 user: foo
1224 password: bar
1225 distribution: stable
1226 component: main
1227
1228Add multiply secured apt repositories with same credentials:
1229
1230.. code-block:: yaml
1231
1232 linux:
1233 system:
1234 ...
1235 common_repo_secured:
1236 arch: deb
1237 protocol: http
1238 user: foo
1239 password: bar
1240 distribution: stable
1241 component: main
1242 repo:
1243 test1:
1244 secure: true
1245 url: example1.org/ubuntu
1246 test2:
1247 secure: true
1248 url: example2.org/ubuntu
1249
Denis Egorenkoe29a04f2019-12-05 15:46:06 +04001250Also it is possible to specify list of repos, which should be secured
1251within ``common_repo_secured`` block and without changing current
1252existing repo source parameter:
1253
1254.. code-block:: yaml
1255
1256 linux:
1257 system:
1258 ...
1259 common_repo_secured:
1260 user: foo
1261 password: bar
1262 secured_repos: [ 'test1', 'test2' ]
1263 repo:
1264 test1:
1265 ...
1266 test2:
1267 ...
1268 test3:
1269 ...
1270
1271Repos ``test1, test2`` will be secured. In case if you want secure all
1272available repos use ``secured_repos: [ 'all' ]``. But repo parameters have
1273precedence over parameters from ``common_repo_secured``. In next case:
1274
1275 linux:
1276 system:
1277 ...
1278 common_repo_secured:
1279 user: foo
1280 password: bar
1281 secured_repos: [ 'all' ]
1282 repo:
1283 test1:
1284 ...
1285 test2:
1286 ...
1287 test3:
1288 secure: False
1289 ...
1290
1291Repo ``test3`` will not be secured.
1292
Jiri Broulik34a29b42017-04-25 14:42:54 +02001293Remove all repositories:
1294
1295.. code-block:: yaml
1296
1297 linux:
1298 system:
1299 purge_repos: true
1300
azvyagintsevff089d22018-07-27 16:52:34 +02001301Refresh repositories metada, after configuration:
1302
1303.. code-block:: yaml
1304
1305 linux:
1306 system:
1307 refresh_repos_meta: true
1308
Filip Pytlounc512e6c2017-11-22 14:28:10 +01001309Setup custom apt config options:
1310
1311.. code-block:: yaml
1312
1313 linux:
1314 system:
1315 apt:
1316 config:
1317 compression-workaround:
1318 "Acquire::CompressionTypes::Order": "gz"
1319 docker-clean:
1320 "DPkg::Post-Invoke":
1321 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
1322 "APT::Update::Post-Invoke":
1323 - "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 +02001324
Petr Michalec10462bb2017-03-23 19:18:08 +01001325RC
1326~~
1327
Jakub Pavlik78859382016-01-21 11:26:39 +01001328rc.local example
1329
1330.. code-block:: yaml
1331
1332 linux:
1333 system:
1334 rc:
1335 local: |
1336 #!/bin/sh -e
1337 #
1338 # rc.local
1339 #
1340 # This script is executed at the end of each multiuser runlevel.
1341 # Make sure that the script will "exit 0" on success or any other
1342 # value on error.
1343 #
1344 # In order to enable or disable this script just change the execution
1345 # bits.
1346 #
1347 # By default this script does nothing.
1348 exit 0
1349
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001350Prompt
1351~~~~~~
1352
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001353Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``.
1354Every user can have different prompt:
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001355
1356.. code-block:: yaml
1357
1358 linux:
1359 system:
1360 prompt:
1361 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\\]
1362 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
1363
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001364On Debian systems, to set prompt system-wide, it's necessary to
1365remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``,
1366which comes from ``/etc/skel/.bashrc``. This formula will do
1367this automatically, but will not touch existing user's
1368``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +01001369
Filip Pytlouneef11c12016-03-25 11:00:23 +01001370Bash
1371~~~~
1372
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001373Fix bash configuration to preserve history across sessions
1374like ZSH does by default:
Filip Pytlouneef11c12016-03-25 11:00:23 +01001375
1376.. code-block:: yaml
1377
1378 linux:
1379 system:
1380 bash:
1381 preserve_history: true
1382
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001383Login banner message
1384~~~~~~~~~~~~~~~~~~~~
1385
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001386``/etc/issue`` is a text file which contains a message or system
1387identification to be printed before the login prompt. It may contain
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001388various @char and \char sequences, if supported by the getty-type
1389program employed on the system.
1390
1391Setting logon banner message is easy:
1392
1393.. code-block:: yaml
1394
1395 liunx:
1396 system:
1397 banner:
1398 enabled: true
1399 contents: |
1400 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1401
1402 You must have explicit, authorized permission to access or configure this
1403 device. Unauthorized attempts and actions to access or use this system may
1404 result in civil and/or criminal penalties.
1405 All activities performed on this system are logged and monitored.
1406
Filip Pytloune874dfb2016-01-22 16:57:34 +01001407Message of the day
1408~~~~~~~~~~~~~~~~~~
1409
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001410``pam_motd`` from package ``libpam-modules`` is used for dynamic
1411messages of the day. Setting custom ``motd`` will clean up existing ones.
Filip Pytloune874dfb2016-01-22 16:57:34 +01001412
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001413Setting static ``motd`` will replace existing ``/etc/motd`` and remove
1414scripts from ``/etc/update-motd.d``.
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001415
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001416Setting static ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001417
1418.. code-block:: yaml
1419
1420 linux:
1421 system:
1422 motd: |
1423 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1424
1425 You must have explicit, authorized permission to access or configure this
1426 device. Unauthorized attempts and actions to access or use this system may
1427 result in civil and/or criminal penalties.
1428 All activities performed on this system are logged and monitored.
1429
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001430Setting dynamic ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001431
Filip Pytloune874dfb2016-01-22 16:57:34 +01001432.. code-block:: yaml
1433
1434 linux:
1435 system:
1436 motd:
1437 - release: |
1438 #!/bin/sh
1439 [ -r /etc/lsb-release ] && . /etc/lsb-release
1440
1441 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
1442 # Fall back to using the very slow lsb_release utility
1443 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
1444 fi
1445
1446 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
1447 - warning: |
1448 #!/bin/sh
1449 printf "This is [company name] network.\n"
1450 printf "Unauthorized access strictly prohibited.\n"
1451
Marek Celoud713e9072017-05-18 15:20:25 +02001452Services
1453~~~~~~~~
1454
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001455Stop and disable the ``linux`` service:
Marek Celoud713e9072017-05-18 15:20:25 +02001456
1457.. code-block:: yaml
1458
1459 linux:
1460 system:
1461 service:
1462 apt-daily.timer:
1463 status: dead
1464
Dzmitry Stremkouski70d09782018-11-30 16:04:59 +01001465Override systemd service unit:
1466
1467.. code-block:: yaml
1468
1469 parameters:
1470
1471 linux:
1472 system:
1473 service:
1474 tgt:
1475 name: tgt
1476 status: running
1477 enabled: True
1478 override:
1479 50:
1480 target: tgt.service.d
1481 name: bind
1482 content: |
1483 [Service]
1484 ExecStart=
1485 ExecStart=/usr/sbin/tgtd -f --iscsi portal=${_param:single_address}:3260
1486
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001487Possible statuses are ``dead`` (disable service by default), ``running``
1488(enable service by default), ``enabled``, ``disabled``:
Marek Celoud713e9072017-05-18 15:20:25 +02001489
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001490Linux with the ``atop`` service:
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +03001491
1492.. code-block:: yaml
1493
1494 linux:
1495 system:
1496 atop:
1497 enabled: true
1498 interval: 20
1499 logpath: "/var/log/atop"
1500 outfile: "/var/log/atop/daily.log"
1501
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001502Linux with the ``mcelog`` service:
Oleksii Chupryn144432b2018-05-22 10:34:48 +03001503
1504.. code-block:: yaml
1505
1506 linux:
1507 system:
1508 mcelog:
1509 enabled: true
1510 logging:
1511 syslog: true
1512 syslog_error: true
1513
Denis Egorenko394ae072019-11-22 17:26:30 +04001514Linux Sosreport
1515^^^^^^^^^^^^^^^
1516
1517Sosreport is an extensible, portable, support data collection tool
1518primarily aimed at Linux distributions and other UNIX-like operating systems,
1519which allows to create diagnostic snapshot of system.
1520
1521Works out of box and additional pillars are not needed by default:
1522
1523.. code-block:: bash
1524
1525 salt-call state.sls linux.system.sosreport.report
1526
1527or from Salt Master:
1528
1529.. code-block:: bash
1530
1531 salt -C '<target>' state.sls linux.system.sosreport.report
1532
1533Sosreport configuration may be extended with next pillar data:
1534
1535.. code-block:: yaml
1536
1537 linux:
1538 system:
1539 sosreport:
1540 cmd_options:
1541 tmp-dir: /root/reportdir
1542 no_arg_opts: [ '-q' ]
1543 config_options:
1544 general:
1545 all-logs: true
1546 plugins:
1547 disabled: [ docker ]
1548 tunables:
1549 apache.log: true
1550
1551Where is ``cmd_options`` additional provided arguments for cli cmd call,
1552``general`` desribes parameters for sos.conf ``general`` section,
1553``plugins`` desribes which plugins should be ``enabled`` or ``disabled``
1554and ``tunables`` has custom plugin options which can be additionally set.
1555
1556Also it is possible to pass cmd_options through pillar override:
1557
1558.. code-block:: bash
1559
1560 salt -C '<target>' state.sls linux.system.sosreport.report pillar='{ "sosreport" : { "ticket-number": 12345, "tmp-dir": "/root/reportdir2" } }'
1561
1562Run ``sosreport --help`` to get full list of possible options.
1563
1564Once state ``linux.system.sosreport.report`` is executed on targets, it is
1565possible to collect all reports by using next command on Salt Master:
1566
1567.. code-block:: bash
1568
1569 salt -C 'I@salt:master' state.sls linux.system.sosreport.collect pillar='{ "sosreport_collect" : { "target": "<target>", "archiveName": "sosreport_<env_name>_<customer>_<ticket>" } }'
1570
1571This will generate one common archive for all ``<target>`` nodes with name
1572``sosreport_<env_name>_<customer>_<ticket>.tar.gz``. It is required to specify
1573target nodes through model (``linux.system.sosreport.collect``) or pillar
1574override. Also possible options are: ``nodeIp`` which allows you to use IP from another
1575interface on node (should be available from minions), ``port`` for NetCat if
1576you see that default port is busy, ``archiveName`` for your archive and
1577``reportWorkDir`` directory to keeping all reports for current case.
1578
Filip Pytloun2f70b492016-02-19 15:55:25 +01001579RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +01001580^^^^^^^^^^^^^
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001581Currently, ``update-motd`` is not available
1582for RHEL. So there is no native support for dynamic ``motd``.
1583You can still set a static one, with a different pillar structure:
Filip Pytloun2f70b492016-02-19 15:55:25 +01001584
1585.. code-block:: yaml
1586
1587 linux:
1588 system:
1589 motd: |
1590 This is [company name] network.
1591 Unauthorized access strictly prohibited.
1592
Filip Pytloun8296bb92016-02-19 18:42:09 +01001593Haveged
1594~~~~~~~
1595
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001596If you are running headless server and are low on entropy,
1597you may set up Haveged:
Filip Pytloun8296bb92016-02-19 18:42:09 +01001598
1599.. code-block:: yaml
1600
1601 linux:
1602 system:
1603 haveged:
1604 enabled: true
1605
Filip Pytlounf5383a42015-10-06 16:28:32 +02001606Linux network
1607-------------
1608
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001609Linux with network manager:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001610
1611.. code-block:: yaml
1612
1613 linux:
1614 network:
1615 enabled: true
1616 network_manager: true
1617
Dzmitry Stremkouski00cdbe62018-10-31 16:41:54 +01001618Execute linux.network.interface state without ifupdown activity:
1619
1620.. code-block:: bash
1621
1622 salt-call linux.network.interface pillar='{"linux":{"network":{"noifupdown":True}}}'
1623
1624
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001625Linux with default static network interfaces, default gateway
1626interface and DNS servers:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001627
1628.. code-block:: yaml
1629
1630 linux:
1631 network:
1632 enabled: true
1633 interface:
1634 eth0:
1635 enabled: true
1636 type: eth
1637 address: 192.168.0.102
1638 netmask: 255.255.255.0
1639 gateway: 192.168.0.1
1640 name_servers:
1641 - 8.8.8.8
1642 - 8.8.4.4
1643 mtu: 1500
1644
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001645Linux with bonded interfaces and disabled ``NetworkManager``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001646
1647.. code-block:: yaml
1648
1649 linux:
1650 network:
1651 enabled: true
1652 interface:
1653 eth0:
1654 type: eth
1655 ...
1656 eth1:
1657 type: eth
1658 ...
1659 bond0:
1660 enabled: true
1661 type: bond
1662 address: 192.168.0.102
1663 netmask: 255.255.255.0
1664 mtu: 1500
1665 use_in:
1666 - interface: ${linux:interface:eth0}
1667 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +01001668 network_manager:
1669 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001670
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001671Linux with VLAN ``interface_params``:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001672
1673.. code-block:: yaml
1674
1675 linux:
1676 network:
1677 enabled: true
1678 interface:
1679 vlan69:
1680 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001681 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001682 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001683
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001684Linux with wireless interface parameters:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001685
1686.. code-block:: yaml
1687
1688 linux:
1689 network:
1690 enabled: true
1691 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001692 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001693 interface:
1694 wlan0:
1695 type: eth
1696 wireless:
1697 essid: example
1698 key: example_key
1699 security: wpa
1700 priority: 1
1701
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001702Linux networks with routes defined:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001703
1704.. code-block:: yaml
1705
1706 linux:
1707 network:
1708 enabled: true
1709 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001710 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001711 interface:
1712 eth0:
1713 type: eth
1714 route:
1715 default:
1716 address: 192.168.0.123
1717 netmask: 255.255.255.0
1718 gateway: 192.168.0.1
1719
ivce5011da2019-01-23 07:56:53 +03001720Linux networks with implicit routes definition:
1721
1722- on node 1:
1723
1724.. code-block:: yaml
1725
1726 linux:
1727 network:
1728 enabled: true
1729 router:
1730 ctl:
1731 # router that connects 10.0.1.0/24 and 10.0.2.0/24
1732 addresses:
1733 - 10.0.1.1/24
1734 - 10.0.2.1/24
1735 test:
1736 addresses:
1737 - 10.0.1.2/24
1738 networks:
1739 - 10.100.0.0/16
1740 interface:
1741 ctl:
1742 name: eth0
1743 address: 10.0.1.101
1744 netmask: 255.255.255.0
1745
1746- on node2:
1747
1748.. code-block:: yaml
1749
1750 linux:
1751 network:
1752 enabled: true
1753 router:
1754 ctl:
1755 # equivalent of node1's ctl router with 'implicit_routes = false'
1756 options:
1757 implicit_routes: false
1758 addresses:
1759 - 10.0.1.1/24
1760 - 10.0.2.1/24
1761 networks:
1762 - 10.0.1.0/24
1763 - 10.0.2.0/24
1764 interface:
1765 ctl:
1766 name: eth0
1767 address: 10.0.2.101
1768 netmask: 255.255.255.0
1769
1770
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001771Native Linux Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001772
1773.. code-block:: yaml
1774
1775 linux:
1776 network:
1777 interface:
1778 eth1:
1779 enabled: true
1780 type: eth
1781 proto: manual
1782 up_cmds:
1783 - ip address add 0/0 dev $IFACE
1784 - ip link set $IFACE up
1785 down_cmds:
1786 - ip link set $IFACE down
1787 br-ex:
1788 enabled: true
1789 type: bridge
1790 address: ${linux:network:host:public_local:address}
1791 netmask: 255.255.255.0
1792 use_interfaces:
1793 - eth1
1794
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001795Open vSwitch Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001796
1797.. code-block:: yaml
1798
1799 linux:
1800 network:
1801 bridge: openvswitch
1802 interface:
1803 eth1:
1804 enabled: true
1805 type: eth
1806 proto: manual
1807 up_cmds:
1808 - ip address add 0/0 dev $IFACE
1809 - ip link set $IFACE up
1810 down_cmds:
1811 - ip link set $IFACE down
1812 br-ex:
1813 enabled: true
1814 type: bridge
1815 address: ${linux:network:host:public_local:address}
1816 netmask: 255.255.255.0
1817 use_interfaces:
1818 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001819 br-prv:
1820 enabled: true
1821 type: ovs_bridge
1822 mtu: 65000
1823 br-ens7:
1824 enabled: true
1825 name: br-ens7
1826 type: ovs_bridge
1827 proto: manual
1828 mtu: 9000
1829 use_interfaces:
1830 - ens7
1831 patch-br-ens7-br-prv:
1832 enabled: true
1833 name: ens7-prv
1834 ovs_type: ovs_port
1835 type: ovs_port
1836 bridge: br-ens7
1837 port_type: patch
1838 peer: prv-ens7
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001839 tag: 109 # [] to unset a tag
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001840 mtu: 65000
1841 patch-br-prv-br-ens7:
1842 enabled: true
1843 name: prv-ens7
1844 bridge: br-prv
1845 ovs_type: ovs_port
1846 type: ovs_port
1847 port_type: patch
1848 peer: ens7-prv
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001849 tag: 109
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001850 mtu: 65000
1851 ens7:
1852 enabled: true
1853 name: ens7
1854 proto: manual
1855 ovs_port_type: OVSPort
1856 type: ovs_port
1857 ovs_bridge: br-ens7
1858 bridge: br-ens7
Oleg Gelbukh36f01072019-07-01 15:26:16 -07001859 ens6:
1860 enabled: true
1861 proto: manual
1862 type: eth
1863 ovs_bridge: br-ctl
1864 br-ctl:
1865 enabled: true
1866 type: ovs_bridge
1867 internal-br-ctl-port:
1868 enabled: true
1869 proto: static
1870 address: 172.172.0.10
1871 netmask: 255.255.0.0
1872 name_servers:
1873 - 8.8.8.8
1874 - 172.172.172.172
1875 name: port-br-ctl
1876 bridge: br-ctl
1877 ovs_type: ovs_port
1878 type: ovs_port
1879 port_type: internal
1880 mtu: 65000
Filip Pytlounf5383a42015-10-06 16:28:32 +02001881
Petr Jediný8f8ae542017-07-13 16:19:12 +02001882Debian manual proto interfaces
1883
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001884When you are changing interface proto from static in up state
1885to manual, you may need to flush ip addresses. For example,
1886if you want to use the interface and the ip on the bridge.
1887This can be done by setting the ``ipflush_onchange`` to true.
Petr Jediný8f8ae542017-07-13 16:19:12 +02001888
1889.. code-block:: yaml
1890
1891 linux:
1892 network:
1893 interface:
1894 eth1:
1895 enabled: true
1896 type: eth
1897 proto: manual
1898 mtu: 9100
1899 ipflush_onchange: true
1900
Jiri Broulik1a191e32018-01-15 15:54:21 +01001901Debian static proto interfaces
1902
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001903When you are changing interface proto from dhcp in up state to
1904static, you may need to flush ip addresses and restart interface
1905to assign ip address from a managed file. For example, if you wantto
1906use the interface and the ip on the bridge. This can be done by
1907setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
1908param set to true.
Jiri Broulik1a191e32018-01-15 15:54:21 +01001909
1910.. code-block:: yaml
1911
1912 linux:
1913 network:
1914 interface:
1915 eth1:
1916 enabled: true
1917 type: eth
1918 proto: static
1919 address: 10.1.0.22
1920 netmask: 255.255.255.0
1921 ipflush_onchange: true
1922 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001923
Petr Jedinýd577cb52017-06-28 20:17:49 +02001924Concatinating and removing interface files
1925
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001926Debian based distributions have ``/etc/network/interfaces.d/``
1927directory, where you can store configuration of network
1928interfaces in separate files. You can concatinate the files
1929to the defined destination when needed, this operation removes
1930the file from the ``/etc/network/interfaces.d/``. If you just need
1931to remove iface files, you can use the ``remove_iface_files`` key.
Petr Jedinýd577cb52017-06-28 20:17:49 +02001932
1933.. code-block:: yaml
1934
1935 linux:
1936 network:
1937 concat_iface_files:
1938 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1939 dst: '/etc/network/interfaces'
1940 remove_iface_files:
1941 - '/etc/network/interfaces.d/90-custom.cfg'
1942
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001943Configure DHCP client
Petr Jedinýd577cb52017-06-28 20:17:49 +02001944
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001945None of the keys is mandatory, include only those you really need.
1946For full list of available options under send, supersede, prepend,
1947append refer to dhcp-options(5).
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001948
1949.. code-block:: yaml
1950
1951 linux:
1952 network:
1953 dhclient:
1954 enabled: true
1955 backoff_cutoff: 15
1956 initial_interval: 10
1957 reboot: 10
1958 retry: 60
1959 select_timeout: 0
1960 timeout: 120
1961 send:
1962 - option: host-name
1963 declaration: "= gethostname()"
1964 supersede:
1965 - option: host-name
1966 declaration: "spaceship"
1967 - option: domain-name
1968 declaration: "domain.home"
1969 #- option: arp-cache-timeout
1970 # declaration: 20
1971 prepend:
1972 - option: domain-name-servers
1973 declaration:
1974 - 8.8.8.8
1975 - 8.8.4.4
1976 - option: domain-search
1977 declaration:
1978 - example.com
1979 - eng.example.com
1980 #append:
1981 #- option: domain-name-servers
1982 # declaration: 127.0.0.1
1983 # ip or subnet to reject dhcp offer from
1984 reject:
1985 - 192.33.137.209
1986 - 10.0.2.0/24
1987 request:
1988 - subnet-mask
1989 - broadcast-address
1990 - time-offset
1991 - routers
1992 - domain-name
1993 - domain-name-servers
1994 - domain-search
1995 - host-name
1996 - dhcp6.name-servers
1997 - dhcp6.domain-search
1998 - dhcp6.fqdn
1999 - dhcp6.sntp-servers
2000 - netbios-name-servers
2001 - netbios-scope
2002 - interface-mtu
2003 - rfc3442-classless-static-routes
2004 - ntp-servers
2005 require:
2006 - subnet-mask
2007 - domain-name-servers
2008 # if per interface configuration required add below
2009 interface:
2010 ens2:
2011 initial_interval: 11
2012 reject:
2013 - 192.33.137.210
2014 ens3:
2015 initial_interval: 12
2016 reject:
2017 - 192.33.137.211
2018
Petr Michaleceb14b552017-06-01 10:27:05 +02002019Linux network systemd settings:
2020
2021.. code-block:: yaml
2022
2023 linux:
2024 network:
2025 ...
2026 systemd:
2027 link:
2028 10-iface-dmz:
2029 Match:
2030 MACAddress: c8:5b:67:fa:1a:af
2031 OriginalName: eth0
2032 Link:
2033 Name: dmz0
2034 netdev:
2035 20-bridge-dmz:
2036 match:
2037 name: dmz0
2038 network:
2039 mescription: bridge
2040 bridge: br-dmz0
2041 network:
2042 # works with lowercase, keys are by default capitalized
2043 40-dhcp:
2044 match:
2045 name: '*'
2046 network:
2047 DHCP: yes
2048
Petr Michalec10462bb2017-03-23 19:18:08 +01002049Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01002050
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002051Use ``/etc/environment`` for static system wide variable assignment
2052after boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002053
2054.. code-block:: yaml
2055
2056 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01002057 system:
2058 env:
2059 BOB_VARIABLE: Alice
2060 ...
2061 BOB_PATH:
2062 - /srv/alice/bin
2063 - /srv/bob/bin
2064 ...
2065 ftp_proxy: none
2066 http_proxy: http://global-http-proxy.host.local:8080
2067 https_proxy: ${linux:system:proxy:https}
2068 no_proxy:
2069 - 192.168.0.80
2070 - 192.168.1.80
2071 - .domain.com
2072 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02002073 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01002074 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02002075 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01002076 ftp: ftp://proxy.host.local:2121
2077 http: http://proxy.host.local:3142
2078 https: https://proxy.host.local:3143
2079 noproxy:
2080 - .domain.com
2081 - .local
2082
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002083Configure the ``profile.d`` scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01002084
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002085The ``profile.d`` scripts are being sourced during ``.sh`` execution
2086and support variable expansion in opposite to /etc/environment global
2087settings in ``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01002088
2089.. code-block:: yaml
2090
2091 linux:
2092 system:
2093 profile:
2094 locales: |
2095 export LANG=C
2096 export LC_ALL=C
2097 ...
2098 vi_flavors.sh: |
2099 export PAGER=view
2100 export EDITOR=vim
2101 alias vi=vim
2102 shell_locales.sh: |
2103 export LANG=en_US
2104 export LC_ALL=en_US.UTF-8
2105 shell_proxies.sh: |
2106 export FTP_PROXY=ftp://127.0.3.3:2121
2107 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02002108
Dmitry Teselkina0d31d12018-09-04 14:43:09 +03002109
2110Configure login.defs parameters
2111-------------------------------
2112
2113.. code-block:: yaml
2114
2115 linux:
2116 system:
2117 login_defs:
2118 <opt_name>:
2119 enabled: true
2120 value: <opt_value>
2121
2122<opt_name> is a configurational option defined in 'man login.defs'.
2123<opt_name> is case sensitive, should be UPPERCASE only!
2124
2125
Filip Pytlounf5383a42015-10-06 16:28:32 +02002126Linux with hosts
2127
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002128Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
2129removing entries that are not defined in model except defaults
2130for both IPv4 and IPv6 localhost and hostname as well as FQDN.
Ales Komarek417e8c52017-08-25 15:10:29 +02002131
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002132We recommend using this option to verify that ``/etc/hosts``
2133is always in a clean state. However it is not enabled by default
2134for security reasons.
Filip Pytloun86506fe2017-01-26 14:36:16 +01002135
Filip Pytlounf5383a42015-10-06 16:28:32 +02002136.. code-block:: yaml
2137
2138 linux:
2139 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002140 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002141 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01002142 # No need to define this one if purge_hosts is true
2143 hostname:
2144 address: 127.0.1.1
2145 names:
2146 - ${linux:network:fqdn}
2147 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02002148 node1:
2149 address: 192.168.10.200
2150 names:
2151 - node2.domain.com
2152 - service2.domain.com
2153 node2:
2154 address: 192.168.10.201
2155 names:
2156 - node2.domain.com
2157 - service2.domain.com
2158
Ales Komarek417e8c52017-08-25 15:10:29 +02002159Linux with hosts collected from mine
2160
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002161All DNS records defined within infrastrucuture
2162are passed to the local hosts records or any DNS server. Only
2163hosts with the ``grain`` parameter set to ``true`` will be propagated
2164to the mine.
Ales Komarek417e8c52017-08-25 15:10:29 +02002165
2166.. code-block:: yaml
2167
2168 linux:
2169 network:
2170 purge_hosts: true
2171 mine_dns_records: true
2172 host:
2173 node1:
2174 address: 192.168.10.200
2175 grain: true
2176 names:
2177 - node2.domain.com
2178 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01002179
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002180Set up ``resolvconf's basic resolver info``, e.g. nameservers, search/domain and options:
Filip Pytlounde9bea52016-01-11 15:39:10 +01002181
2182.. code-block:: yaml
2183
2184 linux:
2185 network:
2186 resolv:
2187 dns:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002188 - 8.8.4.4
2189 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01002190 domain: my.example.com
2191 search:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002192 - my.example.com
2193 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01002194 options:
Michael Polenchukc80ddd42019-01-15 18:47:48 +04002195 - ndots:5
2196 - timeout:2
2197 - attempts:2
Filip Pytlounde9bea52016-01-11 15:39:10 +01002198
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002199Set up custom TX queue length for tap interfaces:
Andrii Petrenko735761d2017-03-21 17:17:35 -07002200
2201.. code-block:: yaml
2202
2203 linux:
2204 network:
Dzmitry Stremkouskif76e8092020-09-14 17:41:49 +02002205 custom_txqueuelen
2206 tap:
2207 queue_length: 10000
2208 enabled: true
2209 device_filter: 'tap[0-9a-z\-]*'
2210 ten:
2211 enabled: false
2212 veth:
2213 queue_length: 20000
Andrii Petrenko735761d2017-03-21 17:17:35 -07002214
Michael Polenchukc37bd4a2019-04-22 15:20:03 +04002215Auto repair/re-attach libvirt's vnet interfaces:
2216
2217.. code-block:: yaml
2218
2219 linux:
2220 network:
2221 libvirt_vnet_repair: true
2222
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002223DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002224
2225**DPDK OVS NIC**
2226
2227.. code-block:: yaml
2228
2229 linux:
2230 network:
2231 bridge: openvswitch
2232 dpdk:
2233 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002234 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002235 openvswitch:
2236 pmd_cpu_mask: "0x6"
2237 dpdk_socket_mem: "1024,1024"
2238 dpdk_lcore_mask: "0x400"
2239 memory_channels: 2
2240 interface:
2241 dpkd0:
2242 name: ${_param:dpdk_nic}
2243 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002244 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002245 enabled: true
2246 type: dpdk_ovs_port
2247 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002248 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002249 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01002250 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002251 br-prv:
2252 enabled: true
2253 type: dpdk_ovs_bridge
Michael Polenchuk70147482018-12-29 16:46:50 +04002254 br-floating:
2255 enabled: true
2256 type: ovs_bridge
2257 name_servers:
2258 - 1.1.1.1
2259 - 9.9.9.9
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002260
2261**DPDK OVS Bond**
2262
2263.. code-block:: yaml
2264
2265 linux:
2266 network:
2267 bridge: openvswitch
2268 dpdk:
2269 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04002270 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002271 openvswitch:
2272 pmd_cpu_mask: "0x6"
2273 dpdk_socket_mem: "1024,1024"
2274 dpdk_lcore_mask: "0x400"
2275 memory_channels: 2
2276 interface:
2277 dpdk_second_nic:
2278 name: ${_param:primary_second_nic}
2279 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002280 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002281 bond: dpdkbond0
2282 enabled: true
2283 type: dpdk_ovs_port
2284 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002285 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002286 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002287 dpdk_first_nic:
2288 name: ${_param:primary_first_nic}
2289 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04002290 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002291 bond: dpdkbond0
2292 enabled: true
2293 type: dpdk_ovs_port
2294 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04002295 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01002296 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002297 dpdkbond0:
2298 enabled: true
2299 bridge: br-prv
2300 type: dpdk_ovs_bond
2301 mode: active-backup
2302 br-prv:
2303 enabled: true
2304 type: dpdk_ovs_bridge
2305
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01002306**DPDK OVS LACP Bond with vlan tag**
2307
2308.. code-block:: yaml
2309
2310 linux:
2311 network:
2312 bridge: openvswitch
2313 dpdk:
2314 enabled: true
2315 driver: uio
2316 openvswitch:
2317 pmd_cpu_mask: "0x6"
2318 dpdk_socket_mem: "1024,1024"
2319 dpdk_lcore_mask: "0x400"
2320 memory_channels: "2"
2321 interface:
2322 eth3:
2323 enabled: true
2324 type: eth
2325 proto: manual
2326 name: ${_param:tenant_first_nic}
2327 eth4:
2328 enabled: true
2329 type: eth
2330 proto: manual
2331 name: ${_param:tenant_second_nic}
2332 dpdk0:
2333 name: ${_param:tenant_first_nic}
2334 pci: "0000:81:00.0"
2335 driver: igb_uio
2336 bond: bond1
2337 enabled: true
2338 type: dpdk_ovs_port
2339 n_rxq: 2
2340 dpdk1:
2341 name: ${_param:tenant_second_nic}
2342 pci: "0000:81:00.1"
2343 driver: igb_uio
2344 bond: bond1
2345 enabled: true
2346 type: dpdk_ovs_port
2347 n_rxq: 2
2348 bond1:
2349 enabled: true
2350 bridge: br-prv
2351 type: dpdk_ovs_bond
2352 mode: balance-slb
2353 br-prv:
2354 enabled: true
2355 type: dpdk_ovs_bridge
2356 tag: ${_param:tenant_vlan}
2357 address: ${_param:tenant_address}
2358 netmask: ${_param:tenant_network_netmask}
2359
Jakub Pavlikaa759062017-03-13 15:57:26 +01002360**DPDK OVS bridge for VXLAN**
2361
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002362If VXLAN is used as tenant segmentation, IP address must
2363be set on ``br-prv``.
Jakub Pavlikaa759062017-03-13 15:57:26 +01002364
2365.. code-block:: yaml
2366
2367 linux:
2368 network:
2369 ...
2370 interface:
2371 br-prv:
2372 enabled: true
2373 type: dpdk_ovs_bridge
2374 address: 192.168.50.0
2375 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04002376 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01002377 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002378
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02002379**DPDK OVS bridge with Linux network interface**
2380
2381.. code-block:: yaml
2382
2383 linux:
2384 network:
2385 ...
2386 interface:
2387 eth0:
2388 type: eth
2389 ovs_bridge: br-prv
2390 ...
2391 br-prv:
2392 enabled: true
2393 type: dpdk_ovs_bridge
2394 ...
2395
Jakub Pavlik21ca2152017-02-27 22:21:09 +01002396Linux storage
2397-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02002398
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002399Linux with mounted Samba:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002400
2401.. code-block:: yaml
2402
2403 linux:
2404 storage:
2405 enabled: true
2406 mount:
2407 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01002408 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02002409 - path: /media/myuser/public/
2410 - device: //192.168.0.1/storage
2411 - file_system: cifs
2412 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
2413
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002414NFS mount:
Jiri Broulikb017f932017-03-31 13:55:36 +02002415
2416.. code-block:: yaml
2417
2418 linux:
2419 storage:
2420 enabled: true
2421 mount:
2422 nfs_glance:
2423 enabled: true
2424 path: /var/lib/glance/images
2425 device: 172.16.10.110:/var/nfs/glance
2426 file_system: nfs
2427 opts: rw,sync
2428
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002429File swap configuration:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002430
2431.. code-block:: yaml
2432
2433 linux:
2434 storage:
2435 enabled: true
2436 swap:
2437 file:
2438 enabled: true
2439 engine: file
2440 device: /swapfile
2441 size: 1024
2442
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002443Partition swap configuration:
Lachlan Evenson30676512016-01-22 15:43:28 -08002444
2445.. code-block:: yaml
2446
2447 linux:
2448 storage:
2449 enabled: true
2450 swap:
2451 partition:
2452 enabled: true
2453 engine: partition
2454 device: /dev/vg0/swap
2455
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002456LVM group ``vg1`` with one device and ``data`` volume mounted
2457into ``/mnt/data``.
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002458
2459.. code-block:: yaml
2460
2461 parameters:
2462 linux:
2463 storage:
2464 mount:
2465 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01002466 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002467 device: /dev/vg1/data
2468 file_system: ext4
2469 path: /mnt/data
2470 lvm:
2471 vg1:
2472 enabled: true
2473 devices:
2474 - /dev/sdb
2475 volume:
2476 data:
2477 size: 40G
2478 mount: ${linux:storage:mount:data}
root3387f332019-01-11 08:55:32 +00002479 # When set they will take precedence over filters aget from volume groups.
2480 lvm_filters:
2481 10:
2482 enabled: True
2483 value: "a|loop|"
2484 20:
2485 enabled: True
2486 value: "r|/dev/hdc|"
2487 30:
2488 enabled: True
2489 value: "a|/dev/ide|"
2490 40:
2491 enabled: True
2492 value: "r|.*|"
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002493
Jakub Pavlik4f742142017-08-08 15:05:50 +02002494Create partitions on disk. Specify size in MB. It expects empty
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002495disk without any existing partitions.
2496Set ``startsector=1`` if you want to start partitions from ``2048``.
Jakub Pavlik4f742142017-08-08 15:05:50 +02002497
2498.. code-block:: yaml
2499
2500 linux:
2501 storage:
2502 disk:
2503 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01002504 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02002505 name: /dev/loop1
2506 type: gpt
2507 partitions:
2508 - size: 200 #size in MB
2509 type: fat32
2510 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02002511 mkfs: True
2512 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02002513 /dev/vda1:
2514 partitions:
2515 - size: 5
2516 type: ext2
2517 - size: 10
2518 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02002519
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002520Multipath with Fujitsu Eternus DXL:
Ales Komareka634f4b2016-10-02 13:11:04 +02002521
2522.. code-block:: yaml
2523
2524 parameters:
2525 linux:
2526 storage:
2527 multipath:
2528 enabled: true
2529 blacklist_devices:
2530 - /dev/sda
2531 - /dev/sdb
2532 backends:
2533 - fujitsu_eternus_dxl
2534
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002535Multipath with Hitachi VSP 1000:
Ales Komareka634f4b2016-10-02 13:11:04 +02002536
2537.. code-block:: yaml
2538
2539 parameters:
2540 linux:
2541 storage:
2542 multipath:
2543 enabled: true
2544 blacklist_devices:
2545 - /dev/sda
2546 - /dev/sdb
2547 backends:
2548 - hitachi_vsp1000
2549
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002550Multipath with IBM Storwize:
Ales Komareka634f4b2016-10-02 13:11:04 +02002551
2552.. code-block:: yaml
2553
2554 parameters:
2555 linux:
2556 storage:
2557 multipath:
2558 enabled: true
2559 blacklist_devices:
2560 - /dev/sda
2561 - /dev/sdb
2562 backends:
2563 - ibm_storwize
2564
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002565Multipath with multiple backends:
Ales Komareka634f4b2016-10-02 13:11:04 +02002566
2567.. code-block:: yaml
2568
2569 parameters:
2570 linux:
2571 storage:
2572 multipath:
2573 enabled: true
2574 blacklist_devices:
2575 - /dev/sda
2576 - /dev/sdb
2577 - /dev/sdc
2578 - /dev/sdd
2579 backends:
2580 - ibm_storwize
2581 - fujitsu_eternus_dxl
2582 - hitachi_vsp1000
2583
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002584PAM LDAP integration:
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002585
2586.. code-block:: yaml
2587
2588 parameters:
2589 linux:
2590 system:
2591 auth:
2592 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02002593 mkhomedir:
2594 enabled: true
2595 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002596 ldap:
2597 enabled: true
2598 binddn: cn=bind,ou=service_users,dc=example,dc=com
2599 bindpw: secret
2600 uri: ldap://127.0.0.1
2601 base: ou=users,dc=example,dc=com
2602 ldap_version: 3
2603 pagesize: 65536
2604 referrals: off
2605 filter:
2606 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2607 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2608 group: (&(objectClass=group)(gidNumber=*))
2609
Gleb Galkin93b9ae92018-10-18 13:57:30 +03002610PAM duo 2FA integration
2611
2612.. code-block:: yaml
2613
2614 parameters:
2615 linux:
2616 system:
2617 auth:
2618 enabled: true
2619 duo:
2620 enabled: true
2621 duo_host: localhost
2622 duo_ikey: DUO-INTEGRATION-KEY
2623 duo_skey: DUO-SECRET-KEY
2624
2625duo package version may be specified (optional)
2626
2627.. code-block:: yaml
2628
2629 linux:
2630 system:
2631 package:
2632 duo-unix:
2633 version: 1.10.1-0
2634
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002635Disabled multipath (the default setup):
Ales Komareka634f4b2016-10-02 13:11:04 +02002636
2637.. code-block:: yaml
2638
2639 parameters:
2640 linux:
2641 storage:
2642 multipath:
2643 enabled: false
2644
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002645Linux with local loopback device:
Simon Pasquier375001e2017-01-26 13:22:33 +01002646
2647.. code-block:: yaml
2648
2649 linux:
2650 storage:
2651 loopback:
2652 disk1:
2653 file: /srv/disk1
2654 size: 50G
2655
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002656External config generation
2657--------------------------
2658
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002659You are able to use config support metadata between formulas
2660and only generate configuration files for external use, for example, Docker, and so on.
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002661
2662.. code-block:: yaml
2663
2664 parameters:
2665 linux:
2666 system:
2667 config:
2668 pillar:
2669 jenkins:
2670 master:
2671 home: /srv/volumes/jenkins
2672 approved_scripts:
2673 - method java.net.URL openConnection
2674 credentials:
2675 - type: username_password
2676 scope: global
2677 id: test
2678 desc: Testing credentials
2679 username: test
2680 password: test
2681
Vladimir Ereminccf28842017-04-10 23:52:10 +03002682Netconsole Remote Kernel Logging
2683--------------------------------
2684
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002685Netconsole logger can be configured for the configfs-enabled kernels
2686(``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
2687applies both in runtime (if network is already configured),
2688and on-boot after an interface initialization.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002689
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002690.. note::
2691
2692 * Receiver can be located only on the same L3 domain
2693 (or you need to configure gateway MAC manually).
2694 * The Receiver MAC is detected only on configuration time.
2695 * Using broadcast MAC is not recommended.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002696
2697.. code-block:: yaml
2698
2699 parameters:
2700 linux:
2701 system:
2702 netconsole:
2703 enabled: true
2704 port: 514 (optional)
2705 loglevel: debug (optional)
2706 target:
2707 192.168.0.1:
2708 interface: bond0
2709 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02002710
Dzmitry Stremkouskid1a268b2018-10-03 16:36:04 +02002711Check network params on the environment
2712---------------------------------------
2713
2714Grab nics and nics states
2715
2716.. code-block:: bash
2717
2718 salt osd001\* net_checks.get_nics
2719
2720**Example of system output:**
2721
2722.. code-block:: bash
2723
2724 osd001.domain.com:
2725 |_
2726 - bond0
2727 - None
2728 - 1e:c8:64:42:23:b9
2729 - 0
2730 - 1500
2731 |_
2732 - bond1
2733 - None
2734 - 3c:fd:fe:27:3b:00
2735 - 1
2736 - 9100
2737 |_
2738 - fourty1
2739 - None
2740 - 3c:fd:fe:27:3b:00
2741 - 1
2742 - 9100
2743 |_
2744 - fourty2
2745 - None
2746 - 3c:fd:fe:27:3b:02
2747 - 1
2748 - 9100
2749
2750Grab 10G nics PCI addresses for hugepages setup
2751
2752.. code-block:: bash
2753
2754 salt cmp001\* net_checks.get_ten_pci
2755
2756**Example of system output:**
2757
2758.. code-block:: bash
2759
2760 cmp001.domain.com:
2761 |_
2762 - ten1
2763 - 0000:19:00.0
2764 |_
2765 - ten2
2766 - 0000:19:00.1
2767 |_
2768 - ten3
2769 - 0000:19:00.2
2770 |_
2771 - ten4
2772 - 0000:19:00.3
2773
2774Grab ip address for an interface
2775
2776.. code-block:: bash
2777
2778 salt cmp001\* net_checks.get_ip iface=one4
2779
2780**Example of system output:**
2781
2782.. code-block:: bash
2783
2784 cmp001.domain.com:
2785 10.200.177.101
2786
2787Grab ip addresses map
2788
2789.. code-block:: bash
2790
2791 salt-call net_checks.nodes_addresses
2792
2793**Example of system output:**
2794
2795.. code-block:: bash
2796
2797 local:
2798 |_
2799 - cid01.domain.com
2800 |_
2801 |_
2802 - pxe
2803 - 10.200.177.91
2804 |_
2805 - control
2806 - 10.200.178.91
2807 |_
2808 - cmn02.domain.com
2809 |_
2810 |_
2811 - storage_access
2812 - 10.200.181.67
2813 |_
2814 - pxe
2815 - 10.200.177.67
2816 |_
2817 - control
2818 - 10.200.178.67
2819 |_
2820 - cmp010.domain.com
2821 |_
2822 |_
2823 - pxe
2824 - 10.200.177.110
2825 |_
2826 - storage_access
2827 - 10.200.181.110
2828 |_
2829 - control
2830 - 10.200.178.110
2831 |_
2832 - vxlan
2833 - 10.200.179.110
2834
2835Verify full mesh connectivity
2836
2837.. code-block:: bash
2838
2839 salt-call net_checks.ping_check
2840
2841**Example of positive system output:**
2842
2843.. code-block:: bash
2844
2845 ['PASSED']
2846 [INFO ] ['PASSED']
2847 local:
2848 True
2849
2850**Example of system output in case of failure:**
2851
2852.. code-block:: bash
2853
2854 FAILED
2855 [ERROR ] FAILED
2856 ['control: 10.0.1.92 -> 10.0.1.224: Failed']
2857 ['control: 10.0.1.93 -> 10.0.1.224: Failed']
2858 ['control: 10.0.1.51 -> 10.0.1.224: Failed']
2859 ['control: 10.0.1.102 -> 10.0.1.224: Failed']
2860 ['control: 10.0.1.13 -> 10.0.1.224: Failed']
2861 ['control: 10.0.1.81 -> 10.0.1.224: Failed']
2862 local:
2863 False
2864
2865For this feature to work, please mark addresses with some role.
2866Otherwise 'default' role is assumed and mesh would consist of all
2867addresses on the environment.
2868
2869Mesh mark is needed only for interfaces which are enabled and have
2870ip address assigned.
2871
2872Checking dhcp pxe network meaningless, as it is used for salt
2873master vs minion communications, therefore treated as checked.
2874
2875.. code-block:: yaml
2876
2877 parameters:
2878 linux:
2879 network:
2880 interface:
2881 ens3:
2882 enabled: true
2883 type: eth
2884 proto: static
2885 address: ${_param:deploy_address}
2886 netmask: ${_param:deploy_network_netmask}
2887 gateway: ${_param:deploy_network_gateway}
2888 mesh: pxe
2889
2890Check pillars for ip address duplicates
2891
2892.. code-block:: bash
2893
2894 salt-call net_checks.verify_addresses
2895
2896**Example of positive system output:**
2897
2898.. code-block:: bash
2899
2900 ['PASSED']
2901 [INFO ] ['PASSED']
2902 local:
2903 True
2904
2905**Example of system output in case of failure:**
2906
2907.. code-block:: bash
2908
2909 FAILED. Duplicates found
2910 [ERROR ] FAILED. Duplicates found
2911 ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2912 [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2913 local:
2914 False
2915
2916Generate csv report for the env
2917
2918.. code-block:: bash
2919
2920 salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
2921 | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
2922 | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
2923
2924**Example of system output:**
2925
2926.. code-block:: bash
2927
2928 server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
2929 cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
2930 cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
2931 cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
2932 cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
2933 cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
2934 cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
2935 cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
2936 cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
2937 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
2938 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
2939 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
2940 cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
2941 cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
2942 cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
2943 ...
2944
Filip Pytlounf5383a42015-10-06 16:28:32 +02002945Usage
2946=====
2947
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002948Set MTU of the eth0 network interface to 1400:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002949
2950.. code-block:: bash
2951
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002952 ip link set dev eth0 mtu 1400
Filip Pytlounf5383a42015-10-06 16:28:32 +02002953
Denis Egorenko2e6ad0f2019-10-02 14:57:10 +04002954Switch Kernel from non-HWE to HWE
2955==================================
2956
2957It is possible to switch Kernel from non-HWE to HWE by using module
2958linux_kernel_switch. It has few methods:
2959
2960* check_hwe_kernel
2961* switch_kernel
2962* rollback_switch_kernel
2963
2964Method ``check_hwe_kernel`` allows to check whether HWE kernel installed
2965or not:
2966
2967.. code-block:: bash
2968
2969 salt <target> linux_kernel_switch.check_hwe_kernel
2970
2971Output for case HWE is installed:
2972
2973.. code-bloc:: bash
2974
2975 kvm02.cluster-env.local:
2976 ----------
2977 linux-image-extra-virtual-hwe-16.04:
2978 ----------
2979 linux-image-extra-virtual-hwe-16.04:
2980 ----------
2981 architecture:
2982 amd64
2983 description:
2984 Extra drivers for Virtual Linux kernel image
2985 This package will always depend on linux-image-generic.
2986 group:
2987 kernel
2988 install_date:
2989 2019-10-01T11:50:15Z
2990 name:
2991 linux-image-extra-virtual-hwe-16.04
2992 packager:
2993 Ubuntu Kernel Team <kernel-team@lists.ubuntu.com>
2994 source:
2995 linux-meta-hwe
2996 version:
2997 4.15.0.54.75
2998 ...
2999
3000Output for case HWE is not installed:
3001
3002.. code-bloc:: bash
3003
3004 kvm02.cluster-env.local:
3005 ----------
3006 linux-image-extra-virtual-hwe-16.04:
3007 Not installed!
3008 linux-image-generic-hwe-16.04:
3009 Not installed!
3010
3011Method ``switch_kernel`` allows you to switch from non-HWE to HWE. It has
3012two options: ``dry_run`` - to check what packages are going to be installed or
3013removed and ``only_kernel`` - install only Kernel image packages without other
3014HWE packages.
3015
3016Method ``rollback_switch_kernel`` allows you to rollback method
3017``switch_kernel`` which was executed successfully previously. Option
3018``dry_run`` - to check what packages are going to be installed/removed.
3019
Filip Pytlounf5383a42015-10-06 16:28:32 +02003020Read more
3021=========
3022
3023* https://www.archlinux.org/
3024* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu