blob: 86f870fe4a8c4ece27ef0f77a3f4aa75a84a1de0 [file] [log] [blame]
Aleš Komárek63572992017-04-11 13:16:44 +02001============
2Linux Fomula
3============
Filip Pytlounf5383a42015-10-06 16:28:32 +02004
5Linux Operating Systems.
6
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 +020016
17Linux System
Filip Pytlounf5383a42015-10-06 16:28:32 +020018------------
19
20Basic Linux box
21
22.. code-block:: yaml
23
24 linux:
25 system:
26 enabled: true
27 name: 'node1'
28 domain: 'domain.com'
29 cluster: 'system'
30 environment: prod
31 timezone: 'Europe/Prague'
32 utc: true
33
azvyagintsev967af132017-06-12 12:25:24 +030034Linux with system users, some with password set:
35.. WARNING::
36If no 'password' variable has been passed - any predifined password
37will be removed.
Filip Pytlounf5383a42015-10-06 16:28:32 +020038
39.. code-block:: yaml
40
41 linux:
42 system:
43 ...
44 user:
45 jdoe:
46 name: 'jdoe'
47 enabled: true
48 sudo: true
49 shell: /bin/bash
50 full_name: 'Jonh Doe'
51 home: '/home/jdoe'
Martin Polreich4fcd5c02018-07-16 09:41:51 +020052 home_dir_mode: 755
Filip Pytlounf5383a42015-10-06 16:28:32 +020053 email: 'jonh@doe.com'
54 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
Petr Michalec1c4c8d82017-02-28 19:09:21 +010074Configure sudo for users and groups under ``/etc/sudoers.d/``.
75This ways ``linux.system.sudo`` pillar map to actual sudo attributes:
76
77.. code-block:: jinja
Aleš Komárek63572992017-04-11 13:16:44 +020078
Petr Michalec1c4c8d82017-02-28 19:09:21 +010079 # simplified template:
80 Cmds_Alias {{ alias }}={{ commands }}
81 {{ user }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
82 %{{ group }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
83
84 # when rendered:
85 saltuser1 ALL=(ALL) NOPASSWD: ALL
86
Petr Michalec1c4c8d82017-02-28 19:09:21 +010087.. code-block:: yaml
Aleš Komárek63572992017-04-11 13:16:44 +020088
Petr Michalec1c4c8d82017-02-28 19:09:21 +010089 linux:
90 system:
91 sudo:
92 enabled: true
Tomas Kammd8eb3002017-05-08 19:30:29 +020093 aliases:
Petr Michalec1c4c8d82017-02-28 19:09:21 +010094 host:
95 LOCAL:
96 - localhost
97 PRODUCTION:
98 - db1
99 - db2
100 runas:
101 DBA:
102 - postgres
103 - mysql
104 SALT:
105 - root
106 command:
107 # Note: This is not 100% safe when ALL keyword is used, user still may modify configs and hide his actions.
108 # Best practice is to specify full list of commands user is allowed to run.
109 SUPPORT_RESTRICTED:
110 - /bin/vi /etc/sudoers*
111 - /bin/vim /etc/sudoers*
112 - /bin/nano /etc/sudoers*
113 - /bin/emacs /etc/sudoers*
114 - /bin/su - root
115 - /bin/su -
116 - /bin/su
117 - /usr/sbin/visudo
118 SUPPORT_SHELLS:
119 - /bin/sh
120 - /bin/ksh
121 - /bin/bash
122 - /bin/rbash
123 - /bin/dash
124 - /bin/zsh
125 - /bin/csh
126 - /bin/fish
127 - /bin/tcsh
128 - /usr/bin/login
129 - /usr/bin/su
130 - /usr/su
131 ALL_SALT_SAFE:
132 - /usr/bin/salt state*
133 - /usr/bin/salt service*
134 - /usr/bin/salt pillar*
135 - /usr/bin/salt grains*
136 - /usr/bin/salt saltutil*
137 - /usr/bin/salt-call state*
138 - /usr/bin/salt-call service*
139 - /usr/bin/salt-call pillar*
140 - /usr/bin/salt-call grains*
141 - /usr/bin/salt-call saltutil*
142 SALT_TRUSTED:
143 - /usr/bin/salt*
144 users:
145 # saltuser1 with default values: saltuser1 ALL=(ALL) NOPASSWD: ALL
146 saltuser1: {}
147 saltuser2:
148 hosts:
149 - LOCAL
150 # User Alias DBA
151 DBA:
152 hosts:
153 - ALL
154 commands:
155 - ALL_SALT_SAFE
156 groups:
157 db-ops:
158 hosts:
159 - ALL
160 - '!PRODUCTION'
161 runas:
162 - DBA
163 commands:
164 - /bin/cat *
165 - /bin/less *
166 - /bin/ls *
167 salt-ops:
168 hosts:
169 - 'ALL'
170 runas:
171 - SALT
172 commands:
173 - SUPPORT_SHELLS
174 salt-ops-2nd:
175 name: salt-ops
176 nopasswd: false
Jakub Josef7a9d9b92017-05-16 11:39:01 +0200177 setenv: true # Enable sudo -E option
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100178 runas:
179 - DBA
180 commands:
181 - ALL
182 - '!SUPPORT_SHELLS'
183 - '!SUPPORT_RESTRICTED'
184
Filip Pytlounf5383a42015-10-06 16:28:32 +0200185Linux with package, latest version
186
187.. code-block:: yaml
188
189 linux:
190 system:
191 ...
192 package:
193 package-name:
194 version: latest
195
196Linux with package from certail repo, version with no upgrades
197
198.. code-block:: yaml
199
200 linux:
201 system:
202 ...
203 package:
204 package-name:
205 version: 2132.323
206 repo: 'custom-repo'
207 hold: true
208
209Linux with package from certail repo, version with no GPG verification
210
211.. code-block:: yaml
212
213 linux:
214 system:
215 ...
216 package:
217 package-name:
218 version: 2132.323
219 repo: 'custom-repo'
220 verify: false
221
Bruno Binet69a9d8d2017-02-16 22:34:32 +0100222Linux with autoupdates (automatically install security package updates)
223
224.. code-block:: yaml
225
226 linux:
227 system:
228 ...
229 autoupdates:
230 enabled: true
231 mail: root@localhost
232 mail_only_on_error: true
233 remove_unused_dependencies: false
234 automatic_reboot: true
235 automatic_reboot_time: "02:00"
236
Filip Pytlounf5383a42015-10-06 16:28:32 +0200237Linux with cron jobs
Filip Pytloun91222222017-08-04 10:55:27 +0200238By default it will use name as an identifier, unless identifier key is
239explicitly set or False (then it will use Salt's default behavior which is
240identifier same as command resulting in not being able to change it)
Filip Pytlounf5383a42015-10-06 16:28:32 +0200241
242.. code-block:: yaml
243
244 linux:
245 system:
246 ...
247 job:
248 cmd1:
249 command: '/cmd/to/run'
Filip Pytloun91222222017-08-04 10:55:27 +0200250 identifier: cmd1
Filip Pytlounf5383a42015-10-06 16:28:32 +0200251 enabled: true
252 user: 'root'
253 hour: 2
254 minute: 0
255
Filip Pytlound0a29e72015-11-30 15:23:34 +0100256Linux security limits (limit sensu user memory usage to max 1GB):
257
258.. code-block:: yaml
259
260 linux:
261 system:
262 ...
263 limit:
264 sensu:
265 enabled: true
266 domain: sensu
267 limits:
268 - type: hard
269 item: as
270 value: 1000000
271
Filip Pytloun7fee0542015-10-15 11:19:24 +0200272Enable autologin on tty1 (may work only for Ubuntu 14.04):
273
274.. code-block:: yaml
275
276 linux:
277 system:
278 console:
279 tty1:
280 autologin: root
Filip Pytloun281d0202016-01-29 14:03:51 +0100281 # Enable serial console
282 ttyS0:
283 autologin: root
284 rate: 115200
285 term: xterm
Filip Pytloun7fee0542015-10-15 11:19:24 +0200286
287To disable set autologin to `false`.
288
Filip Pytloun7731b852016-02-01 11:13:47 +0100289Set ``policy-rc.d`` on Debian-based systems. Action can be any available
290command in ``while true`` loop and ``case`` context.
291Following will disallow dpkg to stop/start services for cassandra package automatically:
292
293.. code-block:: yaml
294
295 linux:
296 system:
297 policyrcd:
298 - package: cassandra
299 action: exit 101
300 - package: '*'
301 action: switch
302
Filip Pytlounc49445a2016-04-04 14:23:20 +0200303Set system locales:
304
305.. code-block:: yaml
306
307 linux:
308 system:
309 locale:
310 en_US.UTF-8:
311 default: true
Filip Pytlounee1745f2016-04-04 17:39:41 +0200312 "cs_CZ.UTF-8 UTF-8":
Filip Pytlounc49445a2016-04-04 14:23:20 +0200313 enabled: true
314
Andrey Shestakove7cca052017-05-24 23:06:24 +0300315Systemd settings:
316
317.. code-block:: yaml
318
319 linux:
320 system:
321 ...
322 systemd:
323 system:
324 Manager:
325 DefaultLimitNOFILE: 307200
326 DefaultLimitNPROC: 307200
327 user:
328 Manager:
329 DefaultLimitCPU: 2
330 DefaultLimitNPROC: 4
331
Filip Pytloun8b2131e2017-11-08 13:29:03 +0100332Ensure presence of directory:
333
334.. code-block:: yaml
335
336 linux:
337 system:
338 directory:
339 /tmp/test:
340 user: root
341 group: root
342 mode: 700
343 makedirs: true
344
Richard Felkl2e07d652018-01-19 10:19:06 +0100345Ensure presence of file by specifying it's source:
346
347.. code-block:: yaml
348
349 linux:
350 system:
351 file:
352 /tmp/test.txt:
353 source: http://example.com/test.txt
Richard Felklf40599a2018-02-06 22:56:41 +0100354 user: root #optional
355 group: root #optional
356 mode: 700 #optional
357 dir_mode: 700 #optional
358 encoding: utf-8 #optional
359 hash: <<hash>> or <<URI to hash>> #optional
360 makedirs: true #optional
361
362 linux:
363 system:
364 file:
365 test.txt:
366 name: /tmp/test.txt
367 source: http://example.com/test.txt
Richard Felkl2e07d652018-01-19 10:19:06 +0100368
369Ensure presence of file by specifying it's contents:
370
371.. code-block:: yaml
372
373 linux:
374 system:
375 file:
376 /tmp/test.txt:
377 contents: |
378 line1
379 line2
Richard Felklf40599a2018-02-06 22:56:41 +0100380
381 linux:
382 system:
383 file:
384 /tmp/test.txt:
385 contents_pillar: linux:network:hostname
386
387 linux:
388 system:
389 file:
390 /tmp/test.txt:
391 contents_grains: motd
392
Bruno Binet9c2fe222018-06-08 16:57:32 +0200393Ensure presence of file to be serialized through one of the serializer modules
394(see: https://docs.saltstack.com/en/latest/ref/serializers/all/index.html):
395
396.. code-block:: yaml
397
398 linux:
399 system:
400 file:
401 /tmp/test.json:
402 serialize: json
403 contents:
404 foo: 1
405 bar: 'bar'
406
Filip Pytloun281034a2016-01-04 18:06:22 +0100407Kernel
408~~~~~~
409
410Install always up to date LTS kernel and headers from Ubuntu trusty:
411
412.. code-block:: yaml
413
414 linux:
415 system:
416 kernel:
417 type: generic
418 lts: trusty
419 headers: true
420
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100421Load kernel modules and add them to `/etc/modules`:
422
423.. code-block:: yaml
424
425 linux:
426 system:
427 kernel:
428 modules:
429 - nf_conntrack
430 - tp_smapi
431 - 8021q
432
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200433Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300434will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`:
435
436.. code-block:: yaml
437
438 linux:
439 system:
440 kernel:
441 module:
442 nf_conntrack:
443 option:
444 hashsize: 262144
445
446
447
Filip Pytloun281034a2016-01-04 18:06:22 +0100448Install specific kernel version and ensure all other kernel packages are
449not present. Also install extra modules and headers for this kernel:
450
451.. code-block:: yaml
452
453 linux:
454 system:
455 kernel:
456 type: generic
457 extra: true
458 headers: true
459 version: 4.2.0-22
460
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100461Systcl kernel parameters
462
463.. code-block:: yaml
464
465 linux:
466 system:
467 kernel:
468 sysctl:
469 net.ipv4.tcp_keepalive_intvl: 3
470 net.ipv4.tcp_keepalive_time: 30
471 net.ipv4.tcp_keepalive_probes: 8
472
Michael Polenchukebf55522018-01-25 13:22:39 +0400473Configure kernel boot options:
474
475.. code-block:: yaml
476
477 linux:
478 system:
479 kernel:
480 boot_options:
481 - elevator=deadline
482 - spectre_v2=off
483 - nopti
484
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100485
486CPU
487~~~
488
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300489Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100490
491.. code-block:: yaml
492
493 linux:
494 system:
495 cpu:
496 governor: performance
497
Nick Metzf04f5f32018-01-08 15:25:04 +0100498
Jiri Broulik303905d2018-01-11 14:12:48 +0100499CGROUPS
500~~~~~~~
501
502Setup linux cgroups:
503
504.. code-block:: yaml
505
506 linux:
507 system:
508 cgroup:
509 enabled: true
510 group:
511 ceph_group_1:
512 controller:
513 cpu:
514 shares:
515 value: 250
516 cpuacct:
517 usage:
518 value: 0
519 cpuset:
520 cpus:
521 value: 1,2,3
522 memory:
523 limit_in_bytes:
524 value: 2G
525 memsw.limit_in_bytes:
526 value: 3G
527 mapping:
528 subjects:
529 - '@ceph'
530 generic_group_1:
531 controller:
532 cpu:
533 shares:
534 value: 250
535 cpuacct:
536 usage:
537 value: 0
538 mapping:
539 subjects:
540 - '*:firefox'
541 - 'student:cp'
542
543
Nick Metzf04f5f32018-01-08 15:25:04 +0100544Shared Libraries
545~~~~~~~~~~~~~~~~
546
547Set additional shared library to Linux system library path
548
549.. code-block:: yaml
550
551 linux:
552 system:
553 ld:
554 library:
555 java:
556 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
557 - /opt/java/jre/lib/amd64/server
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200558
Nick Metzf04f5f32018-01-08 15:25:04 +0100559
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200560Certificates
561~~~~~~~~~~~~
562
563Add certificate authority into system trusted CA bundle
564
565.. code-block:: yaml
566
567 linux:
568 system:
569 ca_certificates:
570 mycert: |
571 -----BEGIN CERTIFICATE-----
572 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
573 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
574 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
575 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
576 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
577 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
578 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
579 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
580 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
581 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
582 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
583 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
584 -----END CERTIFICATE-----
585
Filip Pytloun361096c2017-08-23 10:57:20 +0200586Sysfs
587~~~~~
588
589Install sysfsutils and set sysfs attributes:
590
591.. code-block:: yaml
592
593 linux:
594 system:
595 sysfs:
596 scheduler:
597 block/sda/queue/scheduler: deadline
598 power:
599 mode:
600 power/state: 0660
601 owner:
602 power/state: "root:power"
603 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
604
Ondrej Smolaef9bd762018-07-11 14:26:02 +0200605Optional: You can also use list that will ensure order of items.
606
607.. code-block:: yaml
608
609 linux:
610 system:
611 sysfs:
612 scheduler:
613 block/sda/queue/scheduler: deadline
614 power:
615 - mode:
616 power/state: 0660
617 - owner:
618 power/state: "root:power"
619 - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
620
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100621Huge Pages
622~~~~~~~~~~~~
623
624Huge Pages give a performance boost to applications that intensively deal
625with memory allocation/deallocation by decreasing memory fragmentation.
626
627.. code-block:: yaml
628
629 linux:
630 system:
631 kernel:
632 hugepages:
633 small:
634 size: 2M
635 count: 107520
636 mount_point: /mnt/hugepages_2MB
Michael Polenchukd9369fe2018-05-08 17:53:08 +0400637 mount: false/true # default is true (mount immediately) / false (just save in the fstab)
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100638 large:
639 default: true # default automatically mounted
640 size: 1G
641 count: 210
642 mount_point: /mnt/hugepages_1GB
643
644Note: not recommended to use both pagesizes in concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100645
Jakub Pavlik5398d872017-02-13 22:30:47 +0100646Intel SR-IOV
647~~~~~~~~~~~~
648
649PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV) specification defines a standardized mechanism to virtualize PCIe devices. The mechanism can virtualize a single PCIe Ethernet controller to appear as multiple PCIe devices.
650
651.. code-block:: yaml
652
653 linux:
654 system:
655 kernel:
656 sriov: True
657 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
658 rc:
659 local: |
660 #!/bin/sh -e
661 # Enable 7 VF on eth1
662 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
663 exit 0
664
Jakub Pavlik6c9ead12017-02-16 21:53:13 +0100665Isolate CPU options
666~~~~~~~~~~~~~~~~~~~
667
668Remove the specified CPUs, as defined by the cpu_number values, from the general kernel
669SMP balancing and scheduler algroithms. The only way to move a process onto or off an
670"isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the
671maximum value is 1 less than the number of CPUs on the system.
672
673.. code-block:: yaml
674
675 linux:
676 system:
677 kernel:
678 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100679
Filip Pytlounf5383a42015-10-06 16:28:32 +0200680Repositories
681~~~~~~~~~~~~
682
683RedHat based Linux with additional OpenStack repo
684
685.. code-block:: yaml
686
687 linux:
688 system:
689 ...
690 repo:
691 rdo-icehouse:
692 enabled: true
693 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
694 pgpcheck: 0
695
696Ensure system repository to use czech Debian mirror (``default: true``)
697Also pin it's packages with priority 900.
698
699.. code-block:: yaml
700
701 linux:
702 system:
703 repo:
704 debian:
705 default: true
706 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
707 # Import signing key from URL if needed
708 key_url: "http://dummy.com/public.gpg"
709 pin:
710 - pin: 'origin "ftp.cz.debian.org"'
711 priority: 900
712 package: '*'
713
azvyagintsevff089d22018-07-27 16:52:34 +0200714.. note:: For old ubuntu releases (<xenial)
715 extra packages for apt transport, like ``apt-transport-https``
716 may be required to be installed manually.
717 (Chicken-eggs problem: we need to install packages to
718 reach repo from where they should be installed)
719 Otherwise, you still can try 'fortune' and install prereq.packages before
720 any repo configuration, using list of requires in map.jinja.
721
722
723Disabling any prerequirment packages installation:
724You can simply drop any package pre-installation (before system.linux.repo
725will be processed) via cluster lvl:
726
727.. code-block:: yaml
728
729 linux:
730 system:
731 pkgs: ~
732
Petr Michalec10462bb2017-03-23 19:18:08 +0100733
734Package manager proxy setup globally:
735
736.. code-block:: yaml
737
738 linux:
739 system:
740 ...
741 repo:
742 apt-mk:
743 source: "deb http://apt-mk.mirantis.com/ stable main salt"
744 ...
745 proxy:
746 pkg:
747 enabled: true
748 ftp: ftp://ftp-proxy-for-apt.host.local:2121
749 ...
750 # NOTE: Global defaults for any other componet that configure proxy on the system.
751 # If your environment has just one simple proxy, set it on linux:system:proxy.
752 #
753 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
754 # as for https and http
755 ftp: ftp://proxy.host.local:2121
756 http: http://proxy.host.local:3142
757 https: https://proxy.host.local:3143
758
759Package manager proxy setup per repository:
760
761.. code-block:: yaml
762
763 linux:
764 system:
765 ...
766 repo:
767 debian:
768 source: "deb http://apt-mk.mirantis.com/ stable main salt"
769 ...
770 apt-mk:
771 source: "deb http://apt-mk.mirantis.com/ stable main salt"
772 # per repository proxy
773 proxy:
774 enabled: true
775 http: http://maas-01:8080
776 https: http://maas-01:8080
777 ...
778 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600779 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +0100780 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
781 pkg:
782 enabled: true
783 ftp: ftp://proxy.host.local:2121
784 #http: http://proxy.host.local:3142
785 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600786 ...
Petr Michalec10462bb2017-03-23 19:18:08 +0100787 # global system fallback system defaults
788 ftp: ftp://proxy.host.local:2121
789 http: http://proxy.host.local:3142
790 https: https://proxy.host.local:3143
791
792
Jiri Broulik34a29b42017-04-25 14:42:54 +0200793Remove all repositories:
794
795.. code-block:: yaml
796
797 linux:
798 system:
799 purge_repos: true
800
azvyagintsevff089d22018-07-27 16:52:34 +0200801Refresh repositories metada, after configuration:
802
803.. code-block:: yaml
804
805 linux:
806 system:
807 refresh_repos_meta: true
808
Filip Pytlounc512e6c2017-11-22 14:28:10 +0100809Setup custom apt config options:
810
811.. code-block:: yaml
812
813 linux:
814 system:
815 apt:
816 config:
817 compression-workaround:
818 "Acquire::CompressionTypes::Order": "gz"
819 docker-clean:
820 "DPkg::Post-Invoke":
821 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
822 "APT::Update::Post-Invoke":
823 - "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 +0200824
Petr Michalec10462bb2017-03-23 19:18:08 +0100825RC
826~~
827
Jakub Pavlik78859382016-01-21 11:26:39 +0100828rc.local example
829
830.. code-block:: yaml
831
832 linux:
833 system:
834 rc:
835 local: |
836 #!/bin/sh -e
837 #
838 # rc.local
839 #
840 # This script is executed at the end of each multiuser runlevel.
841 # Make sure that the script will "exit 0" on success or any other
842 # value on error.
843 #
844 # In order to enable or disable this script just change the execution
845 # bits.
846 #
847 # By default this script does nothing.
848 exit 0
849
Petr Michalec10462bb2017-03-23 19:18:08 +0100850
Filip Pytloun1f40dac2016-01-22 15:52:57 +0100851Prompt
852~~~~~~
853
854Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every
855user can have different prompt.
856
857.. code-block:: yaml
858
859 linux:
860 system:
861 prompt:
862 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\\]
863 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
864
865On Debian systems to set prompt system-wide it's necessary to remove setting
866PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from
867``/etc/skel/.bashrc``). This formula will do this automatically, but will not
Filip Pytlound9b68da2016-01-22 15:58:41 +0100868touch existing user's ``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +0100869
Filip Pytlouneef11c12016-03-25 11:00:23 +0100870Bash
871~~~~
872
873Fix bash configuration to preserve history across sessions (like ZSH does by
874default).
875
876.. code-block:: yaml
877
878 linux:
879 system:
880 bash:
881 preserve_history: true
882
Dmitry Teselkin949398e2018-05-03 15:50:00 +0300883Login banner message
884~~~~~~~~~~~~~~~~~~~~
885
886/etc/issue is a text file which contains a message or system
887identification to be printed before the login prompt. It may contain
888various @char and \char sequences, if supported by the getty-type
889program employed on the system.
890
891Setting logon banner message is easy:
892
893.. code-block:: yaml
894
895 liunx:
896 system:
897 banner:
898 enabled: true
899 contents: |
900 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
901
902 You must have explicit, authorized permission to access or configure this
903 device. Unauthorized attempts and actions to access or use this system may
904 result in civil and/or criminal penalties.
905 All activities performed on this system are logged and monitored.
906
Filip Pytloune874dfb2016-01-22 16:57:34 +0100907Message of the day
908~~~~~~~~~~~~~~~~~~
909
Dmitry Teselkin538c8242018-04-02 16:13:37 +0300910``pam_motd`` from package ``libpam-modules`` is used for dynamic messages of the
Filip Pytloune874dfb2016-01-22 16:57:34 +0100911day. Setting custom motd will cleanup existing ones.
912
Dmitry Teselkin538c8242018-04-02 16:13:37 +0300913Setting static motd will replace existing ``/etc/motd`` and remove scripts from
914``/etc/update-motd.d``.
915
916Setting static motd:
917
918.. code-block:: yaml
919
920 linux:
921 system:
922 motd: |
923 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
924
925 You must have explicit, authorized permission to access or configure this
926 device. Unauthorized attempts and actions to access or use this system may
927 result in civil and/or criminal penalties.
928 All activities performed on this system are logged and monitored.
929
930Setting dynamic motd:
931
Filip Pytloune874dfb2016-01-22 16:57:34 +0100932.. code-block:: yaml
933
934 linux:
935 system:
936 motd:
937 - release: |
938 #!/bin/sh
939 [ -r /etc/lsb-release ] && . /etc/lsb-release
940
941 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
942 # Fall back to using the very slow lsb_release utility
943 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
944 fi
945
946 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
947 - warning: |
948 #!/bin/sh
949 printf "This is [company name] network.\n"
950 printf "Unauthorized access strictly prohibited.\n"
951
Marek Celoud713e9072017-05-18 15:20:25 +0200952Services
953~~~~~~~~
954
955Stop and disable linux service:
956
957.. code-block:: yaml
958
959 linux:
960 system:
961 service:
962 apt-daily.timer:
963 status: dead
964
965Possible status is dead (disable service by default), running (enable service by default), enabled, disabled.
966
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +0300967Linux with atop service:
968
969.. code-block:: yaml
970
971 linux:
972 system:
973 atop:
974 enabled: true
975 interval: 20
976 logpath: "/var/log/atop"
977 outfile: "/var/log/atop/daily.log"
978
Oleksii Chupryn144432b2018-05-22 10:34:48 +0300979Linux with mcelog service:
980
981.. code-block:: yaml
982
983 linux:
984 system:
985 mcelog:
986 enabled: true
987 logging:
988 syslog: true
989 syslog_error: true
990
Filip Pytloun2f70b492016-02-19 15:55:25 +0100991RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +0100992^^^^^^^^^^^^^
Filip Pytloun2f70b492016-02-19 15:55:25 +0100993
994Unfortunately ``update-motd`` is currently not available for RHEL so there's
995no native support for dynamic motd.
996You can still set static one, only pillar structure differs:
997
998.. code-block:: yaml
999
1000 linux:
1001 system:
1002 motd: |
1003 This is [company name] network.
1004 Unauthorized access strictly prohibited.
1005
Filip Pytloun8296bb92016-02-19 18:42:09 +01001006Haveged
1007~~~~~~~
1008
1009If you are running headless server and are low on entropy, it may be a good
1010idea to setup Haveged.
1011
1012.. code-block:: yaml
1013
1014 linux:
1015 system:
1016 haveged:
1017 enabled: true
1018
Filip Pytlounf5383a42015-10-06 16:28:32 +02001019Linux network
1020-------------
1021
1022Linux with network manager
1023
1024.. code-block:: yaml
1025
1026 linux:
1027 network:
1028 enabled: true
1029 network_manager: true
1030
1031Linux with default static network interfaces, default gateway interface and DNS servers
1032
1033.. code-block:: yaml
1034
1035 linux:
1036 network:
1037 enabled: true
1038 interface:
1039 eth0:
1040 enabled: true
1041 type: eth
1042 address: 192.168.0.102
1043 netmask: 255.255.255.0
1044 gateway: 192.168.0.1
1045 name_servers:
1046 - 8.8.8.8
1047 - 8.8.4.4
1048 mtu: 1500
1049
jan kaufman6d30adf2016-01-18 17:30:12 +01001050Linux with bonded interfaces and disabled NetworkManager
Filip Pytlounf5383a42015-10-06 16:28:32 +02001051
1052.. code-block:: yaml
1053
1054 linux:
1055 network:
1056 enabled: true
1057 interface:
1058 eth0:
1059 type: eth
1060 ...
1061 eth1:
1062 type: eth
1063 ...
1064 bond0:
1065 enabled: true
1066 type: bond
1067 address: 192.168.0.102
1068 netmask: 255.255.255.0
1069 mtu: 1500
1070 use_in:
1071 - interface: ${linux:interface:eth0}
1072 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +01001073 network_manager:
1074 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001075
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001076Linux with vlan interface_params
1077
1078.. code-block:: yaml
1079
1080 linux:
1081 network:
1082 enabled: true
1083 interface:
1084 vlan69:
1085 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001086 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001087 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001088
Filip Pytlounf5383a42015-10-06 16:28:32 +02001089Linux with wireless interface parameters
1090
1091.. code-block:: yaml
1092
1093 linux:
1094 network:
1095 enabled: true
1096 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001097 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001098 interface:
1099 wlan0:
1100 type: eth
1101 wireless:
1102 essid: example
1103 key: example_key
1104 security: wpa
1105 priority: 1
1106
1107Linux networks with routes defined
1108
1109.. code-block:: yaml
1110
1111 linux:
1112 network:
1113 enabled: true
1114 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001115 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001116 interface:
1117 eth0:
1118 type: eth
1119 route:
1120 default:
1121 address: 192.168.0.123
1122 netmask: 255.255.255.0
1123 gateway: 192.168.0.1
1124
1125Native Linux Bridges
1126
1127.. code-block:: yaml
1128
1129 linux:
1130 network:
1131 interface:
1132 eth1:
1133 enabled: true
1134 type: eth
1135 proto: manual
1136 up_cmds:
1137 - ip address add 0/0 dev $IFACE
1138 - ip link set $IFACE up
1139 down_cmds:
1140 - ip link set $IFACE down
1141 br-ex:
1142 enabled: true
1143 type: bridge
1144 address: ${linux:network:host:public_local:address}
1145 netmask: 255.255.255.0
1146 use_interfaces:
1147 - eth1
1148
1149OpenVswitch Bridges
1150
1151.. code-block:: yaml
1152
1153 linux:
1154 network:
1155 bridge: openvswitch
1156 interface:
1157 eth1:
1158 enabled: true
1159 type: eth
1160 proto: manual
1161 up_cmds:
1162 - ip address add 0/0 dev $IFACE
1163 - ip link set $IFACE up
1164 down_cmds:
1165 - ip link set $IFACE down
1166 br-ex:
1167 enabled: true
1168 type: bridge
1169 address: ${linux:network:host:public_local:address}
1170 netmask: 255.255.255.0
1171 use_interfaces:
1172 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001173 br-prv:
1174 enabled: true
1175 type: ovs_bridge
1176 mtu: 65000
1177 br-ens7:
1178 enabled: true
1179 name: br-ens7
1180 type: ovs_bridge
1181 proto: manual
1182 mtu: 9000
1183 use_interfaces:
1184 - ens7
1185 patch-br-ens7-br-prv:
1186 enabled: true
1187 name: ens7-prv
1188 ovs_type: ovs_port
1189 type: ovs_port
1190 bridge: br-ens7
1191 port_type: patch
1192 peer: prv-ens7
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001193 tag: 109 # [] to unset a tag
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001194 mtu: 65000
1195 patch-br-prv-br-ens7:
1196 enabled: true
1197 name: prv-ens7
1198 bridge: br-prv
1199 ovs_type: ovs_port
1200 type: ovs_port
1201 port_type: patch
1202 peer: ens7-prv
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001203 tag: 109
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001204 mtu: 65000
1205 ens7:
1206 enabled: true
1207 name: ens7
1208 proto: manual
1209 ovs_port_type: OVSPort
1210 type: ovs_port
1211 ovs_bridge: br-ens7
1212 bridge: br-ens7
Filip Pytlounf5383a42015-10-06 16:28:32 +02001213
Petr Jediný8f8ae542017-07-13 16:19:12 +02001214Debian manual proto interfaces
1215
1216When you are changing interface proto from static in up state to manual, you
1217may need to flush ip addresses. For example, if you want to use the interface
1218and the ip on the bridge. This can be done by setting the ``ipflush_onchange``
1219to true.
1220
1221.. code-block:: yaml
1222
1223 linux:
1224 network:
1225 interface:
1226 eth1:
1227 enabled: true
1228 type: eth
1229 proto: manual
1230 mtu: 9100
1231 ipflush_onchange: true
1232
Jiri Broulik1a191e32018-01-15 15:54:21 +01001233Debian static proto interfaces
1234
1235When you are changing interface proto from dhcp in up state to static, you
1236may need to flush ip addresses and restart interface to assign ip address from a managed file.
1237For example, if you want to use the interface and the ip on the bridge.
1238This can be done by setting the ``ipflush_onchange`` with combination
1239``restart_on_ipflush`` param set to to true.
1240
1241.. code-block:: yaml
1242
1243 linux:
1244 network:
1245 interface:
1246 eth1:
1247 enabled: true
1248 type: eth
1249 proto: static
1250 address: 10.1.0.22
1251 netmask: 255.255.255.0
1252 ipflush_onchange: true
1253 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001254
Petr Jedinýd577cb52017-06-28 20:17:49 +02001255Concatinating and removing interface files
1256
1257Debian based distributions have `/etc/network/interfaces.d/` directory, where
1258you can store configuration of network interfaces in separate files. You can
1259concatinate the files to the defined destination when needed, this operation
1260removes the file from the `/etc/network/interfaces.d/`. If you just need to
1261remove iface files, you can use the `remove_iface_files` key.
1262
1263.. code-block:: yaml
1264
1265 linux:
1266 network:
1267 concat_iface_files:
1268 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1269 dst: '/etc/network/interfaces'
1270 remove_iface_files:
1271 - '/etc/network/interfaces.d/90-custom.cfg'
1272
1273
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001274DHCP client configuration
1275
1276None of the keys is mandatory, include only those you really need. For full list
1277of available options under send, supersede, prepend, append refer to dhcp-options(5)
1278
1279.. code-block:: yaml
1280
1281 linux:
1282 network:
1283 dhclient:
1284 enabled: true
1285 backoff_cutoff: 15
1286 initial_interval: 10
1287 reboot: 10
1288 retry: 60
1289 select_timeout: 0
1290 timeout: 120
1291 send:
1292 - option: host-name
1293 declaration: "= gethostname()"
1294 supersede:
1295 - option: host-name
1296 declaration: "spaceship"
1297 - option: domain-name
1298 declaration: "domain.home"
1299 #- option: arp-cache-timeout
1300 # declaration: 20
1301 prepend:
1302 - option: domain-name-servers
1303 declaration:
1304 - 8.8.8.8
1305 - 8.8.4.4
1306 - option: domain-search
1307 declaration:
1308 - example.com
1309 - eng.example.com
1310 #append:
1311 #- option: domain-name-servers
1312 # declaration: 127.0.0.1
1313 # ip or subnet to reject dhcp offer from
1314 reject:
1315 - 192.33.137.209
1316 - 10.0.2.0/24
1317 request:
1318 - subnet-mask
1319 - broadcast-address
1320 - time-offset
1321 - routers
1322 - domain-name
1323 - domain-name-servers
1324 - domain-search
1325 - host-name
1326 - dhcp6.name-servers
1327 - dhcp6.domain-search
1328 - dhcp6.fqdn
1329 - dhcp6.sntp-servers
1330 - netbios-name-servers
1331 - netbios-scope
1332 - interface-mtu
1333 - rfc3442-classless-static-routes
1334 - ntp-servers
1335 require:
1336 - subnet-mask
1337 - domain-name-servers
1338 # if per interface configuration required add below
1339 interface:
1340 ens2:
1341 initial_interval: 11
1342 reject:
1343 - 192.33.137.210
1344 ens3:
1345 initial_interval: 12
1346 reject:
1347 - 192.33.137.211
1348
Petr Michaleceb14b552017-06-01 10:27:05 +02001349Linux network systemd settings:
1350
1351.. code-block:: yaml
1352
1353 linux:
1354 network:
1355 ...
1356 systemd:
1357 link:
1358 10-iface-dmz:
1359 Match:
1360 MACAddress: c8:5b:67:fa:1a:af
1361 OriginalName: eth0
1362 Link:
1363 Name: dmz0
1364 netdev:
1365 20-bridge-dmz:
1366 match:
1367 name: dmz0
1368 network:
1369 mescription: bridge
1370 bridge: br-dmz0
1371 network:
1372 # works with lowercase, keys are by default capitalized
1373 40-dhcp:
1374 match:
1375 name: '*'
1376 network:
1377 DHCP: yes
1378
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001379
Petr Michalec10462bb2017-03-23 19:18:08 +01001380Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001381
Ales Komarek417e8c52017-08-25 15:10:29 +02001382Use ``/etc/environment`` for static system wide variable assignment after
1383boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001384
1385.. code-block:: yaml
1386
1387 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001388 system:
1389 env:
1390 BOB_VARIABLE: Alice
1391 ...
1392 BOB_PATH:
1393 - /srv/alice/bin
1394 - /srv/bob/bin
1395 ...
1396 ftp_proxy: none
1397 http_proxy: http://global-http-proxy.host.local:8080
1398 https_proxy: ${linux:system:proxy:https}
1399 no_proxy:
1400 - 192.168.0.80
1401 - 192.168.1.80
1402 - .domain.com
1403 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02001404 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001405 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001406 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01001407 ftp: ftp://proxy.host.local:2121
1408 http: http://proxy.host.local:3142
1409 https: https://proxy.host.local:3143
1410 noproxy:
1411 - .domain.com
1412 - .local
1413
1414Configure profile.d scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01001415
Ales Komarek417e8c52017-08-25 15:10:29 +02001416The profile.d scripts are being sourced during .sh execution and support
1417variable expansion in opposite to /etc/environment global settings in
1418``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01001419
1420.. code-block:: yaml
1421
1422 linux:
1423 system:
1424 profile:
1425 locales: |
1426 export LANG=C
1427 export LC_ALL=C
1428 ...
1429 vi_flavors.sh: |
1430 export PAGER=view
1431 export EDITOR=vim
1432 alias vi=vim
1433 shell_locales.sh: |
1434 export LANG=en_US
1435 export LC_ALL=en_US.UTF-8
1436 shell_proxies.sh: |
1437 export FTP_PROXY=ftp://127.0.3.3:2121
1438 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02001439
1440Linux with hosts
1441
Filip Pytloun86506fe2017-01-26 14:36:16 +01001442Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
1443that are not defined in model except defaults for both IPv4 and IPv6 localhost
1444and hostname + fqdn.
Ales Komarek417e8c52017-08-25 15:10:29 +02001445
Filip Pytloun86506fe2017-01-26 14:36:16 +01001446It's good to use this option if you want to ensure /etc/hosts is always in a
1447clean state however it's not enabled by default for safety.
1448
Filip Pytlounf5383a42015-10-06 16:28:32 +02001449.. code-block:: yaml
1450
1451 linux:
1452 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001453 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001454 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001455 # No need to define this one if purge_hosts is true
1456 hostname:
1457 address: 127.0.1.1
1458 names:
1459 - ${linux:network:fqdn}
1460 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02001461 node1:
1462 address: 192.168.10.200
1463 names:
1464 - node2.domain.com
1465 - service2.domain.com
1466 node2:
1467 address: 192.168.10.201
1468 names:
1469 - node2.domain.com
1470 - service2.domain.com
1471
Ales Komarek417e8c52017-08-25 15:10:29 +02001472Linux with hosts collected from mine
1473
1474In this case all dns records defined within infrastrucuture will be passed to
1475local hosts records or any DNS server. Only hosts with `grain` parameter to
1476true will be propagated to the mine.
1477
1478.. code-block:: yaml
1479
1480 linux:
1481 network:
1482 purge_hosts: true
1483 mine_dns_records: true
1484 host:
1485 node1:
1486 address: 192.168.10.200
1487 grain: true
1488 names:
1489 - node2.domain.com
1490 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01001491
Filip Pytlounde9bea52016-01-11 15:39:10 +01001492Setup resolv.conf, nameservers, domain and search domains
1493
1494.. code-block:: yaml
1495
1496 linux:
1497 network:
1498 resolv:
1499 dns:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001500 - 8.8.4.4
1501 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01001502 domain: my.example.com
1503 search:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001504 - my.example.com
1505 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01001506 options:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001507 - ndots: 5
1508 - timeout: 2
1509 - attempts: 2
Filip Pytlounde9bea52016-01-11 15:39:10 +01001510
Ales Komarek417e8c52017-08-25 15:10:29 +02001511setting custom TX queue length for tap interfaces
Andrii Petrenko735761d2017-03-21 17:17:35 -07001512
1513.. code-block:: yaml
1514
1515 linux:
1516 network:
1517 tap_custom_txqueuelen: 10000
1518
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001519DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001520
1521**DPDK OVS NIC**
1522
1523.. code-block:: yaml
1524
1525 linux:
1526 network:
1527 bridge: openvswitch
1528 dpdk:
1529 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001530 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001531 openvswitch:
1532 pmd_cpu_mask: "0x6"
1533 dpdk_socket_mem: "1024,1024"
1534 dpdk_lcore_mask: "0x400"
1535 memory_channels: 2
1536 interface:
1537 dpkd0:
1538 name: ${_param:dpdk_nic}
1539 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001540 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001541 enabled: true
1542 type: dpdk_ovs_port
1543 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001544 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001545 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01001546 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001547 br-prv:
1548 enabled: true
1549 type: dpdk_ovs_bridge
1550
1551**DPDK OVS Bond**
1552
1553.. code-block:: yaml
1554
1555 linux:
1556 network:
1557 bridge: openvswitch
1558 dpdk:
1559 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001560 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001561 openvswitch:
1562 pmd_cpu_mask: "0x6"
1563 dpdk_socket_mem: "1024,1024"
1564 dpdk_lcore_mask: "0x400"
1565 memory_channels: 2
1566 interface:
1567 dpdk_second_nic:
1568 name: ${_param:primary_second_nic}
1569 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001570 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001571 bond: dpdkbond0
1572 enabled: true
1573 type: dpdk_ovs_port
1574 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001575 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001576 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001577 dpdk_first_nic:
1578 name: ${_param:primary_first_nic}
1579 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001580 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001581 bond: dpdkbond0
1582 enabled: true
1583 type: dpdk_ovs_port
1584 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001585 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001586 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001587 dpdkbond0:
1588 enabled: true
1589 bridge: br-prv
1590 type: dpdk_ovs_bond
1591 mode: active-backup
1592 br-prv:
1593 enabled: true
1594 type: dpdk_ovs_bridge
1595
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01001596**DPDK OVS LACP Bond with vlan tag**
1597
1598.. code-block:: yaml
1599
1600 linux:
1601 network:
1602 bridge: openvswitch
1603 dpdk:
1604 enabled: true
1605 driver: uio
1606 openvswitch:
1607 pmd_cpu_mask: "0x6"
1608 dpdk_socket_mem: "1024,1024"
1609 dpdk_lcore_mask: "0x400"
1610 memory_channels: "2"
1611 interface:
1612 eth3:
1613 enabled: true
1614 type: eth
1615 proto: manual
1616 name: ${_param:tenant_first_nic}
1617 eth4:
1618 enabled: true
1619 type: eth
1620 proto: manual
1621 name: ${_param:tenant_second_nic}
1622 dpdk0:
1623 name: ${_param:tenant_first_nic}
1624 pci: "0000:81:00.0"
1625 driver: igb_uio
1626 bond: bond1
1627 enabled: true
1628 type: dpdk_ovs_port
1629 n_rxq: 2
1630 dpdk1:
1631 name: ${_param:tenant_second_nic}
1632 pci: "0000:81:00.1"
1633 driver: igb_uio
1634 bond: bond1
1635 enabled: true
1636 type: dpdk_ovs_port
1637 n_rxq: 2
1638 bond1:
1639 enabled: true
1640 bridge: br-prv
1641 type: dpdk_ovs_bond
1642 mode: balance-slb
1643 br-prv:
1644 enabled: true
1645 type: dpdk_ovs_bridge
1646 tag: ${_param:tenant_vlan}
1647 address: ${_param:tenant_address}
1648 netmask: ${_param:tenant_network_netmask}
1649
Jakub Pavlikaa759062017-03-13 15:57:26 +01001650**DPDK OVS bridge for VXLAN**
1651
1652If VXLAN is used as tenant segmentation then ip address must be set on br-prv
1653
1654.. code-block:: yaml
1655
1656 linux:
1657 network:
1658 ...
1659 interface:
1660 br-prv:
1661 enabled: true
1662 type: dpdk_ovs_bridge
1663 address: 192.168.50.0
1664 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04001665 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01001666 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001667
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02001668
1669
1670**DPDK OVS bridge with Linux network interface**
1671
1672.. code-block:: yaml
1673
1674 linux:
1675 network:
1676 ...
1677 interface:
1678 eth0:
1679 type: eth
1680 ovs_bridge: br-prv
1681 ...
1682 br-prv:
1683 enabled: true
1684 type: dpdk_ovs_bridge
1685 ...
1686
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001687Linux storage
1688-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02001689
1690Linux with mounted Samba
1691
1692.. code-block:: yaml
1693
1694 linux:
1695 storage:
1696 enabled: true
1697 mount:
1698 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01001699 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001700 - path: /media/myuser/public/
1701 - device: //192.168.0.1/storage
1702 - file_system: cifs
1703 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
1704
Jiri Broulikb017f932017-03-31 13:55:36 +02001705NFS mount
1706
1707.. code-block:: yaml
1708
1709 linux:
1710 storage:
1711 enabled: true
1712 mount:
1713 nfs_glance:
1714 enabled: true
1715 path: /var/lib/glance/images
1716 device: 172.16.10.110:/var/nfs/glance
1717 file_system: nfs
1718 opts: rw,sync
1719
1720
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001721File swap configuration
Filip Pytlounf5383a42015-10-06 16:28:32 +02001722
1723.. code-block:: yaml
1724
1725 linux:
1726 storage:
1727 enabled: true
1728 swap:
1729 file:
1730 enabled: true
1731 engine: file
1732 device: /swapfile
1733 size: 1024
1734
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001735Partition swap configuration
Lachlan Evenson30676512016-01-22 15:43:28 -08001736
1737.. code-block:: yaml
1738
1739 linux:
1740 storage:
1741 enabled: true
1742 swap:
1743 partition:
1744 enabled: true
1745 engine: partition
1746 device: /dev/vg0/swap
1747
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001748LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
1749
1750.. code-block:: yaml
1751
1752 parameters:
1753 linux:
1754 storage:
1755 mount:
1756 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01001757 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001758 device: /dev/vg1/data
1759 file_system: ext4
1760 path: /mnt/data
1761 lvm:
1762 vg1:
1763 enabled: true
1764 devices:
1765 - /dev/sdb
1766 volume:
1767 data:
1768 size: 40G
1769 mount: ${linux:storage:mount:data}
1770
Jakub Pavlik4f742142017-08-08 15:05:50 +02001771Create partitions on disk. Specify size in MB. It expects empty
Piotr Krukd51911b2017-12-04 11:27:08 +01001772disk without any existing partitions. (set startsector=1, if you want to start partitions from 2048)
Jakub Pavlik4f742142017-08-08 15:05:50 +02001773
1774.. code-block:: yaml
1775
1776 linux:
1777 storage:
1778 disk:
1779 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01001780 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02001781 name: /dev/loop1
1782 type: gpt
1783 partitions:
1784 - size: 200 #size in MB
1785 type: fat32
1786 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02001787 mkfs: True
1788 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02001789 /dev/vda1:
1790 partitions:
1791 - size: 5
1792 type: ext2
1793 - size: 10
1794 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02001795
1796Multipath with Fujitsu Eternus DXL
1797
1798.. code-block:: yaml
1799
1800 parameters:
1801 linux:
1802 storage:
1803 multipath:
1804 enabled: true
1805 blacklist_devices:
1806 - /dev/sda
1807 - /dev/sdb
1808 backends:
1809 - fujitsu_eternus_dxl
1810
1811Multipath with Hitachi VSP 1000
1812
1813.. code-block:: yaml
1814
1815 parameters:
1816 linux:
1817 storage:
1818 multipath:
1819 enabled: true
1820 blacklist_devices:
1821 - /dev/sda
1822 - /dev/sdb
1823 backends:
1824 - hitachi_vsp1000
1825
1826Multipath with IBM Storwize
1827
1828.. code-block:: yaml
1829
1830 parameters:
1831 linux:
1832 storage:
1833 multipath:
1834 enabled: true
1835 blacklist_devices:
1836 - /dev/sda
1837 - /dev/sdb
1838 backends:
1839 - ibm_storwize
1840
1841Multipath with multiple backends
1842
1843.. code-block:: yaml
1844
1845 parameters:
1846 linux:
1847 storage:
1848 multipath:
1849 enabled: true
1850 blacklist_devices:
1851 - /dev/sda
1852 - /dev/sdb
1853 - /dev/sdc
1854 - /dev/sdd
1855 backends:
1856 - ibm_storwize
1857 - fujitsu_eternus_dxl
1858 - hitachi_vsp1000
1859
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001860PAM LDAP integration
1861
1862.. code-block:: yaml
1863
1864 parameters:
1865 linux:
1866 system:
1867 auth:
1868 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02001869 mkhomedir:
1870 enabled: true
1871 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001872 ldap:
1873 enabled: true
1874 binddn: cn=bind,ou=service_users,dc=example,dc=com
1875 bindpw: secret
1876 uri: ldap://127.0.0.1
1877 base: ou=users,dc=example,dc=com
1878 ldap_version: 3
1879 pagesize: 65536
1880 referrals: off
1881 filter:
1882 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1883 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1884 group: (&(objectClass=group)(gidNumber=*))
1885
Ales Komareka634f4b2016-10-02 13:11:04 +02001886Disabled multipath (the default setup)
1887
1888.. code-block:: yaml
1889
1890 parameters:
1891 linux:
1892 storage:
1893 multipath:
1894 enabled: false
1895
Simon Pasquier375001e2017-01-26 13:22:33 +01001896Linux with local loopback device
1897
1898.. code-block:: yaml
1899
1900 linux:
1901 storage:
1902 loopback:
1903 disk1:
1904 file: /srv/disk1
1905 size: 50G
1906
Filip Pytlounb2c8f852016-11-21 17:03:43 +01001907External config generation
1908--------------------------
1909
1910You are able to use config support metadata between formulas and only generate
1911config files for external use, eg. docker, etc.
1912
1913.. code-block:: yaml
1914
1915 parameters:
1916 linux:
1917 system:
1918 config:
1919 pillar:
1920 jenkins:
1921 master:
1922 home: /srv/volumes/jenkins
1923 approved_scripts:
1924 - method java.net.URL openConnection
1925 credentials:
1926 - type: username_password
1927 scope: global
1928 id: test
1929 desc: Testing credentials
1930 username: test
1931 password: test
1932
Vladimir Ereminccf28842017-04-10 23:52:10 +03001933Netconsole Remote Kernel Logging
1934--------------------------------
1935
1936Netconsole logger could be configured for configfs-enabled kernels
1937(`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in
1938runtime (if network is already configured), and on-boot after interface
1939initialization. Notes:
1940
1941 * receiver could be located only in same L3 domain
1942 (or you need to configure gateway MAC manually)
1943 * receiver's MAC is detected only on configuration time
1944 * using broadcast MAC is not recommended
1945
1946.. code-block:: yaml
1947
1948 parameters:
1949 linux:
1950 system:
1951 netconsole:
1952 enabled: true
1953 port: 514 (optional)
1954 loglevel: debug (optional)
1955 target:
1956 192.168.0.1:
1957 interface: bond0
1958 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02001959
Filip Pytlounf5383a42015-10-06 16:28:32 +02001960Usage
1961=====
1962
1963Set mtu of network interface eth0 to 1400
1964
1965.. code-block:: bash
1966
1967 ip link set dev eth0 mtu 1400
1968
1969Read more
1970=========
1971
1972* https://www.archlinux.org/
1973* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
Filip Pytloun018f8712017-02-02 13:02:03 +01001974
1975Documentation and Bugs
1976======================
1977
1978To learn how to install and update salt-formulas, consult the documentation
1979available online at:
1980
1981 http://salt-formulas.readthedocs.io/
1982
1983In the unfortunate event that bugs are discovered, they should be reported to
1984the appropriate issue tracker. Use Github issue tracker for specific salt
1985formula:
1986
1987 https://github.com/salt-formulas/salt-formula-linux/issues
1988
1989For feature requests, bug reports or blueprints affecting entire ecosystem,
1990use Launchpad salt-formulas project:
1991
1992 https://launchpad.net/salt-formulas
1993
1994You can also join salt-formulas-users team and subscribe to mailing list:
1995
1996 https://launchpad.net/~salt-formulas-users
1997
1998Developers wishing to work on the salt-formulas projects should always base
1999their work on master branch and submit pull request against specific formula.
2000
2001 https://github.com/salt-formulas/salt-formula-linux
2002
2003Any questions or feedback is always welcome so feel free to join our IRC
2004channel:
2005
2006 #salt-formulas @ irc.freenode.net