blob: cd9d5c22428f31f87f22e75de3b47927fb9d54cf [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
Filip Pytlounf5383a42015-10-06 16:28:32 +020054 jsmith:
55 name: 'jsmith'
56 enabled: true
azvyagintsev967af132017-06-12 12:25:24 +030057 full_name: 'With clear password'
Filip Pytlounf5383a42015-10-06 16:28:32 +020058 home: '/home/jsmith'
azvyagintsev967af132017-06-12 12:25:24 +030059 hash_password: true
60 password: "userpassword"
61 mark:
62 name: 'mark'
63 enabled: true
64 full_name: "unchange password'
65 home: '/home/mark'
66 password: false
67 elizabeth:
68 name: 'elizabeth'
69 enabled: true
70 full_name: 'With hased password'
71 home: '/home/elizabeth'
72 password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10"
Filip Pytlounf5383a42015-10-06 16:28:32 +020073
Dmitry Teselkin47e41f42018-09-27 14:10:09 +030074Configure password expiration parameters
75----------------------------------------
76The following login.defs parameters can be overridden per-user:
77
78* PASS_MAX_DAYS
79* PASS_MIN_DAYS
80* PASS_WARN_DAYS
81* INACTIVE
82
83.. code-block:: yaml
84
85 linux:
86 system:
87 ...
88 user:
89 jdoe:
90 name: 'jdoe'
91 enabled: true
92 ...
93 maxdays: <PASS_MAX_DAYS>
94 mindays: <PASS_MIN_DAYS>
95 warndays: <PASS_WARN_DAYS>
96 inactdays: <INACTIVE>
97
Petr Michalec1c4c8d82017-02-28 19:09:21 +010098Configure sudo for users and groups under ``/etc/sudoers.d/``.
99This ways ``linux.system.sudo`` pillar map to actual sudo attributes:
100
101.. code-block:: jinja
Aleš Komárek63572992017-04-11 13:16:44 +0200102
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100103 # simplified template:
104 Cmds_Alias {{ alias }}={{ commands }}
105 {{ user }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
106 %{{ group }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
107
108 # when rendered:
109 saltuser1 ALL=(ALL) NOPASSWD: ALL
110
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100111.. code-block:: yaml
Aleš Komárek63572992017-04-11 13:16:44 +0200112
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100113 linux:
114 system:
115 sudo:
116 enabled: true
Tomas Kammd8eb3002017-05-08 19:30:29 +0200117 aliases:
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100118 host:
119 LOCAL:
120 - localhost
121 PRODUCTION:
122 - db1
123 - db2
124 runas:
125 DBA:
126 - postgres
127 - mysql
128 SALT:
129 - root
130 command:
131 # Note: This is not 100% safe when ALL keyword is used, user still may modify configs and hide his actions.
132 # Best practice is to specify full list of commands user is allowed to run.
133 SUPPORT_RESTRICTED:
134 - /bin/vi /etc/sudoers*
135 - /bin/vim /etc/sudoers*
136 - /bin/nano /etc/sudoers*
137 - /bin/emacs /etc/sudoers*
138 - /bin/su - root
139 - /bin/su -
140 - /bin/su
141 - /usr/sbin/visudo
142 SUPPORT_SHELLS:
143 - /bin/sh
144 - /bin/ksh
145 - /bin/bash
146 - /bin/rbash
147 - /bin/dash
148 - /bin/zsh
149 - /bin/csh
150 - /bin/fish
151 - /bin/tcsh
152 - /usr/bin/login
153 - /usr/bin/su
154 - /usr/su
155 ALL_SALT_SAFE:
156 - /usr/bin/salt state*
157 - /usr/bin/salt service*
158 - /usr/bin/salt pillar*
159 - /usr/bin/salt grains*
160 - /usr/bin/salt saltutil*
161 - /usr/bin/salt-call state*
162 - /usr/bin/salt-call service*
163 - /usr/bin/salt-call pillar*
164 - /usr/bin/salt-call grains*
165 - /usr/bin/salt-call saltutil*
166 SALT_TRUSTED:
167 - /usr/bin/salt*
168 users:
169 # saltuser1 with default values: saltuser1 ALL=(ALL) NOPASSWD: ALL
170 saltuser1: {}
171 saltuser2:
172 hosts:
173 - LOCAL
174 # User Alias DBA
175 DBA:
176 hosts:
177 - ALL
178 commands:
179 - ALL_SALT_SAFE
180 groups:
181 db-ops:
182 hosts:
183 - ALL
184 - '!PRODUCTION'
185 runas:
186 - DBA
187 commands:
188 - /bin/cat *
189 - /bin/less *
190 - /bin/ls *
191 salt-ops:
192 hosts:
193 - 'ALL'
194 runas:
195 - SALT
196 commands:
197 - SUPPORT_SHELLS
198 salt-ops-2nd:
199 name: salt-ops
200 nopasswd: false
Jakub Josef7a9d9b92017-05-16 11:39:01 +0200201 setenv: true # Enable sudo -E option
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100202 runas:
203 - DBA
204 commands:
205 - ALL
206 - '!SUPPORT_SHELLS'
207 - '!SUPPORT_RESTRICTED'
208
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300209Linux with package, latest version:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200210
211.. code-block:: yaml
212
213 linux:
214 system:
215 ...
216 package:
217 package-name:
218 version: latest
219
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300220Linux with package from certail repo, version with no upgrades:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200221
222.. code-block:: yaml
223
224 linux:
225 system:
226 ...
227 package:
228 package-name:
229 version: 2132.323
230 repo: 'custom-repo'
231 hold: true
232
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300233Linux with package from certail repo, version with no GPG
234verification:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200235
236.. code-block:: yaml
237
238 linux:
239 system:
240 ...
241 package:
242 package-name:
243 version: 2132.323
244 repo: 'custom-repo'
245 verify: false
246
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300247Linux with autoupdates (automatically install security package
248updates):
Bruno Binet69a9d8d2017-02-16 22:34:32 +0100249
250.. code-block:: yaml
251
252 linux:
253 system:
254 ...
255 autoupdates:
256 enabled: true
257 mail: root@localhost
258 mail_only_on_error: true
259 remove_unused_dependencies: false
260 automatic_reboot: true
261 automatic_reboot_time: "02:00"
262
Dmitry Teselkin0f084a02018-08-29 14:46:38 +0300263Managing cron tasks
264-------------------
265
266There are two data structures that are related to managing cron itself and
267cron tasks:
268
269.. code-block:: yaml
270
271 linux:
272 system:
273 cron:
274
275and
276
277.. code-block:: yaml
278
279 linux:
280 system:
281 job:
282
283`linux:system:cron` manages cron packages, services, and '/etc/cron.allow' file.
284
285'deny' files are managed the only way - we're ensuring they are absent, that's
286a requirement from CIS 5.1.8
287
288'cron' pillar structure is the following:
289
290.. code-block:: yaml
291
292 linux:
293 system:
294 cron:
295 enabled: true
296 pkgs: [ <cron packages> ]
297 services: [ <cron services> ]
298 user:
299 <username>:
300 enabled: true
301
302To add user to '/etc/cron.allow' use 'enabled' key as shown above.
303
304'/etc/cron.deny' is not managed as CIS 5.1.8 requires it was removed.
305
306A user would be ignored if any of the following is true:
307* user is disabled in `linux:system:user:<username>`
308* user is disabled in `linux:system:cron:user:<username>`
309
310`linux:system:job` manages individual cron tasks.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300311
312By default, it will use name as an identifier, unless identifier key is
Filip Pytloun91222222017-08-04 10:55:27 +0200313explicitly set or False (then it will use Salt's default behavior which is
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300314identifier same as command resulting in not being able to change it):
Filip Pytlounf5383a42015-10-06 16:28:32 +0200315
316.. code-block:: yaml
317
318 linux:
319 system:
320 ...
321 job:
322 cmd1:
323 command: '/cmd/to/run'
Filip Pytloun91222222017-08-04 10:55:27 +0200324 identifier: cmd1
Filip Pytlounf5383a42015-10-06 16:28:32 +0200325 enabled: true
326 user: 'root'
327 hour: 2
328 minute: 0
329
Dmitry Teselkin0f084a02018-08-29 14:46:38 +0300330Managing 'at' tasks
331-------------------
332
333Pillar for managing `at` tasks is similar to one for `cron` tasks:
334
335.. code-block:: yaml
336
337 linux:
338 system:
339 at:
340 enabled: true
341 pkgs: [ <at packages> ]
342 services: [ <at services> ]
343 user:
344 <username>:
345 enabled: true
346
347To add a user to '/etc/at.allow' use 'enabled' key as shown above.
348
349'/etc/at.deny' is not managed as CIS 5.1.8 requires it was removed.
350
351A user will be ignored if any of the following is true:
352* user is disabled in `linux:system:user:<username>`
353* user is disabled in `linux:system:at:user:<username>`
354
355
Filip Pytlound0a29e72015-11-30 15:23:34 +0100356Linux security limits (limit sensu user memory usage to max 1GB):
357
358.. code-block:: yaml
359
360 linux:
361 system:
362 ...
363 limit:
364 sensu:
365 enabled: true
366 domain: sensu
367 limits:
368 - type: hard
369 item: as
370 value: 1000000
371
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300372Enable autologin on ``tty1`` (may work only for Ubuntu 14.04):
Filip Pytloun7fee0542015-10-15 11:19:24 +0200373
374.. code-block:: yaml
375
376 linux:
377 system:
378 console:
379 tty1:
380 autologin: root
Filip Pytloun281d0202016-01-29 14:03:51 +0100381 # Enable serial console
382 ttyS0:
383 autologin: root
384 rate: 115200
385 term: xterm
Filip Pytloun7fee0542015-10-15 11:19:24 +0200386
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300387To disable set autologin to ``false``.
Filip Pytloun7fee0542015-10-15 11:19:24 +0200388
Filip Pytloun7731b852016-02-01 11:13:47 +0100389Set ``policy-rc.d`` on Debian-based systems. Action can be any available
390command in ``while true`` loop and ``case`` context.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300391Following will disallow dpkg to stop/start services for the Cassandra
392package automatically:
Filip Pytloun7731b852016-02-01 11:13:47 +0100393
394.. code-block:: yaml
395
396 linux:
397 system:
398 policyrcd:
399 - package: cassandra
400 action: exit 101
401 - package: '*'
402 action: switch
403
Filip Pytlounc49445a2016-04-04 14:23:20 +0200404Set system locales:
405
406.. code-block:: yaml
407
408 linux:
409 system:
410 locale:
411 en_US.UTF-8:
412 default: true
Filip Pytlounee1745f2016-04-04 17:39:41 +0200413 "cs_CZ.UTF-8 UTF-8":
Filip Pytlounc49445a2016-04-04 14:23:20 +0200414 enabled: true
415
Andrey Shestakove7cca052017-05-24 23:06:24 +0300416Systemd settings:
417
418.. code-block:: yaml
419
420 linux:
421 system:
422 ...
423 systemd:
424 system:
425 Manager:
426 DefaultLimitNOFILE: 307200
427 DefaultLimitNPROC: 307200
428 user:
429 Manager:
430 DefaultLimitCPU: 2
431 DefaultLimitNPROC: 4
432
Filip Pytloun8b2131e2017-11-08 13:29:03 +0100433Ensure presence of directory:
434
435.. code-block:: yaml
436
437 linux:
438 system:
439 directory:
440 /tmp/test:
441 user: root
442 group: root
443 mode: 700
444 makedirs: true
445
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300446Ensure presence of file by specifying its source:
Richard Felkl2e07d652018-01-19 10:19:06 +0100447
448.. code-block:: yaml
449
450 linux:
451 system:
452 file:
453 /tmp/test.txt:
454 source: http://example.com/test.txt
Richard Felklf40599a2018-02-06 22:56:41 +0100455 user: root #optional
456 group: root #optional
457 mode: 700 #optional
458 dir_mode: 700 #optional
459 encoding: utf-8 #optional
460 hash: <<hash>> or <<URI to hash>> #optional
461 makedirs: true #optional
462
463 linux:
464 system:
465 file:
466 test.txt:
467 name: /tmp/test.txt
468 source: http://example.com/test.txt
Richard Felkl2e07d652018-01-19 10:19:06 +0100469
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300470Ensure presence of file by specifying its contents:
Richard Felkl2e07d652018-01-19 10:19:06 +0100471
472.. code-block:: yaml
473
474 linux:
475 system:
476 file:
477 /tmp/test.txt:
478 contents: |
479 line1
480 line2
Richard Felklf40599a2018-02-06 22:56:41 +0100481
482 linux:
483 system:
484 file:
485 /tmp/test.txt:
486 contents_pillar: linux:network:hostname
487
488 linux:
489 system:
490 file:
491 /tmp/test.txt:
492 contents_grains: motd
493
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300494Ensure presence of file to be serialized through one of the
495serializer modules (see:
496https://docs.saltstack.com/en/latest/ref/serializers/all/index.html):
Bruno Binet9c2fe222018-06-08 16:57:32 +0200497
498.. code-block:: yaml
499
500 linux:
501 system:
502 file:
503 /tmp/test.json:
504 serialize: json
505 contents:
506 foo: 1
507 bar: 'bar'
508
Filip Pytloun281034a2016-01-04 18:06:22 +0100509Kernel
510~~~~~~
511
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300512Install always up to date LTS kernel and headers from Ubuntu Trusty:
Filip Pytloun281034a2016-01-04 18:06:22 +0100513
514.. code-block:: yaml
515
516 linux:
517 system:
518 kernel:
519 type: generic
520 lts: trusty
521 headers: true
522
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300523Load kernel modules and add them to ``/etc/modules``:
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100524
525.. code-block:: yaml
526
527 linux:
528 system:
529 kernel:
530 modules:
531 - nf_conntrack
532 - tp_smapi
533 - 8021q
534
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300535Configure or blacklist kernel modules with additional options to
536``/etc/modprobe.d`` following example will add
537``/etc/modprobe.d/nf_conntrack.conf`` file with line
538``options nf_conntrack hashsize=262144``:
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300539
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300540'option' can be a mapping (with 'enabled' and 'value' keys) or a scalar.
541
542Example for 'scalar' option value:
543
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300544.. code-block:: yaml
545
546 linux:
547 system:
548 kernel:
549 module:
550 nf_conntrack:
551 option:
552 hashsize: 262144
553
Dmitry Teselkin809834c2018-08-13 19:14:42 +0300554Example for 'mapping' option value:
555
556.. code-block:: yaml
557
558 linux:
559 system:
560 kernel:
561 module:
562 nf_conntrack:
563 option:
564 hashsize:
565 enabled: true
566 value: 262144
567
568NOTE: 'enabled' key is optional and is True by default.
569
570Blacklist a module:
571
572.. code-block:: yaml
573
574 linux:
575 system:
576 kernel:
577 module:
578 nf_conntrack:
579 blacklist: true
580
581A module can have a number of aliases, wildcards are allowed.
582Define an alias for a module:
583
584.. code-block:: yaml
585
586 linux:
587 system:
588 kernel:
589 module:
590 nf_conntrack:
591 alias:
592 nfct:
593 enabled: true
594 "nf_conn*":
595 enabled: true
596
597NOTE: 'enabled' key is mandatory as there are no other keys exist.
598
599Execute custom command instead of 'insmod' when inserting a module:
600
601.. code-block:: yaml
602
603 linux:
604 system:
605 kernel:
606 module:
607 nf_conntrack:
608 install:
609 enabled: true
610 command: /bin/true
611
612NOTE: 'enabled' key is optional and is True by default.
613
614Execute custom command instead of 'rmmod' when removing a module:
615
616.. code-block:: yaml
617
618 linux:
619 system:
620 kernel:
621 module:
622 nf_conntrack:
623 remove:
624 enabled: true
625 command: /bin/true
626
627NOTE: 'enabled' key is optional and is True by default.
628
629Define module dependencies:
630
631.. code-block:: yaml
632
633 linux:
634 system:
635 kernel:
636 module:
637 nf_conntrack:
638 softdep:
639 pre:
640 1:
641 enabled: true
642 value: a
643 2:
644 enabled: true
645 value: b
646 3:
647 enabled: true
648 value: c
649 post:
650 1:
651 enabled: true
652 value: x
653 2:
654 enabled: true
655 value: y
656 3:
657 enabled: true
658 value: z
659
660NOTE: 'enabled' key is optional and is True by default.
661
662
Filip Pytloun281034a2016-01-04 18:06:22 +0100663Install specific kernel version and ensure all other kernel packages are
664not present. Also install extra modules and headers for this kernel:
665
666.. code-block:: yaml
667
668 linux:
669 system:
670 kernel:
671 type: generic
672 extra: true
673 headers: true
674 version: 4.2.0-22
675
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300676Systcl kernel parameters:
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100677
678.. code-block:: yaml
679
680 linux:
681 system:
682 kernel:
683 sysctl:
684 net.ipv4.tcp_keepalive_intvl: 3
685 net.ipv4.tcp_keepalive_time: 30
686 net.ipv4.tcp_keepalive_probes: 8
687
Michael Polenchukebf55522018-01-25 13:22:39 +0400688Configure kernel boot options:
689
690.. code-block:: yaml
691
692 linux:
693 system:
694 kernel:
695 boot_options:
696 - elevator=deadline
697 - spectre_v2=off
698 - nopti
699
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100700CPU
701~~~
702
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300703Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100704
705.. code-block:: yaml
706
707 linux:
708 system:
709 cpu:
710 governor: performance
711
Nick Metzf04f5f32018-01-08 15:25:04 +0100712
Jiri Broulik303905d2018-01-11 14:12:48 +0100713CGROUPS
714~~~~~~~
715
716Setup linux cgroups:
717
718.. code-block:: yaml
719
720 linux:
721 system:
722 cgroup:
723 enabled: true
724 group:
725 ceph_group_1:
726 controller:
727 cpu:
728 shares:
729 value: 250
730 cpuacct:
731 usage:
732 value: 0
733 cpuset:
734 cpus:
735 value: 1,2,3
736 memory:
737 limit_in_bytes:
738 value: 2G
739 memsw.limit_in_bytes:
740 value: 3G
741 mapping:
742 subjects:
743 - '@ceph'
744 generic_group_1:
745 controller:
746 cpu:
747 shares:
748 value: 250
749 cpuacct:
750 usage:
751 value: 0
752 mapping:
753 subjects:
754 - '*:firefox'
755 - 'student:cp'
756
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300757Shared libraries
Nick Metzf04f5f32018-01-08 15:25:04 +0100758~~~~~~~~~~~~~~~~
759
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300760Set additional shared library to Linux system library path:
Nick Metzf04f5f32018-01-08 15:25:04 +0100761
762.. code-block:: yaml
763
764 linux:
765 system:
766 ld:
767 library:
768 java:
769 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
770 - /opt/java/jre/lib/amd64/server
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200771
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200772Certificates
773~~~~~~~~~~~~
774
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300775Add certificate authority into system trusted CA bundle:
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200776
777.. code-block:: yaml
778
779 linux:
780 system:
781 ca_certificates:
782 mycert: |
783 -----BEGIN CERTIFICATE-----
784 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
785 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
786 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
787 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
788 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
789 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
790 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
791 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
792 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
793 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
794 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
795 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
796 -----END CERTIFICATE-----
797
Filip Pytloun361096c2017-08-23 10:57:20 +0200798Sysfs
799~~~~~
800
801Install sysfsutils and set sysfs attributes:
802
803.. code-block:: yaml
804
805 linux:
806 system:
807 sysfs:
808 scheduler:
809 block/sda/queue/scheduler: deadline
810 power:
811 mode:
812 power/state: 0660
813 owner:
814 power/state: "root:power"
815 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
816
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200817Optional: You can also use list that will ensure order of items.
818
819.. code-block:: yaml
820
821 linux:
822 system:
823 sysfs:
824 scheduler:
825 block/sda/queue/scheduler: deadline
826 power:
827 - mode:
828 power/state: 0660
829 - owner:
830 power/state: "root:power"
831 - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
832
Martin Polreich148e1b82018-09-13 15:54:25 +0200833Sysfs definition with disabled automatic write. Attributes are saved
834to configuration, but are not applied during the run.
835Thay will be applied automatically after the reboot.
836
837
838.. code-block:: yaml
839
840 linux:
841 system:
842 sysfs:
843 enable_apply: false
844 scheduler:
845 block/sda/queue/scheduler: deadline
846
847.. note:: The `enable_apply` parameter defaults to `True` if not defined.
848
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100849Huge Pages
850~~~~~~~~~~~~
851
852Huge Pages give a performance boost to applications that intensively deal
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300853with memory allocation/deallocation by decreasing memory fragmentation:
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100854
855.. code-block:: yaml
856
857 linux:
858 system:
859 kernel:
860 hugepages:
861 small:
862 size: 2M
863 count: 107520
864 mount_point: /mnt/hugepages_2MB
Michael Polenchukd9369fe2018-05-08 17:53:08 +0400865 mount: false/true # default is true (mount immediately) / false (just save in the fstab)
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100866 large:
867 default: true # default automatically mounted
868 size: 1G
869 count: 210
870 mount_point: /mnt/hugepages_1GB
871
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300872.. note:: Not recommended to use both pagesizes concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100873
Jakub Pavlik5398d872017-02-13 22:30:47 +0100874Intel SR-IOV
875~~~~~~~~~~~~
876
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300877PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV)
878specification defines a standardized mechanism to virtualize
879PCIe devices. The mechanism can virtualize a single PCIe
880Ethernet controller to appear as multiple PCIe devices:
Jakub Pavlik5398d872017-02-13 22:30:47 +0100881
882.. code-block:: yaml
883
884 linux:
885 system:
886 kernel:
887 sriov: True
888 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
889 rc:
890 local: |
891 #!/bin/sh -e
892 # Enable 7 VF on eth1
893 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
894 exit 0
895
Jakub Pavlik6c9ead12017-02-16 21:53:13 +0100896Isolate CPU options
897~~~~~~~~~~~~~~~~~~~
898
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300899Remove the specified CPUs, as defined by the cpu_number values, from
900the general kernel SMP balancing and scheduler algroithms. The only
901way to move a process onto or off an *isolated* CPU is via the CPU
902affinity syscalls. ``cpu_number begins`` at ``0``, so the
903maximum value is ``1`` less than the number of CPUs on the system.:
Jakub Pavlik6c9ead12017-02-16 21:53:13 +0100904
905.. code-block:: yaml
906
907 linux:
908 system:
909 kernel:
910 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100911
Filip Pytlounf5383a42015-10-06 16:28:32 +0200912Repositories
913~~~~~~~~~~~~
914
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300915RedHat-based Linux with additional OpenStack repo:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200916
917.. code-block:: yaml
918
919 linux:
920 system:
921 ...
922 repo:
923 rdo-icehouse:
924 enabled: true
925 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
926 pgpcheck: 0
927
928Ensure system repository to use czech Debian mirror (``default: true``)
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300929Also pin it's packages with priority ``900``:
Filip Pytlounf5383a42015-10-06 16:28:32 +0200930
931.. code-block:: yaml
932
933 linux:
934 system:
935 repo:
936 debian:
937 default: true
938 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
939 # Import signing key from URL if needed
940 key_url: "http://dummy.com/public.gpg"
941 pin:
942 - pin: 'origin "ftp.cz.debian.org"'
943 priority: 900
944 package: '*'
945
azvyagintsev4494a472018-09-14 19:19:23 +0300946If you need to add multiple pin rules for one repo, please use new,ordered definition format
947('pinning' definition will be in priotity to use):
948
949.. code-block:: yaml
950
951 linux:
952 system:
953 repo:
954 mcp_saltstack:
955 source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main"
956 architectures: amd64
957 clean_file: true
958 pinning:
959 10:
960 enabled: true
961 pin: 'release o=SaltStack'
962 priority: 50
963 package: 'libsodium18'
964 20:
965 enabled: true
966 pin: 'release o=SaltStack'
967 priority: 1100
968 package: '*'
969
970
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300971.. note:: For old Ubuntu releases (<xenial)
azvyagintsevff089d22018-07-27 16:52:34 +0200972 extra packages for apt transport, like ``apt-transport-https``
973 may be required to be installed manually.
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300974 (Chicken-eggs issue: we need to install packages to
azvyagintsevff089d22018-07-27 16:52:34 +0200975 reach repo from where they should be installed)
976 Otherwise, you still can try 'fortune' and install prereq.packages before
977 any repo configuration, using list of requires in map.jinja.
978
979
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300980Disabling any prerequisite packages installation:
981
azvyagintsevff089d22018-07-27 16:52:34 +0200982You can simply drop any package pre-installation (before system.linux.repo
983will be processed) via cluster lvl:
984
985.. code-block:: yaml
986
987 linux:
988 system:
989 pkgs: ~
990
OlgaGusarenko2828f5f2018-07-30 19:37:05 +0300991Package manager proxy global setup:
Petr Michalec10462bb2017-03-23 19:18:08 +0100992
993.. code-block:: yaml
994
995 linux:
996 system:
997 ...
998 repo:
999 apt-mk:
1000 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1001 ...
1002 proxy:
1003 pkg:
1004 enabled: true
1005 ftp: ftp://ftp-proxy-for-apt.host.local:2121
1006 ...
1007 # NOTE: Global defaults for any other componet that configure proxy on the system.
1008 # If your environment has just one simple proxy, set it on linux:system:proxy.
1009 #
1010 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
1011 # as for https and http
1012 ftp: ftp://proxy.host.local:2121
1013 http: http://proxy.host.local:3142
1014 https: https://proxy.host.local:3143
1015
1016Package manager proxy setup per repository:
1017
1018.. code-block:: yaml
1019
1020 linux:
1021 system:
1022 ...
1023 repo:
1024 debian:
1025 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1026 ...
1027 apt-mk:
1028 source: "deb http://apt-mk.mirantis.com/ stable main salt"
1029 # per repository proxy
1030 proxy:
1031 enabled: true
1032 http: http://maas-01:8080
1033 https: http://maas-01:8080
1034 ...
1035 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001036 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +01001037 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
1038 pkg:
1039 enabled: true
1040 ftp: ftp://proxy.host.local:2121
1041 #http: http://proxy.host.local:3142
1042 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001043 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001044 # global system fallback system defaults
1045 ftp: ftp://proxy.host.local:2121
1046 http: http://proxy.host.local:3142
1047 https: https://proxy.host.local:3143
1048
Jiri Broulik34a29b42017-04-25 14:42:54 +02001049Remove all repositories:
1050
1051.. code-block:: yaml
1052
1053 linux:
1054 system:
1055 purge_repos: true
1056
azvyagintsevff089d22018-07-27 16:52:34 +02001057Refresh repositories metada, after configuration:
1058
1059.. code-block:: yaml
1060
1061 linux:
1062 system:
1063 refresh_repos_meta: true
1064
Filip Pytlounc512e6c2017-11-22 14:28:10 +01001065Setup custom apt config options:
1066
1067.. code-block:: yaml
1068
1069 linux:
1070 system:
1071 apt:
1072 config:
1073 compression-workaround:
1074 "Acquire::CompressionTypes::Order": "gz"
1075 docker-clean:
1076 "DPkg::Post-Invoke":
1077 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
1078 "APT::Update::Post-Invoke":
1079 - "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 +02001080
Petr Michalec10462bb2017-03-23 19:18:08 +01001081RC
1082~~
1083
Jakub Pavlik78859382016-01-21 11:26:39 +01001084rc.local example
1085
1086.. code-block:: yaml
1087
1088 linux:
1089 system:
1090 rc:
1091 local: |
1092 #!/bin/sh -e
1093 #
1094 # rc.local
1095 #
1096 # This script is executed at the end of each multiuser runlevel.
1097 # Make sure that the script will "exit 0" on success or any other
1098 # value on error.
1099 #
1100 # In order to enable or disable this script just change the execution
1101 # bits.
1102 #
1103 # By default this script does nothing.
1104 exit 0
1105
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001106Prompt
1107~~~~~~
1108
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001109Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``.
1110Every user can have different prompt:
Filip Pytloun1f40dac2016-01-22 15:52:57 +01001111
1112.. code-block:: yaml
1113
1114 linux:
1115 system:
1116 prompt:
1117 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\\]
1118 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
1119
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001120On Debian systems, to set prompt system-wide, it's necessary to
1121remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``,
1122which comes from ``/etc/skel/.bashrc``. This formula will do
1123this automatically, but will not touch existing user's
1124``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +01001125
Filip Pytlouneef11c12016-03-25 11:00:23 +01001126Bash
1127~~~~
1128
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001129Fix bash configuration to preserve history across sessions
1130like ZSH does by default:
Filip Pytlouneef11c12016-03-25 11:00:23 +01001131
1132.. code-block:: yaml
1133
1134 linux:
1135 system:
1136 bash:
1137 preserve_history: true
1138
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001139Login banner message
1140~~~~~~~~~~~~~~~~~~~~
1141
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001142``/etc/issue`` is a text file which contains a message or system
1143identification to be printed before the login prompt. It may contain
Dmitry Teselkin949398e2018-05-03 15:50:00 +03001144various @char and \char sequences, if supported by the getty-type
1145program employed on the system.
1146
1147Setting logon banner message is easy:
1148
1149.. code-block:: yaml
1150
1151 liunx:
1152 system:
1153 banner:
1154 enabled: true
1155 contents: |
1156 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1157
1158 You must have explicit, authorized permission to access or configure this
1159 device. Unauthorized attempts and actions to access or use this system may
1160 result in civil and/or criminal penalties.
1161 All activities performed on this system are logged and monitored.
1162
Filip Pytloune874dfb2016-01-22 16:57:34 +01001163Message of the day
1164~~~~~~~~~~~~~~~~~~
1165
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001166``pam_motd`` from package ``libpam-modules`` is used for dynamic
1167messages of the day. Setting custom ``motd`` will clean up existing ones.
Filip Pytloune874dfb2016-01-22 16:57:34 +01001168
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001169Setting static ``motd`` will replace existing ``/etc/motd`` and remove
1170scripts from ``/etc/update-motd.d``.
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001171
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001172Setting static ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001173
1174.. code-block:: yaml
1175
1176 linux:
1177 system:
1178 motd: |
1179 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
1180
1181 You must have explicit, authorized permission to access or configure this
1182 device. Unauthorized attempts and actions to access or use this system may
1183 result in civil and/or criminal penalties.
1184 All activities performed on this system are logged and monitored.
1185
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001186Setting dynamic ``motd``:
Dmitry Teselkin538c8242018-04-02 16:13:37 +03001187
Filip Pytloune874dfb2016-01-22 16:57:34 +01001188.. code-block:: yaml
1189
1190 linux:
1191 system:
1192 motd:
1193 - release: |
1194 #!/bin/sh
1195 [ -r /etc/lsb-release ] && . /etc/lsb-release
1196
1197 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
1198 # Fall back to using the very slow lsb_release utility
1199 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
1200 fi
1201
1202 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
1203 - warning: |
1204 #!/bin/sh
1205 printf "This is [company name] network.\n"
1206 printf "Unauthorized access strictly prohibited.\n"
1207
Marek Celoud713e9072017-05-18 15:20:25 +02001208Services
1209~~~~~~~~
1210
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001211Stop and disable the ``linux`` service:
Marek Celoud713e9072017-05-18 15:20:25 +02001212
1213.. code-block:: yaml
1214
1215 linux:
1216 system:
1217 service:
1218 apt-daily.timer:
1219 status: dead
1220
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001221Possible statuses are ``dead`` (disable service by default), ``running``
1222(enable service by default), ``enabled``, ``disabled``:
Marek Celoud713e9072017-05-18 15:20:25 +02001223
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001224Linux with the ``atop`` service:
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +03001225
1226.. code-block:: yaml
1227
1228 linux:
1229 system:
1230 atop:
1231 enabled: true
1232 interval: 20
1233 logpath: "/var/log/atop"
1234 outfile: "/var/log/atop/daily.log"
1235
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001236Linux with the ``mcelog`` service:
Oleksii Chupryn144432b2018-05-22 10:34:48 +03001237
1238.. code-block:: yaml
1239
1240 linux:
1241 system:
1242 mcelog:
1243 enabled: true
1244 logging:
1245 syslog: true
1246 syslog_error: true
1247
Filip Pytloun2f70b492016-02-19 15:55:25 +01001248RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +01001249^^^^^^^^^^^^^
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001250Currently, ``update-motd`` is not available
1251for RHEL. So there is no native support for dynamic ``motd``.
1252You can still set a static one, with a different pillar structure:
Filip Pytloun2f70b492016-02-19 15:55:25 +01001253
1254.. code-block:: yaml
1255
1256 linux:
1257 system:
1258 motd: |
1259 This is [company name] network.
1260 Unauthorized access strictly prohibited.
1261
Filip Pytloun8296bb92016-02-19 18:42:09 +01001262Haveged
1263~~~~~~~
1264
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001265If you are running headless server and are low on entropy,
1266you may set up Haveged:
Filip Pytloun8296bb92016-02-19 18:42:09 +01001267
1268.. code-block:: yaml
1269
1270 linux:
1271 system:
1272 haveged:
1273 enabled: true
1274
Filip Pytlounf5383a42015-10-06 16:28:32 +02001275Linux network
1276-------------
1277
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001278Linux with network manager:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001279
1280.. code-block:: yaml
1281
1282 linux:
1283 network:
1284 enabled: true
1285 network_manager: true
1286
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001287Linux with default static network interfaces, default gateway
1288interface and DNS servers:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001289
1290.. code-block:: yaml
1291
1292 linux:
1293 network:
1294 enabled: true
1295 interface:
1296 eth0:
1297 enabled: true
1298 type: eth
1299 address: 192.168.0.102
1300 netmask: 255.255.255.0
1301 gateway: 192.168.0.1
1302 name_servers:
1303 - 8.8.8.8
1304 - 8.8.4.4
1305 mtu: 1500
1306
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001307Linux with bonded interfaces and disabled ``NetworkManager``:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001308
1309.. code-block:: yaml
1310
1311 linux:
1312 network:
1313 enabled: true
1314 interface:
1315 eth0:
1316 type: eth
1317 ...
1318 eth1:
1319 type: eth
1320 ...
1321 bond0:
1322 enabled: true
1323 type: bond
1324 address: 192.168.0.102
1325 netmask: 255.255.255.0
1326 mtu: 1500
1327 use_in:
1328 - interface: ${linux:interface:eth0}
1329 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +01001330 network_manager:
1331 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001332
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001333Linux with VLAN ``interface_params``:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001334
1335.. code-block:: yaml
1336
1337 linux:
1338 network:
1339 enabled: true
1340 interface:
1341 vlan69:
1342 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001343 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001344 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001345
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001346Linux with wireless interface parameters:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001347
1348.. code-block:: yaml
1349
1350 linux:
1351 network:
1352 enabled: true
1353 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001354 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001355 interface:
1356 wlan0:
1357 type: eth
1358 wireless:
1359 essid: example
1360 key: example_key
1361 security: wpa
1362 priority: 1
1363
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001364Linux networks with routes defined:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001365
1366.. code-block:: yaml
1367
1368 linux:
1369 network:
1370 enabled: true
1371 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001372 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001373 interface:
1374 eth0:
1375 type: eth
1376 route:
1377 default:
1378 address: 192.168.0.123
1379 netmask: 255.255.255.0
1380 gateway: 192.168.0.1
1381
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001382Native Linux Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001383
1384.. code-block:: yaml
1385
1386 linux:
1387 network:
1388 interface:
1389 eth1:
1390 enabled: true
1391 type: eth
1392 proto: manual
1393 up_cmds:
1394 - ip address add 0/0 dev $IFACE
1395 - ip link set $IFACE up
1396 down_cmds:
1397 - ip link set $IFACE down
1398 br-ex:
1399 enabled: true
1400 type: bridge
1401 address: ${linux:network:host:public_local:address}
1402 netmask: 255.255.255.0
1403 use_interfaces:
1404 - eth1
1405
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001406Open vSwitch Bridges:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001407
1408.. code-block:: yaml
1409
1410 linux:
1411 network:
1412 bridge: openvswitch
1413 interface:
1414 eth1:
1415 enabled: true
1416 type: eth
1417 proto: manual
1418 up_cmds:
1419 - ip address add 0/0 dev $IFACE
1420 - ip link set $IFACE up
1421 down_cmds:
1422 - ip link set $IFACE down
1423 br-ex:
1424 enabled: true
1425 type: bridge
1426 address: ${linux:network:host:public_local:address}
1427 netmask: 255.255.255.0
1428 use_interfaces:
1429 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001430 br-prv:
1431 enabled: true
1432 type: ovs_bridge
1433 mtu: 65000
1434 br-ens7:
1435 enabled: true
1436 name: br-ens7
1437 type: ovs_bridge
1438 proto: manual
1439 mtu: 9000
1440 use_interfaces:
1441 - ens7
1442 patch-br-ens7-br-prv:
1443 enabled: true
1444 name: ens7-prv
1445 ovs_type: ovs_port
1446 type: ovs_port
1447 bridge: br-ens7
1448 port_type: patch
1449 peer: prv-ens7
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001450 tag: 109 # [] to unset a tag
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001451 mtu: 65000
1452 patch-br-prv-br-ens7:
1453 enabled: true
1454 name: prv-ens7
1455 bridge: br-prv
1456 ovs_type: ovs_port
1457 type: ovs_port
1458 port_type: patch
1459 peer: ens7-prv
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001460 tag: 109
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001461 mtu: 65000
1462 ens7:
1463 enabled: true
1464 name: ens7
1465 proto: manual
1466 ovs_port_type: OVSPort
1467 type: ovs_port
1468 ovs_bridge: br-ens7
1469 bridge: br-ens7
Filip Pytlounf5383a42015-10-06 16:28:32 +02001470
Petr Jediný8f8ae542017-07-13 16:19:12 +02001471Debian manual proto interfaces
1472
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001473When you are changing interface proto from static in up state
1474to manual, you may need to flush ip addresses. For example,
1475if you want to use the interface and the ip on the bridge.
1476This can be done by setting the ``ipflush_onchange`` to true.
Petr Jediný8f8ae542017-07-13 16:19:12 +02001477
1478.. code-block:: yaml
1479
1480 linux:
1481 network:
1482 interface:
1483 eth1:
1484 enabled: true
1485 type: eth
1486 proto: manual
1487 mtu: 9100
1488 ipflush_onchange: true
1489
Jiri Broulik1a191e32018-01-15 15:54:21 +01001490Debian static proto interfaces
1491
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001492When you are changing interface proto from dhcp in up state to
1493static, you may need to flush ip addresses and restart interface
1494to assign ip address from a managed file. For example, if you wantto
1495use the interface and the ip on the bridge. This can be done by
1496setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
1497param set to true.
Jiri Broulik1a191e32018-01-15 15:54:21 +01001498
1499.. code-block:: yaml
1500
1501 linux:
1502 network:
1503 interface:
1504 eth1:
1505 enabled: true
1506 type: eth
1507 proto: static
1508 address: 10.1.0.22
1509 netmask: 255.255.255.0
1510 ipflush_onchange: true
1511 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001512
Petr Jedinýd577cb52017-06-28 20:17:49 +02001513Concatinating and removing interface files
1514
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001515Debian based distributions have ``/etc/network/interfaces.d/``
1516directory, where you can store configuration of network
1517interfaces in separate files. You can concatinate the files
1518to the defined destination when needed, this operation removes
1519the file from the ``/etc/network/interfaces.d/``. If you just need
1520to remove iface files, you can use the ``remove_iface_files`` key.
Petr Jedinýd577cb52017-06-28 20:17:49 +02001521
1522.. code-block:: yaml
1523
1524 linux:
1525 network:
1526 concat_iface_files:
1527 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1528 dst: '/etc/network/interfaces'
1529 remove_iface_files:
1530 - '/etc/network/interfaces.d/90-custom.cfg'
1531
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001532Configure DHCP client
Petr Jedinýd577cb52017-06-28 20:17:49 +02001533
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001534None of the keys is mandatory, include only those you really need.
1535For full list of available options under send, supersede, prepend,
1536append refer to dhcp-options(5).
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001537
1538.. code-block:: yaml
1539
1540 linux:
1541 network:
1542 dhclient:
1543 enabled: true
1544 backoff_cutoff: 15
1545 initial_interval: 10
1546 reboot: 10
1547 retry: 60
1548 select_timeout: 0
1549 timeout: 120
1550 send:
1551 - option: host-name
1552 declaration: "= gethostname()"
1553 supersede:
1554 - option: host-name
1555 declaration: "spaceship"
1556 - option: domain-name
1557 declaration: "domain.home"
1558 #- option: arp-cache-timeout
1559 # declaration: 20
1560 prepend:
1561 - option: domain-name-servers
1562 declaration:
1563 - 8.8.8.8
1564 - 8.8.4.4
1565 - option: domain-search
1566 declaration:
1567 - example.com
1568 - eng.example.com
1569 #append:
1570 #- option: domain-name-servers
1571 # declaration: 127.0.0.1
1572 # ip or subnet to reject dhcp offer from
1573 reject:
1574 - 192.33.137.209
1575 - 10.0.2.0/24
1576 request:
1577 - subnet-mask
1578 - broadcast-address
1579 - time-offset
1580 - routers
1581 - domain-name
1582 - domain-name-servers
1583 - domain-search
1584 - host-name
1585 - dhcp6.name-servers
1586 - dhcp6.domain-search
1587 - dhcp6.fqdn
1588 - dhcp6.sntp-servers
1589 - netbios-name-servers
1590 - netbios-scope
1591 - interface-mtu
1592 - rfc3442-classless-static-routes
1593 - ntp-servers
1594 require:
1595 - subnet-mask
1596 - domain-name-servers
1597 # if per interface configuration required add below
1598 interface:
1599 ens2:
1600 initial_interval: 11
1601 reject:
1602 - 192.33.137.210
1603 ens3:
1604 initial_interval: 12
1605 reject:
1606 - 192.33.137.211
1607
Petr Michaleceb14b552017-06-01 10:27:05 +02001608Linux network systemd settings:
1609
1610.. code-block:: yaml
1611
1612 linux:
1613 network:
1614 ...
1615 systemd:
1616 link:
1617 10-iface-dmz:
1618 Match:
1619 MACAddress: c8:5b:67:fa:1a:af
1620 OriginalName: eth0
1621 Link:
1622 Name: dmz0
1623 netdev:
1624 20-bridge-dmz:
1625 match:
1626 name: dmz0
1627 network:
1628 mescription: bridge
1629 bridge: br-dmz0
1630 network:
1631 # works with lowercase, keys are by default capitalized
1632 40-dhcp:
1633 match:
1634 name: '*'
1635 network:
1636 DHCP: yes
1637
Petr Michalec10462bb2017-03-23 19:18:08 +01001638Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001639
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001640Use ``/etc/environment`` for static system wide variable assignment
1641after boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001642
1643.. code-block:: yaml
1644
1645 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001646 system:
1647 env:
1648 BOB_VARIABLE: Alice
1649 ...
1650 BOB_PATH:
1651 - /srv/alice/bin
1652 - /srv/bob/bin
1653 ...
1654 ftp_proxy: none
1655 http_proxy: http://global-http-proxy.host.local:8080
1656 https_proxy: ${linux:system:proxy:https}
1657 no_proxy:
1658 - 192.168.0.80
1659 - 192.168.1.80
1660 - .domain.com
1661 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02001662 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001663 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001664 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01001665 ftp: ftp://proxy.host.local:2121
1666 http: http://proxy.host.local:3142
1667 https: https://proxy.host.local:3143
1668 noproxy:
1669 - .domain.com
1670 - .local
1671
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001672Configure the ``profile.d`` scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01001673
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001674The ``profile.d`` scripts are being sourced during ``.sh`` execution
1675and support variable expansion in opposite to /etc/environment global
1676settings in ``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01001677
1678.. code-block:: yaml
1679
1680 linux:
1681 system:
1682 profile:
1683 locales: |
1684 export LANG=C
1685 export LC_ALL=C
1686 ...
1687 vi_flavors.sh: |
1688 export PAGER=view
1689 export EDITOR=vim
1690 alias vi=vim
1691 shell_locales.sh: |
1692 export LANG=en_US
1693 export LC_ALL=en_US.UTF-8
1694 shell_proxies.sh: |
1695 export FTP_PROXY=ftp://127.0.3.3:2121
1696 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02001697
Dmitry Teselkina0d31d12018-09-04 14:43:09 +03001698
1699Configure login.defs parameters
1700-------------------------------
1701
1702.. code-block:: yaml
1703
1704 linux:
1705 system:
1706 login_defs:
1707 <opt_name>:
1708 enabled: true
1709 value: <opt_value>
1710
1711<opt_name> is a configurational option defined in 'man login.defs'.
1712<opt_name> is case sensitive, should be UPPERCASE only!
1713
1714
Filip Pytlounf5383a42015-10-06 16:28:32 +02001715Linux with hosts
1716
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001717Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
1718removing entries that are not defined in model except defaults
1719for both IPv4 and IPv6 localhost and hostname as well as FQDN.
Ales Komarek417e8c52017-08-25 15:10:29 +02001720
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001721We recommend using this option to verify that ``/etc/hosts``
1722is always in a clean state. However it is not enabled by default
1723for security reasons.
Filip Pytloun86506fe2017-01-26 14:36:16 +01001724
Filip Pytlounf5383a42015-10-06 16:28:32 +02001725.. code-block:: yaml
1726
1727 linux:
1728 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001729 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001730 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001731 # No need to define this one if purge_hosts is true
1732 hostname:
1733 address: 127.0.1.1
1734 names:
1735 - ${linux:network:fqdn}
1736 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02001737 node1:
1738 address: 192.168.10.200
1739 names:
1740 - node2.domain.com
1741 - service2.domain.com
1742 node2:
1743 address: 192.168.10.201
1744 names:
1745 - node2.domain.com
1746 - service2.domain.com
1747
Ales Komarek417e8c52017-08-25 15:10:29 +02001748Linux with hosts collected from mine
1749
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001750All DNS records defined within infrastrucuture
1751are passed to the local hosts records or any DNS server. Only
1752hosts with the ``grain`` parameter set to ``true`` will be propagated
1753to the mine.
Ales Komarek417e8c52017-08-25 15:10:29 +02001754
1755.. code-block:: yaml
1756
1757 linux:
1758 network:
1759 purge_hosts: true
1760 mine_dns_records: true
1761 host:
1762 node1:
1763 address: 192.168.10.200
1764 grain: true
1765 names:
1766 - node2.domain.com
1767 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01001768
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001769Set up ``resolv.conf``, nameservers, domain and search domains:
Filip Pytlounde9bea52016-01-11 15:39:10 +01001770
1771.. code-block:: yaml
1772
1773 linux:
1774 network:
1775 resolv:
1776 dns:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001777 - 8.8.4.4
1778 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01001779 domain: my.example.com
1780 search:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001781 - my.example.com
1782 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01001783 options:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001784 - ndots: 5
1785 - timeout: 2
1786 - attempts: 2
Filip Pytlounde9bea52016-01-11 15:39:10 +01001787
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001788Set up custom TX queue length for tap interfaces:
Andrii Petrenko735761d2017-03-21 17:17:35 -07001789
1790.. code-block:: yaml
1791
1792 linux:
1793 network:
1794 tap_custom_txqueuelen: 10000
1795
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001796DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001797
1798**DPDK OVS NIC**
1799
1800.. code-block:: yaml
1801
1802 linux:
1803 network:
1804 bridge: openvswitch
1805 dpdk:
1806 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001807 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001808 openvswitch:
1809 pmd_cpu_mask: "0x6"
1810 dpdk_socket_mem: "1024,1024"
1811 dpdk_lcore_mask: "0x400"
1812 memory_channels: 2
1813 interface:
1814 dpkd0:
1815 name: ${_param:dpdk_nic}
1816 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001817 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001818 enabled: true
1819 type: dpdk_ovs_port
1820 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001821 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001822 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01001823 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001824 br-prv:
1825 enabled: true
1826 type: dpdk_ovs_bridge
1827
1828**DPDK OVS Bond**
1829
1830.. code-block:: yaml
1831
1832 linux:
1833 network:
1834 bridge: openvswitch
1835 dpdk:
1836 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001837 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001838 openvswitch:
1839 pmd_cpu_mask: "0x6"
1840 dpdk_socket_mem: "1024,1024"
1841 dpdk_lcore_mask: "0x400"
1842 memory_channels: 2
1843 interface:
1844 dpdk_second_nic:
1845 name: ${_param:primary_second_nic}
1846 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001847 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001848 bond: dpdkbond0
1849 enabled: true
1850 type: dpdk_ovs_port
1851 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001852 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001853 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001854 dpdk_first_nic:
1855 name: ${_param:primary_first_nic}
1856 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001857 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001858 bond: dpdkbond0
1859 enabled: true
1860 type: dpdk_ovs_port
1861 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001862 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001863 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001864 dpdkbond0:
1865 enabled: true
1866 bridge: br-prv
1867 type: dpdk_ovs_bond
1868 mode: active-backup
1869 br-prv:
1870 enabled: true
1871 type: dpdk_ovs_bridge
1872
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01001873**DPDK OVS LACP Bond with vlan tag**
1874
1875.. code-block:: yaml
1876
1877 linux:
1878 network:
1879 bridge: openvswitch
1880 dpdk:
1881 enabled: true
1882 driver: uio
1883 openvswitch:
1884 pmd_cpu_mask: "0x6"
1885 dpdk_socket_mem: "1024,1024"
1886 dpdk_lcore_mask: "0x400"
1887 memory_channels: "2"
1888 interface:
1889 eth3:
1890 enabled: true
1891 type: eth
1892 proto: manual
1893 name: ${_param:tenant_first_nic}
1894 eth4:
1895 enabled: true
1896 type: eth
1897 proto: manual
1898 name: ${_param:tenant_second_nic}
1899 dpdk0:
1900 name: ${_param:tenant_first_nic}
1901 pci: "0000:81:00.0"
1902 driver: igb_uio
1903 bond: bond1
1904 enabled: true
1905 type: dpdk_ovs_port
1906 n_rxq: 2
1907 dpdk1:
1908 name: ${_param:tenant_second_nic}
1909 pci: "0000:81:00.1"
1910 driver: igb_uio
1911 bond: bond1
1912 enabled: true
1913 type: dpdk_ovs_port
1914 n_rxq: 2
1915 bond1:
1916 enabled: true
1917 bridge: br-prv
1918 type: dpdk_ovs_bond
1919 mode: balance-slb
1920 br-prv:
1921 enabled: true
1922 type: dpdk_ovs_bridge
1923 tag: ${_param:tenant_vlan}
1924 address: ${_param:tenant_address}
1925 netmask: ${_param:tenant_network_netmask}
1926
Jakub Pavlikaa759062017-03-13 15:57:26 +01001927**DPDK OVS bridge for VXLAN**
1928
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001929If VXLAN is used as tenant segmentation, IP address must
1930be set on ``br-prv``.
Jakub Pavlikaa759062017-03-13 15:57:26 +01001931
1932.. code-block:: yaml
1933
1934 linux:
1935 network:
1936 ...
1937 interface:
1938 br-prv:
1939 enabled: true
1940 type: dpdk_ovs_bridge
1941 address: 192.168.50.0
1942 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04001943 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01001944 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001945
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02001946**DPDK OVS bridge with Linux network interface**
1947
1948.. code-block:: yaml
1949
1950 linux:
1951 network:
1952 ...
1953 interface:
1954 eth0:
1955 type: eth
1956 ovs_bridge: br-prv
1957 ...
1958 br-prv:
1959 enabled: true
1960 type: dpdk_ovs_bridge
1961 ...
1962
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001963Linux storage
1964-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02001965
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001966Linux with mounted Samba:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001967
1968.. code-block:: yaml
1969
1970 linux:
1971 storage:
1972 enabled: true
1973 mount:
1974 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01001975 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001976 - path: /media/myuser/public/
1977 - device: //192.168.0.1/storage
1978 - file_system: cifs
1979 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
1980
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001981NFS mount:
Jiri Broulikb017f932017-03-31 13:55:36 +02001982
1983.. code-block:: yaml
1984
1985 linux:
1986 storage:
1987 enabled: true
1988 mount:
1989 nfs_glance:
1990 enabled: true
1991 path: /var/lib/glance/images
1992 device: 172.16.10.110:/var/nfs/glance
1993 file_system: nfs
1994 opts: rw,sync
1995
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03001996File swap configuration:
Filip Pytlounf5383a42015-10-06 16:28:32 +02001997
1998.. code-block:: yaml
1999
2000 linux:
2001 storage:
2002 enabled: true
2003 swap:
2004 file:
2005 enabled: true
2006 engine: file
2007 device: /swapfile
2008 size: 1024
2009
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002010Partition swap configuration:
Lachlan Evenson30676512016-01-22 15:43:28 -08002011
2012.. code-block:: yaml
2013
2014 linux:
2015 storage:
2016 enabled: true
2017 swap:
2018 partition:
2019 enabled: true
2020 engine: partition
2021 device: /dev/vg0/swap
2022
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002023LVM group ``vg1`` with one device and ``data`` volume mounted
2024into ``/mnt/data``.
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002025
2026.. code-block:: yaml
2027
2028 parameters:
2029 linux:
2030 storage:
2031 mount:
2032 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01002033 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01002034 device: /dev/vg1/data
2035 file_system: ext4
2036 path: /mnt/data
2037 lvm:
2038 vg1:
2039 enabled: true
2040 devices:
2041 - /dev/sdb
2042 volume:
2043 data:
2044 size: 40G
2045 mount: ${linux:storage:mount:data}
2046
Jakub Pavlik4f742142017-08-08 15:05:50 +02002047Create partitions on disk. Specify size in MB. It expects empty
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002048disk without any existing partitions.
2049Set ``startsector=1`` if you want to start partitions from ``2048``.
Jakub Pavlik4f742142017-08-08 15:05:50 +02002050
2051.. code-block:: yaml
2052
2053 linux:
2054 storage:
2055 disk:
2056 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01002057 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02002058 name: /dev/loop1
2059 type: gpt
2060 partitions:
2061 - size: 200 #size in MB
2062 type: fat32
2063 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02002064 mkfs: True
2065 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02002066 /dev/vda1:
2067 partitions:
2068 - size: 5
2069 type: ext2
2070 - size: 10
2071 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02002072
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002073Multipath with Fujitsu Eternus DXL:
Ales Komareka634f4b2016-10-02 13:11:04 +02002074
2075.. code-block:: yaml
2076
2077 parameters:
2078 linux:
2079 storage:
2080 multipath:
2081 enabled: true
2082 blacklist_devices:
2083 - /dev/sda
2084 - /dev/sdb
2085 backends:
2086 - fujitsu_eternus_dxl
2087
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002088Multipath with Hitachi VSP 1000:
Ales Komareka634f4b2016-10-02 13:11:04 +02002089
2090.. code-block:: yaml
2091
2092 parameters:
2093 linux:
2094 storage:
2095 multipath:
2096 enabled: true
2097 blacklist_devices:
2098 - /dev/sda
2099 - /dev/sdb
2100 backends:
2101 - hitachi_vsp1000
2102
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002103Multipath with IBM Storwize:
Ales Komareka634f4b2016-10-02 13:11:04 +02002104
2105.. code-block:: yaml
2106
2107 parameters:
2108 linux:
2109 storage:
2110 multipath:
2111 enabled: true
2112 blacklist_devices:
2113 - /dev/sda
2114 - /dev/sdb
2115 backends:
2116 - ibm_storwize
2117
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002118Multipath with multiple backends:
Ales Komareka634f4b2016-10-02 13:11:04 +02002119
2120.. code-block:: yaml
2121
2122 parameters:
2123 linux:
2124 storage:
2125 multipath:
2126 enabled: true
2127 blacklist_devices:
2128 - /dev/sda
2129 - /dev/sdb
2130 - /dev/sdc
2131 - /dev/sdd
2132 backends:
2133 - ibm_storwize
2134 - fujitsu_eternus_dxl
2135 - hitachi_vsp1000
2136
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002137PAM LDAP integration:
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002138
2139.. code-block:: yaml
2140
2141 parameters:
2142 linux:
2143 system:
2144 auth:
2145 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02002146 mkhomedir:
2147 enabled: true
2148 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03002149 ldap:
2150 enabled: true
2151 binddn: cn=bind,ou=service_users,dc=example,dc=com
2152 bindpw: secret
2153 uri: ldap://127.0.0.1
2154 base: ou=users,dc=example,dc=com
2155 ldap_version: 3
2156 pagesize: 65536
2157 referrals: off
2158 filter:
2159 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2160 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
2161 group: (&(objectClass=group)(gidNumber=*))
2162
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002163Disabled multipath (the default setup):
Ales Komareka634f4b2016-10-02 13:11:04 +02002164
2165.. code-block:: yaml
2166
2167 parameters:
2168 linux:
2169 storage:
2170 multipath:
2171 enabled: false
2172
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002173Linux with local loopback device:
Simon Pasquier375001e2017-01-26 13:22:33 +01002174
2175.. code-block:: yaml
2176
2177 linux:
2178 storage:
2179 loopback:
2180 disk1:
2181 file: /srv/disk1
2182 size: 50G
2183
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002184External config generation
2185--------------------------
2186
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002187You are able to use config support metadata between formulas
2188and only generate configuration files for external use, for example, Docker, and so on.
Filip Pytlounb2c8f852016-11-21 17:03:43 +01002189
2190.. code-block:: yaml
2191
2192 parameters:
2193 linux:
2194 system:
2195 config:
2196 pillar:
2197 jenkins:
2198 master:
2199 home: /srv/volumes/jenkins
2200 approved_scripts:
2201 - method java.net.URL openConnection
2202 credentials:
2203 - type: username_password
2204 scope: global
2205 id: test
2206 desc: Testing credentials
2207 username: test
2208 password: test
2209
Vladimir Ereminccf28842017-04-10 23:52:10 +03002210Netconsole Remote Kernel Logging
2211--------------------------------
2212
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002213Netconsole logger can be configured for the configfs-enabled kernels
2214(``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
2215applies both in runtime (if network is already configured),
2216and on-boot after an interface initialization.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002217
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002218.. note::
2219
2220 * Receiver can be located only on the same L3 domain
2221 (or you need to configure gateway MAC manually).
2222 * The Receiver MAC is detected only on configuration time.
2223 * Using broadcast MAC is not recommended.
Vladimir Ereminccf28842017-04-10 23:52:10 +03002224
2225.. code-block:: yaml
2226
2227 parameters:
2228 linux:
2229 system:
2230 netconsole:
2231 enabled: true
2232 port: 514 (optional)
2233 loglevel: debug (optional)
2234 target:
2235 192.168.0.1:
2236 interface: bond0
2237 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02002238
Dzmitry Stremkouskid1a268b2018-10-03 16:36:04 +02002239Check network params on the environment
2240---------------------------------------
2241
2242Grab nics and nics states
2243
2244.. code-block:: bash
2245
2246 salt osd001\* net_checks.get_nics
2247
2248**Example of system output:**
2249
2250.. code-block:: bash
2251
2252 osd001.domain.com:
2253 |_
2254 - bond0
2255 - None
2256 - 1e:c8:64:42:23:b9
2257 - 0
2258 - 1500
2259 |_
2260 - bond1
2261 - None
2262 - 3c:fd:fe:27:3b:00
2263 - 1
2264 - 9100
2265 |_
2266 - fourty1
2267 - None
2268 - 3c:fd:fe:27:3b:00
2269 - 1
2270 - 9100
2271 |_
2272 - fourty2
2273 - None
2274 - 3c:fd:fe:27:3b:02
2275 - 1
2276 - 9100
2277
2278Grab 10G nics PCI addresses for hugepages setup
2279
2280.. code-block:: bash
2281
2282 salt cmp001\* net_checks.get_ten_pci
2283
2284**Example of system output:**
2285
2286.. code-block:: bash
2287
2288 cmp001.domain.com:
2289 |_
2290 - ten1
2291 - 0000:19:00.0
2292 |_
2293 - ten2
2294 - 0000:19:00.1
2295 |_
2296 - ten3
2297 - 0000:19:00.2
2298 |_
2299 - ten4
2300 - 0000:19:00.3
2301
2302Grab ip address for an interface
2303
2304.. code-block:: bash
2305
2306 salt cmp001\* net_checks.get_ip iface=one4
2307
2308**Example of system output:**
2309
2310.. code-block:: bash
2311
2312 cmp001.domain.com:
2313 10.200.177.101
2314
2315Grab ip addresses map
2316
2317.. code-block:: bash
2318
2319 salt-call net_checks.nodes_addresses
2320
2321**Example of system output:**
2322
2323.. code-block:: bash
2324
2325 local:
2326 |_
2327 - cid01.domain.com
2328 |_
2329 |_
2330 - pxe
2331 - 10.200.177.91
2332 |_
2333 - control
2334 - 10.200.178.91
2335 |_
2336 - cmn02.domain.com
2337 |_
2338 |_
2339 - storage_access
2340 - 10.200.181.67
2341 |_
2342 - pxe
2343 - 10.200.177.67
2344 |_
2345 - control
2346 - 10.200.178.67
2347 |_
2348 - cmp010.domain.com
2349 |_
2350 |_
2351 - pxe
2352 - 10.200.177.110
2353 |_
2354 - storage_access
2355 - 10.200.181.110
2356 |_
2357 - control
2358 - 10.200.178.110
2359 |_
2360 - vxlan
2361 - 10.200.179.110
2362
2363Verify full mesh connectivity
2364
2365.. code-block:: bash
2366
2367 salt-call net_checks.ping_check
2368
2369**Example of positive system output:**
2370
2371.. code-block:: bash
2372
2373 ['PASSED']
2374 [INFO ] ['PASSED']
2375 local:
2376 True
2377
2378**Example of system output in case of failure:**
2379
2380.. code-block:: bash
2381
2382 FAILED
2383 [ERROR ] FAILED
2384 ['control: 10.0.1.92 -> 10.0.1.224: Failed']
2385 ['control: 10.0.1.93 -> 10.0.1.224: Failed']
2386 ['control: 10.0.1.51 -> 10.0.1.224: Failed']
2387 ['control: 10.0.1.102 -> 10.0.1.224: Failed']
2388 ['control: 10.0.1.13 -> 10.0.1.224: Failed']
2389 ['control: 10.0.1.81 -> 10.0.1.224: Failed']
2390 local:
2391 False
2392
2393For this feature to work, please mark addresses with some role.
2394Otherwise 'default' role is assumed and mesh would consist of all
2395addresses on the environment.
2396
2397Mesh mark is needed only for interfaces which are enabled and have
2398ip address assigned.
2399
2400Checking dhcp pxe network meaningless, as it is used for salt
2401master vs minion communications, therefore treated as checked.
2402
2403.. code-block:: yaml
2404
2405 parameters:
2406 linux:
2407 network:
2408 interface:
2409 ens3:
2410 enabled: true
2411 type: eth
2412 proto: static
2413 address: ${_param:deploy_address}
2414 netmask: ${_param:deploy_network_netmask}
2415 gateway: ${_param:deploy_network_gateway}
2416 mesh: pxe
2417
2418Check pillars for ip address duplicates
2419
2420.. code-block:: bash
2421
2422 salt-call net_checks.verify_addresses
2423
2424**Example of positive system output:**
2425
2426.. code-block:: bash
2427
2428 ['PASSED']
2429 [INFO ] ['PASSED']
2430 local:
2431 True
2432
2433**Example of system output in case of failure:**
2434
2435.. code-block:: bash
2436
2437 FAILED. Duplicates found
2438 [ERROR ] FAILED. Duplicates found
2439 ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2440 [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
2441 local:
2442 False
2443
2444Generate csv report for the env
2445
2446.. code-block:: bash
2447
2448 salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
2449 | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
2450 | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
2451
2452**Example of system output:**
2453
2454.. code-block:: bash
2455
2456 server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
2457 cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
2458 cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
2459 cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
2460 cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
2461 cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
2462 cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
2463 cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
2464 cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
2465 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
2466 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
2467 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
2468 cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
2469 cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
2470 cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
2471 ...
2472
Filip Pytlounf5383a42015-10-06 16:28:32 +02002473Usage
2474=====
2475
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002476Set MTU of the eth0 network interface to 1400:
Filip Pytlounf5383a42015-10-06 16:28:32 +02002477
2478.. code-block:: bash
2479
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002480 ip link set dev eth0 mtu 1400
Filip Pytlounf5383a42015-10-06 16:28:32 +02002481
2482Read more
2483=========
2484
2485* https://www.archlinux.org/
2486* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
Filip Pytloun018f8712017-02-02 13:02:03 +01002487
2488Documentation and Bugs
2489======================
2490
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002491* http://salt-formulas.readthedocs.io/
2492 Learn how to install and update salt-formulas.
Filip Pytloun018f8712017-02-02 13:02:03 +01002493
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002494* https://github.com/salt-formulas/salt-formula-linux/issues
2495 In the unfortunate event that bugs are discovered, report the issue to the
2496 appropriate issue tracker. Use the Github issue tracker for a specific salt
2497 formula.
Filip Pytloun018f8712017-02-02 13:02:03 +01002498
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002499* https://launchpad.net/salt-formulas
2500 For feature requests, bug reports, or blueprints affecting the entire
2501 ecosystem, use the Launchpad salt-formulas project.
Filip Pytloun018f8712017-02-02 13:02:03 +01002502
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002503* https://launchpad.net/~salt-formulas-users
2504 Join the salt-formulas-users team and subscribe to mailing list if required.
Filip Pytloun018f8712017-02-02 13:02:03 +01002505
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002506* https://github.com/salt-formulas/salt-formula-linux
2507 Develop the salt-formulas projects in the master branch and then submit pull
2508 requests against a specific formula.
Filip Pytloun018f8712017-02-02 13:02:03 +01002509
OlgaGusarenko2828f5f2018-07-30 19:37:05 +03002510* #salt-formulas @ irc.freenode.net
2511 Use this IRC channel in case of any questions or feedback which is always
2512 welcome.
Filip Pytloun018f8712017-02-02 13:02:03 +01002513