blob: 2246e35e63ab50903b83d2c9225d40454d64467b [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'
52 email: 'jonh@doe.com'
53 jsmith:
54 name: 'jsmith'
55 enabled: true
azvyagintsev967af132017-06-12 12:25:24 +030056 full_name: 'With clear password'
Filip Pytlounf5383a42015-10-06 16:28:32 +020057 home: '/home/jsmith'
azvyagintsev967af132017-06-12 12:25:24 +030058 hash_password: true
59 password: "userpassword"
60 mark:
61 name: 'mark'
62 enabled: true
63 full_name: "unchange password'
64 home: '/home/mark'
65 password: false
66 elizabeth:
67 name: 'elizabeth'
68 enabled: true
69 full_name: 'With hased password'
70 home: '/home/elizabeth'
71 password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10"
Filip Pytlounf5383a42015-10-06 16:28:32 +020072
Petr Michalec1c4c8d82017-02-28 19:09:21 +010073Configure sudo for users and groups under ``/etc/sudoers.d/``.
74This ways ``linux.system.sudo`` pillar map to actual sudo attributes:
75
76.. code-block:: jinja
Aleš Komárek63572992017-04-11 13:16:44 +020077
Petr Michalec1c4c8d82017-02-28 19:09:21 +010078 # simplified template:
79 Cmds_Alias {{ alias }}={{ commands }}
80 {{ user }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
81 %{{ group }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
82
83 # when rendered:
84 saltuser1 ALL=(ALL) NOPASSWD: ALL
85
Petr Michalec1c4c8d82017-02-28 19:09:21 +010086.. code-block:: yaml
Aleš Komárek63572992017-04-11 13:16:44 +020087
Petr Michalec1c4c8d82017-02-28 19:09:21 +010088 linux:
89 system:
90 sudo:
91 enabled: true
Tomas Kammd8eb3002017-05-08 19:30:29 +020092 aliases:
Petr Michalec1c4c8d82017-02-28 19:09:21 +010093 host:
94 LOCAL:
95 - localhost
96 PRODUCTION:
97 - db1
98 - db2
99 runas:
100 DBA:
101 - postgres
102 - mysql
103 SALT:
104 - root
105 command:
106 # Note: This is not 100% safe when ALL keyword is used, user still may modify configs and hide his actions.
107 # Best practice is to specify full list of commands user is allowed to run.
108 SUPPORT_RESTRICTED:
109 - /bin/vi /etc/sudoers*
110 - /bin/vim /etc/sudoers*
111 - /bin/nano /etc/sudoers*
112 - /bin/emacs /etc/sudoers*
113 - /bin/su - root
114 - /bin/su -
115 - /bin/su
116 - /usr/sbin/visudo
117 SUPPORT_SHELLS:
118 - /bin/sh
119 - /bin/ksh
120 - /bin/bash
121 - /bin/rbash
122 - /bin/dash
123 - /bin/zsh
124 - /bin/csh
125 - /bin/fish
126 - /bin/tcsh
127 - /usr/bin/login
128 - /usr/bin/su
129 - /usr/su
130 ALL_SALT_SAFE:
131 - /usr/bin/salt state*
132 - /usr/bin/salt service*
133 - /usr/bin/salt pillar*
134 - /usr/bin/salt grains*
135 - /usr/bin/salt saltutil*
136 - /usr/bin/salt-call state*
137 - /usr/bin/salt-call service*
138 - /usr/bin/salt-call pillar*
139 - /usr/bin/salt-call grains*
140 - /usr/bin/salt-call saltutil*
141 SALT_TRUSTED:
142 - /usr/bin/salt*
143 users:
144 # saltuser1 with default values: saltuser1 ALL=(ALL) NOPASSWD: ALL
145 saltuser1: {}
146 saltuser2:
147 hosts:
148 - LOCAL
149 # User Alias DBA
150 DBA:
151 hosts:
152 - ALL
153 commands:
154 - ALL_SALT_SAFE
155 groups:
156 db-ops:
157 hosts:
158 - ALL
159 - '!PRODUCTION'
160 runas:
161 - DBA
162 commands:
163 - /bin/cat *
164 - /bin/less *
165 - /bin/ls *
166 salt-ops:
167 hosts:
168 - 'ALL'
169 runas:
170 - SALT
171 commands:
172 - SUPPORT_SHELLS
173 salt-ops-2nd:
174 name: salt-ops
175 nopasswd: false
Jakub Josef7a9d9b92017-05-16 11:39:01 +0200176 setenv: true # Enable sudo -E option
Petr Michalec1c4c8d82017-02-28 19:09:21 +0100177 runas:
178 - DBA
179 commands:
180 - ALL
181 - '!SUPPORT_SHELLS'
182 - '!SUPPORT_RESTRICTED'
183
Filip Pytlounf5383a42015-10-06 16:28:32 +0200184Linux with package, latest version
185
186.. code-block:: yaml
187
188 linux:
189 system:
190 ...
191 package:
192 package-name:
193 version: latest
194
195Linux with package from certail repo, version with no upgrades
196
197.. code-block:: yaml
198
199 linux:
200 system:
201 ...
202 package:
203 package-name:
204 version: 2132.323
205 repo: 'custom-repo'
206 hold: true
207
208Linux with package from certail repo, version with no GPG verification
209
210.. code-block:: yaml
211
212 linux:
213 system:
214 ...
215 package:
216 package-name:
217 version: 2132.323
218 repo: 'custom-repo'
219 verify: false
220
Bruno Binet69a9d8d2017-02-16 22:34:32 +0100221Linux with autoupdates (automatically install security package updates)
222
223.. code-block:: yaml
224
225 linux:
226 system:
227 ...
228 autoupdates:
229 enabled: true
230 mail: root@localhost
231 mail_only_on_error: true
232 remove_unused_dependencies: false
233 automatic_reboot: true
234 automatic_reboot_time: "02:00"
235
Filip Pytlounf5383a42015-10-06 16:28:32 +0200236Linux with cron jobs
Filip Pytloun91222222017-08-04 10:55:27 +0200237By default it will use name as an identifier, unless identifier key is
238explicitly set or False (then it will use Salt's default behavior which is
239identifier same as command resulting in not being able to change it)
Filip Pytlounf5383a42015-10-06 16:28:32 +0200240
241.. code-block:: yaml
242
243 linux:
244 system:
245 ...
246 job:
247 cmd1:
248 command: '/cmd/to/run'
Filip Pytloun91222222017-08-04 10:55:27 +0200249 identifier: cmd1
Filip Pytlounf5383a42015-10-06 16:28:32 +0200250 enabled: true
251 user: 'root'
252 hour: 2
253 minute: 0
254
Filip Pytlound0a29e72015-11-30 15:23:34 +0100255Linux security limits (limit sensu user memory usage to max 1GB):
256
257.. code-block:: yaml
258
259 linux:
260 system:
261 ...
262 limit:
263 sensu:
264 enabled: true
265 domain: sensu
266 limits:
267 - type: hard
268 item: as
269 value: 1000000
270
Filip Pytloun7fee0542015-10-15 11:19:24 +0200271Enable autologin on tty1 (may work only for Ubuntu 14.04):
272
273.. code-block:: yaml
274
275 linux:
276 system:
277 console:
278 tty1:
279 autologin: root
Filip Pytloun281d0202016-01-29 14:03:51 +0100280 # Enable serial console
281 ttyS0:
282 autologin: root
283 rate: 115200
284 term: xterm
Filip Pytloun7fee0542015-10-15 11:19:24 +0200285
286To disable set autologin to `false`.
287
Filip Pytloun7731b852016-02-01 11:13:47 +0100288Set ``policy-rc.d`` on Debian-based systems. Action can be any available
289command in ``while true`` loop and ``case`` context.
290Following will disallow dpkg to stop/start services for cassandra package automatically:
291
292.. code-block:: yaml
293
294 linux:
295 system:
296 policyrcd:
297 - package: cassandra
298 action: exit 101
299 - package: '*'
300 action: switch
301
Filip Pytlounc49445a2016-04-04 14:23:20 +0200302Set system locales:
303
304.. code-block:: yaml
305
306 linux:
307 system:
308 locale:
309 en_US.UTF-8:
310 default: true
Filip Pytlounee1745f2016-04-04 17:39:41 +0200311 "cs_CZ.UTF-8 UTF-8":
Filip Pytlounc49445a2016-04-04 14:23:20 +0200312 enabled: true
313
Andrey Shestakove7cca052017-05-24 23:06:24 +0300314Systemd settings:
315
316.. code-block:: yaml
317
318 linux:
319 system:
320 ...
321 systemd:
322 system:
323 Manager:
324 DefaultLimitNOFILE: 307200
325 DefaultLimitNPROC: 307200
326 user:
327 Manager:
328 DefaultLimitCPU: 2
329 DefaultLimitNPROC: 4
330
Filip Pytloun8b2131e2017-11-08 13:29:03 +0100331Ensure presence of directory:
332
333.. code-block:: yaml
334
335 linux:
336 system:
337 directory:
338 /tmp/test:
339 user: root
340 group: root
341 mode: 700
342 makedirs: true
343
Richard Felkl2e07d652018-01-19 10:19:06 +0100344Ensure presence of file by specifying it's source:
345
346.. code-block:: yaml
347
348 linux:
349 system:
350 file:
351 /tmp/test.txt:
352 source: http://example.com/test.txt
Richard Felklf40599a2018-02-06 22:56:41 +0100353 user: root #optional
354 group: root #optional
355 mode: 700 #optional
356 dir_mode: 700 #optional
357 encoding: utf-8 #optional
358 hash: <<hash>> or <<URI to hash>> #optional
359 makedirs: true #optional
360
361 linux:
362 system:
363 file:
364 test.txt:
365 name: /tmp/test.txt
366 source: http://example.com/test.txt
Richard Felkl2e07d652018-01-19 10:19:06 +0100367
368Ensure presence of file by specifying it's contents:
369
370.. code-block:: yaml
371
372 linux:
373 system:
374 file:
375 /tmp/test.txt:
376 contents: |
377 line1
378 line2
Richard Felklf40599a2018-02-06 22:56:41 +0100379
380 linux:
381 system:
382 file:
383 /tmp/test.txt:
384 contents_pillar: linux:network:hostname
385
386 linux:
387 system:
388 file:
389 /tmp/test.txt:
390 contents_grains: motd
391
Filip Pytloun281034a2016-01-04 18:06:22 +0100392Kernel
393~~~~~~
394
395Install always up to date LTS kernel and headers from Ubuntu trusty:
396
397.. code-block:: yaml
398
399 linux:
400 system:
401 kernel:
402 type: generic
403 lts: trusty
404 headers: true
405
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100406Load kernel modules and add them to `/etc/modules`:
407
408.. code-block:: yaml
409
410 linux:
411 system:
412 kernel:
413 modules:
414 - nf_conntrack
415 - tp_smapi
416 - 8021q
417
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300418Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
419will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`:
420
421.. code-block:: yaml
422
423 linux:
424 system:
425 kernel:
426 module:
427 nf_conntrack:
428 option:
429 hashsize: 262144
430
431
432
Filip Pytloun281034a2016-01-04 18:06:22 +0100433Install specific kernel version and ensure all other kernel packages are
434not present. Also install extra modules and headers for this kernel:
435
436.. code-block:: yaml
437
438 linux:
439 system:
440 kernel:
441 type: generic
442 extra: true
443 headers: true
444 version: 4.2.0-22
445
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100446Systcl kernel parameters
447
448.. code-block:: yaml
449
450 linux:
451 system:
452 kernel:
453 sysctl:
454 net.ipv4.tcp_keepalive_intvl: 3
455 net.ipv4.tcp_keepalive_time: 30
456 net.ipv4.tcp_keepalive_probes: 8
457
Michael Polenchukebf55522018-01-25 13:22:39 +0400458Configure kernel boot options:
459
460.. code-block:: yaml
461
462 linux:
463 system:
464 kernel:
465 boot_options:
466 - elevator=deadline
467 - spectre_v2=off
468 - nopti
469
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100470
471CPU
472~~~
473
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300474Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100475
476.. code-block:: yaml
477
478 linux:
479 system:
480 cpu:
481 governor: performance
482
Nick Metzf04f5f32018-01-08 15:25:04 +0100483
Jiri Broulik303905d2018-01-11 14:12:48 +0100484CGROUPS
485~~~~~~~
486
487Setup linux cgroups:
488
489.. code-block:: yaml
490
491 linux:
492 system:
493 cgroup:
494 enabled: true
495 group:
496 ceph_group_1:
497 controller:
498 cpu:
499 shares:
500 value: 250
501 cpuacct:
502 usage:
503 value: 0
504 cpuset:
505 cpus:
506 value: 1,2,3
507 memory:
508 limit_in_bytes:
509 value: 2G
510 memsw.limit_in_bytes:
511 value: 3G
512 mapping:
513 subjects:
514 - '@ceph'
515 generic_group_1:
516 controller:
517 cpu:
518 shares:
519 value: 250
520 cpuacct:
521 usage:
522 value: 0
523 mapping:
524 subjects:
525 - '*:firefox'
526 - 'student:cp'
527
528
Nick Metzf04f5f32018-01-08 15:25:04 +0100529Shared Libraries
530~~~~~~~~~~~~~~~~
531
532Set additional shared library to Linux system library path
533
534.. code-block:: yaml
535
536 linux:
537 system:
538 ld:
539 library:
540 java:
541 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
542 - /opt/java/jre/lib/amd64/server
543
544
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200545Certificates
546~~~~~~~~~~~~
547
548Add certificate authority into system trusted CA bundle
549
550.. code-block:: yaml
551
552 linux:
553 system:
554 ca_certificates:
555 mycert: |
556 -----BEGIN CERTIFICATE-----
557 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
558 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
559 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
560 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
561 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
562 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
563 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
564 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
565 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
566 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
567 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
568 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
569 -----END CERTIFICATE-----
570
Filip Pytloun361096c2017-08-23 10:57:20 +0200571Sysfs
572~~~~~
573
574Install sysfsutils and set sysfs attributes:
575
576.. code-block:: yaml
577
578 linux:
579 system:
580 sysfs:
581 scheduler:
582 block/sda/queue/scheduler: deadline
583 power:
584 mode:
585 power/state: 0660
586 owner:
587 power/state: "root:power"
588 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
589
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100590Huge Pages
591~~~~~~~~~~~~
592
593Huge Pages give a performance boost to applications that intensively deal
594with memory allocation/deallocation by decreasing memory fragmentation.
595
596.. code-block:: yaml
597
598 linux:
599 system:
600 kernel:
601 hugepages:
602 small:
603 size: 2M
604 count: 107520
605 mount_point: /mnt/hugepages_2MB
606 mount: false/true # default false
607 large:
608 default: true # default automatically mounted
609 size: 1G
610 count: 210
611 mount_point: /mnt/hugepages_1GB
612
613Note: not recommended to use both pagesizes in concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100614
Jakub Pavlik5398d872017-02-13 22:30:47 +0100615Intel SR-IOV
616~~~~~~~~~~~~
617
618PCI-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.
619
620.. code-block:: yaml
621
622 linux:
623 system:
624 kernel:
625 sriov: True
626 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
627 rc:
628 local: |
629 #!/bin/sh -e
630 # Enable 7 VF on eth1
631 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
632 exit 0
633
Jakub Pavlik6c9ead12017-02-16 21:53:13 +0100634Isolate CPU options
635~~~~~~~~~~~~~~~~~~~
636
637Remove the specified CPUs, as defined by the cpu_number values, from the general kernel
638SMP balancing and scheduler algroithms. The only way to move a process onto or off an
639"isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the
640maximum value is 1 less than the number of CPUs on the system.
641
642.. code-block:: yaml
643
644 linux:
645 system:
646 kernel:
647 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100648
Filip Pytlounf5383a42015-10-06 16:28:32 +0200649Repositories
650~~~~~~~~~~~~
651
652RedHat based Linux with additional OpenStack repo
653
654.. code-block:: yaml
655
656 linux:
657 system:
658 ...
659 repo:
660 rdo-icehouse:
661 enabled: true
662 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
663 pgpcheck: 0
664
665Ensure system repository to use czech Debian mirror (``default: true``)
666Also pin it's packages with priority 900.
667
668.. code-block:: yaml
669
670 linux:
671 system:
672 repo:
673 debian:
674 default: true
675 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
676 # Import signing key from URL if needed
677 key_url: "http://dummy.com/public.gpg"
678 pin:
679 - pin: 'origin "ftp.cz.debian.org"'
680 priority: 900
681 package: '*'
682
Petr Michalec10462bb2017-03-23 19:18:08 +0100683
684Package manager proxy setup globally:
685
686.. code-block:: yaml
687
688 linux:
689 system:
690 ...
691 repo:
692 apt-mk:
693 source: "deb http://apt-mk.mirantis.com/ stable main salt"
694 ...
695 proxy:
696 pkg:
697 enabled: true
698 ftp: ftp://ftp-proxy-for-apt.host.local:2121
699 ...
700 # NOTE: Global defaults for any other componet that configure proxy on the system.
701 # If your environment has just one simple proxy, set it on linux:system:proxy.
702 #
703 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
704 # as for https and http
705 ftp: ftp://proxy.host.local:2121
706 http: http://proxy.host.local:3142
707 https: https://proxy.host.local:3143
708
709Package manager proxy setup per repository:
710
711.. code-block:: yaml
712
713 linux:
714 system:
715 ...
716 repo:
717 debian:
718 source: "deb http://apt-mk.mirantis.com/ stable main salt"
719 ...
720 apt-mk:
721 source: "deb http://apt-mk.mirantis.com/ stable main salt"
722 # per repository proxy
723 proxy:
724 enabled: true
725 http: http://maas-01:8080
726 https: http://maas-01:8080
727 ...
728 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600729 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +0100730 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
731 pkg:
732 enabled: true
733 ftp: ftp://proxy.host.local:2121
734 #http: http://proxy.host.local:3142
735 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600736 ...
Petr Michalec10462bb2017-03-23 19:18:08 +0100737 # global system fallback system defaults
738 ftp: ftp://proxy.host.local:2121
739 http: http://proxy.host.local:3142
740 https: https://proxy.host.local:3143
741
742
Jiri Broulik34a29b42017-04-25 14:42:54 +0200743Remove all repositories:
744
745.. code-block:: yaml
746
747 linux:
748 system:
749 purge_repos: true
750
Filip Pytlounc512e6c2017-11-22 14:28:10 +0100751Setup custom apt config options:
752
753.. code-block:: yaml
754
755 linux:
756 system:
757 apt:
758 config:
759 compression-workaround:
760 "Acquire::CompressionTypes::Order": "gz"
761 docker-clean:
762 "DPkg::Post-Invoke":
763 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
764 "APT::Update::Post-Invoke":
765 - "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 +0200766
Petr Michalec10462bb2017-03-23 19:18:08 +0100767RC
768~~
769
Jakub Pavlik78859382016-01-21 11:26:39 +0100770rc.local example
771
772.. code-block:: yaml
773
774 linux:
775 system:
776 rc:
777 local: |
778 #!/bin/sh -e
779 #
780 # rc.local
781 #
782 # This script is executed at the end of each multiuser runlevel.
783 # Make sure that the script will "exit 0" on success or any other
784 # value on error.
785 #
786 # In order to enable or disable this script just change the execution
787 # bits.
788 #
789 # By default this script does nothing.
790 exit 0
791
Petr Michalec10462bb2017-03-23 19:18:08 +0100792
Filip Pytloun1f40dac2016-01-22 15:52:57 +0100793Prompt
794~~~~~~
795
796Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every
797user can have different prompt.
798
799.. code-block:: yaml
800
801 linux:
802 system:
803 prompt:
804 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\\]
805 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
806
807On Debian systems to set prompt system-wide it's necessary to remove setting
808PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from
809``/etc/skel/.bashrc``). This formula will do this automatically, but will not
Filip Pytlound9b68da2016-01-22 15:58:41 +0100810touch existing user's ``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +0100811
Filip Pytlouneef11c12016-03-25 11:00:23 +0100812Bash
813~~~~
814
815Fix bash configuration to preserve history across sessions (like ZSH does by
816default).
817
818.. code-block:: yaml
819
820 linux:
821 system:
822 bash:
823 preserve_history: true
824
Dmitry Teselkin949398e2018-05-03 15:50:00 +0300825Login banner message
826~~~~~~~~~~~~~~~~~~~~
827
828/etc/issue is a text file which contains a message or system
829identification to be printed before the login prompt. It may contain
830various @char and \char sequences, if supported by the getty-type
831program employed on the system.
832
833Setting logon banner message is easy:
834
835.. code-block:: yaml
836
837 liunx:
838 system:
839 banner:
840 enabled: true
841 contents: |
842 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
843
844 You must have explicit, authorized permission to access or configure this
845 device. Unauthorized attempts and actions to access or use this system may
846 result in civil and/or criminal penalties.
847 All activities performed on this system are logged and monitored.
848
Filip Pytloune874dfb2016-01-22 16:57:34 +0100849Message of the day
850~~~~~~~~~~~~~~~~~~
851
Dmitry Teselkin538c8242018-04-02 16:13:37 +0300852``pam_motd`` from package ``libpam-modules`` is used for dynamic messages of the
Filip Pytloune874dfb2016-01-22 16:57:34 +0100853day. Setting custom motd will cleanup existing ones.
854
Dmitry Teselkin538c8242018-04-02 16:13:37 +0300855Setting static motd will replace existing ``/etc/motd`` and remove scripts from
856``/etc/update-motd.d``.
857
858Setting static motd:
859
860.. code-block:: yaml
861
862 linux:
863 system:
864 motd: |
865 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
866
867 You must have explicit, authorized permission to access or configure this
868 device. Unauthorized attempts and actions to access or use this system may
869 result in civil and/or criminal penalties.
870 All activities performed on this system are logged and monitored.
871
872Setting dynamic motd:
873
Filip Pytloune874dfb2016-01-22 16:57:34 +0100874.. code-block:: yaml
875
876 linux:
877 system:
878 motd:
879 - release: |
880 #!/bin/sh
881 [ -r /etc/lsb-release ] && . /etc/lsb-release
882
883 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
884 # Fall back to using the very slow lsb_release utility
885 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
886 fi
887
888 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
889 - warning: |
890 #!/bin/sh
891 printf "This is [company name] network.\n"
892 printf "Unauthorized access strictly prohibited.\n"
893
Marek Celoud713e9072017-05-18 15:20:25 +0200894Services
895~~~~~~~~
896
897Stop and disable linux service:
898
899.. code-block:: yaml
900
901 linux:
902 system:
903 service:
904 apt-daily.timer:
905 status: dead
906
907Possible status is dead (disable service by default), running (enable service by default), enabled, disabled.
908
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +0300909Linux with atop service:
910
911.. code-block:: yaml
912
913 linux:
914 system:
915 atop:
916 enabled: true
917 interval: 20
918 logpath: "/var/log/atop"
919 outfile: "/var/log/atop/daily.log"
920
Filip Pytloun2f70b492016-02-19 15:55:25 +0100921RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +0100922^^^^^^^^^^^^^
Filip Pytloun2f70b492016-02-19 15:55:25 +0100923
924Unfortunately ``update-motd`` is currently not available for RHEL so there's
925no native support for dynamic motd.
926You can still set static one, only pillar structure differs:
927
928.. code-block:: yaml
929
930 linux:
931 system:
932 motd: |
933 This is [company name] network.
934 Unauthorized access strictly prohibited.
935
Filip Pytloun8296bb92016-02-19 18:42:09 +0100936Haveged
937~~~~~~~
938
939If you are running headless server and are low on entropy, it may be a good
940idea to setup Haveged.
941
942.. code-block:: yaml
943
944 linux:
945 system:
946 haveged:
947 enabled: true
948
Filip Pytlounf5383a42015-10-06 16:28:32 +0200949Linux network
950-------------
951
952Linux with network manager
953
954.. code-block:: yaml
955
956 linux:
957 network:
958 enabled: true
959 network_manager: true
960
961Linux with default static network interfaces, default gateway interface and DNS servers
962
963.. code-block:: yaml
964
965 linux:
966 network:
967 enabled: true
968 interface:
969 eth0:
970 enabled: true
971 type: eth
972 address: 192.168.0.102
973 netmask: 255.255.255.0
974 gateway: 192.168.0.1
975 name_servers:
976 - 8.8.8.8
977 - 8.8.4.4
978 mtu: 1500
979
jan kaufman6d30adf2016-01-18 17:30:12 +0100980Linux with bonded interfaces and disabled NetworkManager
Filip Pytlounf5383a42015-10-06 16:28:32 +0200981
982.. code-block:: yaml
983
984 linux:
985 network:
986 enabled: true
987 interface:
988 eth0:
989 type: eth
990 ...
991 eth1:
992 type: eth
993 ...
994 bond0:
995 enabled: true
996 type: bond
997 address: 192.168.0.102
998 netmask: 255.255.255.0
999 mtu: 1500
1000 use_in:
1001 - interface: ${linux:interface:eth0}
1002 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +01001003 network_manager:
1004 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001005
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001006Linux with vlan interface_params
1007
1008.. code-block:: yaml
1009
1010 linux:
1011 network:
1012 enabled: true
1013 interface:
1014 vlan69:
1015 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001016 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001017 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001018
Filip Pytlounf5383a42015-10-06 16:28:32 +02001019Linux with wireless interface parameters
1020
1021.. code-block:: yaml
1022
1023 linux:
1024 network:
1025 enabled: true
1026 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001027 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001028 interface:
1029 wlan0:
1030 type: eth
1031 wireless:
1032 essid: example
1033 key: example_key
1034 security: wpa
1035 priority: 1
1036
1037Linux networks with routes defined
1038
1039.. code-block:: yaml
1040
1041 linux:
1042 network:
1043 enabled: true
1044 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001045 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001046 interface:
1047 eth0:
1048 type: eth
1049 route:
1050 default:
1051 address: 192.168.0.123
1052 netmask: 255.255.255.0
1053 gateway: 192.168.0.1
1054
1055Native Linux Bridges
1056
1057.. code-block:: yaml
1058
1059 linux:
1060 network:
1061 interface:
1062 eth1:
1063 enabled: true
1064 type: eth
1065 proto: manual
1066 up_cmds:
1067 - ip address add 0/0 dev $IFACE
1068 - ip link set $IFACE up
1069 down_cmds:
1070 - ip link set $IFACE down
1071 br-ex:
1072 enabled: true
1073 type: bridge
1074 address: ${linux:network:host:public_local:address}
1075 netmask: 255.255.255.0
1076 use_interfaces:
1077 - eth1
1078
1079OpenVswitch Bridges
1080
1081.. code-block:: yaml
1082
1083 linux:
1084 network:
1085 bridge: openvswitch
1086 interface:
1087 eth1:
1088 enabled: true
1089 type: eth
1090 proto: manual
1091 up_cmds:
1092 - ip address add 0/0 dev $IFACE
1093 - ip link set $IFACE up
1094 down_cmds:
1095 - ip link set $IFACE down
1096 br-ex:
1097 enabled: true
1098 type: bridge
1099 address: ${linux:network:host:public_local:address}
1100 netmask: 255.255.255.0
1101 use_interfaces:
1102 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001103 br-prv:
1104 enabled: true
1105 type: ovs_bridge
1106 mtu: 65000
1107 br-ens7:
1108 enabled: true
1109 name: br-ens7
1110 type: ovs_bridge
1111 proto: manual
1112 mtu: 9000
1113 use_interfaces:
1114 - ens7
1115 patch-br-ens7-br-prv:
1116 enabled: true
1117 name: ens7-prv
1118 ovs_type: ovs_port
1119 type: ovs_port
1120 bridge: br-ens7
1121 port_type: patch
1122 peer: prv-ens7
1123 mtu: 65000
1124 patch-br-prv-br-ens7:
1125 enabled: true
1126 name: prv-ens7
1127 bridge: br-prv
1128 ovs_type: ovs_port
1129 type: ovs_port
1130 port_type: patch
1131 peer: ens7-prv
1132 mtu: 65000
1133 ens7:
1134 enabled: true
1135 name: ens7
1136 proto: manual
1137 ovs_port_type: OVSPort
1138 type: ovs_port
1139 ovs_bridge: br-ens7
1140 bridge: br-ens7
Filip Pytlounf5383a42015-10-06 16:28:32 +02001141
Petr Jediný8f8ae542017-07-13 16:19:12 +02001142Debian manual proto interfaces
1143
1144When you are changing interface proto from static in up state to manual, you
1145may need to flush ip addresses. For example, if you want to use the interface
1146and the ip on the bridge. This can be done by setting the ``ipflush_onchange``
1147to true.
1148
1149.. code-block:: yaml
1150
1151 linux:
1152 network:
1153 interface:
1154 eth1:
1155 enabled: true
1156 type: eth
1157 proto: manual
1158 mtu: 9100
1159 ipflush_onchange: true
1160
Jiri Broulik1a191e32018-01-15 15:54:21 +01001161Debian static proto interfaces
1162
1163When you are changing interface proto from dhcp in up state to static, you
1164may need to flush ip addresses and restart interface to assign ip address from a managed file.
1165For example, if you want to use the interface and the ip on the bridge.
1166This can be done by setting the ``ipflush_onchange`` with combination
1167``restart_on_ipflush`` param set to to true.
1168
1169.. code-block:: yaml
1170
1171 linux:
1172 network:
1173 interface:
1174 eth1:
1175 enabled: true
1176 type: eth
1177 proto: static
1178 address: 10.1.0.22
1179 netmask: 255.255.255.0
1180 ipflush_onchange: true
1181 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001182
Petr Jedinýd577cb52017-06-28 20:17:49 +02001183Concatinating and removing interface files
1184
1185Debian based distributions have `/etc/network/interfaces.d/` directory, where
1186you can store configuration of network interfaces in separate files. You can
1187concatinate the files to the defined destination when needed, this operation
1188removes the file from the `/etc/network/interfaces.d/`. If you just need to
1189remove iface files, you can use the `remove_iface_files` key.
1190
1191.. code-block:: yaml
1192
1193 linux:
1194 network:
1195 concat_iface_files:
1196 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1197 dst: '/etc/network/interfaces'
1198 remove_iface_files:
1199 - '/etc/network/interfaces.d/90-custom.cfg'
1200
1201
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001202DHCP client configuration
1203
1204None of the keys is mandatory, include only those you really need. For full list
1205of available options under send, supersede, prepend, append refer to dhcp-options(5)
1206
1207.. code-block:: yaml
1208
1209 linux:
1210 network:
1211 dhclient:
1212 enabled: true
1213 backoff_cutoff: 15
1214 initial_interval: 10
1215 reboot: 10
1216 retry: 60
1217 select_timeout: 0
1218 timeout: 120
1219 send:
1220 - option: host-name
1221 declaration: "= gethostname()"
1222 supersede:
1223 - option: host-name
1224 declaration: "spaceship"
1225 - option: domain-name
1226 declaration: "domain.home"
1227 #- option: arp-cache-timeout
1228 # declaration: 20
1229 prepend:
1230 - option: domain-name-servers
1231 declaration:
1232 - 8.8.8.8
1233 - 8.8.4.4
1234 - option: domain-search
1235 declaration:
1236 - example.com
1237 - eng.example.com
1238 #append:
1239 #- option: domain-name-servers
1240 # declaration: 127.0.0.1
1241 # ip or subnet to reject dhcp offer from
1242 reject:
1243 - 192.33.137.209
1244 - 10.0.2.0/24
1245 request:
1246 - subnet-mask
1247 - broadcast-address
1248 - time-offset
1249 - routers
1250 - domain-name
1251 - domain-name-servers
1252 - domain-search
1253 - host-name
1254 - dhcp6.name-servers
1255 - dhcp6.domain-search
1256 - dhcp6.fqdn
1257 - dhcp6.sntp-servers
1258 - netbios-name-servers
1259 - netbios-scope
1260 - interface-mtu
1261 - rfc3442-classless-static-routes
1262 - ntp-servers
1263 require:
1264 - subnet-mask
1265 - domain-name-servers
1266 # if per interface configuration required add below
1267 interface:
1268 ens2:
1269 initial_interval: 11
1270 reject:
1271 - 192.33.137.210
1272 ens3:
1273 initial_interval: 12
1274 reject:
1275 - 192.33.137.211
1276
Petr Michaleceb14b552017-06-01 10:27:05 +02001277Linux network systemd settings:
1278
1279.. code-block:: yaml
1280
1281 linux:
1282 network:
1283 ...
1284 systemd:
1285 link:
1286 10-iface-dmz:
1287 Match:
1288 MACAddress: c8:5b:67:fa:1a:af
1289 OriginalName: eth0
1290 Link:
1291 Name: dmz0
1292 netdev:
1293 20-bridge-dmz:
1294 match:
1295 name: dmz0
1296 network:
1297 mescription: bridge
1298 bridge: br-dmz0
1299 network:
1300 # works with lowercase, keys are by default capitalized
1301 40-dhcp:
1302 match:
1303 name: '*'
1304 network:
1305 DHCP: yes
1306
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001307
Petr Michalec10462bb2017-03-23 19:18:08 +01001308Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001309
Ales Komarek417e8c52017-08-25 15:10:29 +02001310Use ``/etc/environment`` for static system wide variable assignment after
1311boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001312
1313.. code-block:: yaml
1314
1315 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001316 system:
1317 env:
1318 BOB_VARIABLE: Alice
1319 ...
1320 BOB_PATH:
1321 - /srv/alice/bin
1322 - /srv/bob/bin
1323 ...
1324 ftp_proxy: none
1325 http_proxy: http://global-http-proxy.host.local:8080
1326 https_proxy: ${linux:system:proxy:https}
1327 no_proxy:
1328 - 192.168.0.80
1329 - 192.168.1.80
1330 - .domain.com
1331 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02001332 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001333 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001334 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01001335 ftp: ftp://proxy.host.local:2121
1336 http: http://proxy.host.local:3142
1337 https: https://proxy.host.local:3143
1338 noproxy:
1339 - .domain.com
1340 - .local
1341
1342Configure profile.d scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01001343
Ales Komarek417e8c52017-08-25 15:10:29 +02001344The profile.d scripts are being sourced during .sh execution and support
1345variable expansion in opposite to /etc/environment global settings in
1346``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01001347
1348.. code-block:: yaml
1349
1350 linux:
1351 system:
1352 profile:
1353 locales: |
1354 export LANG=C
1355 export LC_ALL=C
1356 ...
1357 vi_flavors.sh: |
1358 export PAGER=view
1359 export EDITOR=vim
1360 alias vi=vim
1361 shell_locales.sh: |
1362 export LANG=en_US
1363 export LC_ALL=en_US.UTF-8
1364 shell_proxies.sh: |
1365 export FTP_PROXY=ftp://127.0.3.3:2121
1366 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02001367
1368Linux with hosts
1369
Filip Pytloun86506fe2017-01-26 14:36:16 +01001370Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
1371that are not defined in model except defaults for both IPv4 and IPv6 localhost
1372and hostname + fqdn.
Ales Komarek417e8c52017-08-25 15:10:29 +02001373
Filip Pytloun86506fe2017-01-26 14:36:16 +01001374It's good to use this option if you want to ensure /etc/hosts is always in a
1375clean state however it's not enabled by default for safety.
1376
Filip Pytlounf5383a42015-10-06 16:28:32 +02001377.. code-block:: yaml
1378
1379 linux:
1380 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001381 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001382 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001383 # No need to define this one if purge_hosts is true
1384 hostname:
1385 address: 127.0.1.1
1386 names:
1387 - ${linux:network:fqdn}
1388 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02001389 node1:
1390 address: 192.168.10.200
1391 names:
1392 - node2.domain.com
1393 - service2.domain.com
1394 node2:
1395 address: 192.168.10.201
1396 names:
1397 - node2.domain.com
1398 - service2.domain.com
1399
Ales Komarek417e8c52017-08-25 15:10:29 +02001400Linux with hosts collected from mine
1401
1402In this case all dns records defined within infrastrucuture will be passed to
1403local hosts records or any DNS server. Only hosts with `grain` parameter to
1404true will be propagated to the mine.
1405
1406.. code-block:: yaml
1407
1408 linux:
1409 network:
1410 purge_hosts: true
1411 mine_dns_records: true
1412 host:
1413 node1:
1414 address: 192.168.10.200
1415 grain: true
1416 names:
1417 - node2.domain.com
1418 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01001419
Filip Pytlounde9bea52016-01-11 15:39:10 +01001420Setup resolv.conf, nameservers, domain and search domains
1421
1422.. code-block:: yaml
1423
1424 linux:
1425 network:
1426 resolv:
1427 dns:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001428 - 8.8.4.4
1429 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01001430 domain: my.example.com
1431 search:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001432 - my.example.com
1433 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01001434 options:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001435 - ndots: 5
1436 - timeout: 2
1437 - attempts: 2
Filip Pytlounde9bea52016-01-11 15:39:10 +01001438
Ales Komarek417e8c52017-08-25 15:10:29 +02001439setting custom TX queue length for tap interfaces
Andrii Petrenko735761d2017-03-21 17:17:35 -07001440
1441.. code-block:: yaml
1442
1443 linux:
1444 network:
1445 tap_custom_txqueuelen: 10000
1446
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001447DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001448
1449**DPDK OVS NIC**
1450
1451.. code-block:: yaml
1452
1453 linux:
1454 network:
1455 bridge: openvswitch
1456 dpdk:
1457 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001458 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001459 openvswitch:
1460 pmd_cpu_mask: "0x6"
1461 dpdk_socket_mem: "1024,1024"
1462 dpdk_lcore_mask: "0x400"
1463 memory_channels: 2
1464 interface:
1465 dpkd0:
1466 name: ${_param:dpdk_nic}
1467 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001468 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001469 enabled: true
1470 type: dpdk_ovs_port
1471 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001472 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001473 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01001474 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001475 br-prv:
1476 enabled: true
1477 type: dpdk_ovs_bridge
1478
1479**DPDK OVS Bond**
1480
1481.. code-block:: yaml
1482
1483 linux:
1484 network:
1485 bridge: openvswitch
1486 dpdk:
1487 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001488 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001489 openvswitch:
1490 pmd_cpu_mask: "0x6"
1491 dpdk_socket_mem: "1024,1024"
1492 dpdk_lcore_mask: "0x400"
1493 memory_channels: 2
1494 interface:
1495 dpdk_second_nic:
1496 name: ${_param:primary_second_nic}
1497 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001498 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001499 bond: dpdkbond0
1500 enabled: true
1501 type: dpdk_ovs_port
1502 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001503 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001504 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001505 dpdk_first_nic:
1506 name: ${_param:primary_first_nic}
1507 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001508 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001509 bond: dpdkbond0
1510 enabled: true
1511 type: dpdk_ovs_port
1512 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001513 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001514 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001515 dpdkbond0:
1516 enabled: true
1517 bridge: br-prv
1518 type: dpdk_ovs_bond
1519 mode: active-backup
1520 br-prv:
1521 enabled: true
1522 type: dpdk_ovs_bridge
1523
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01001524**DPDK OVS LACP Bond with vlan tag**
1525
1526.. code-block:: yaml
1527
1528 linux:
1529 network:
1530 bridge: openvswitch
1531 dpdk:
1532 enabled: true
1533 driver: uio
1534 openvswitch:
1535 pmd_cpu_mask: "0x6"
1536 dpdk_socket_mem: "1024,1024"
1537 dpdk_lcore_mask: "0x400"
1538 memory_channels: "2"
1539 interface:
1540 eth3:
1541 enabled: true
1542 type: eth
1543 proto: manual
1544 name: ${_param:tenant_first_nic}
1545 eth4:
1546 enabled: true
1547 type: eth
1548 proto: manual
1549 name: ${_param:tenant_second_nic}
1550 dpdk0:
1551 name: ${_param:tenant_first_nic}
1552 pci: "0000:81:00.0"
1553 driver: igb_uio
1554 bond: bond1
1555 enabled: true
1556 type: dpdk_ovs_port
1557 n_rxq: 2
1558 dpdk1:
1559 name: ${_param:tenant_second_nic}
1560 pci: "0000:81:00.1"
1561 driver: igb_uio
1562 bond: bond1
1563 enabled: true
1564 type: dpdk_ovs_port
1565 n_rxq: 2
1566 bond1:
1567 enabled: true
1568 bridge: br-prv
1569 type: dpdk_ovs_bond
1570 mode: balance-slb
1571 br-prv:
1572 enabled: true
1573 type: dpdk_ovs_bridge
1574 tag: ${_param:tenant_vlan}
1575 address: ${_param:tenant_address}
1576 netmask: ${_param:tenant_network_netmask}
1577
Jakub Pavlikaa759062017-03-13 15:57:26 +01001578**DPDK OVS bridge for VXLAN**
1579
1580If VXLAN is used as tenant segmentation then ip address must be set on br-prv
1581
1582.. code-block:: yaml
1583
1584 linux:
1585 network:
1586 ...
1587 interface:
1588 br-prv:
1589 enabled: true
1590 type: dpdk_ovs_bridge
1591 address: 192.168.50.0
1592 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04001593 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01001594 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001595
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02001596
1597
1598**DPDK OVS bridge with Linux network interface**
1599
1600.. code-block:: yaml
1601
1602 linux:
1603 network:
1604 ...
1605 interface:
1606 eth0:
1607 type: eth
1608 ovs_bridge: br-prv
1609 ...
1610 br-prv:
1611 enabled: true
1612 type: dpdk_ovs_bridge
1613 ...
1614
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001615Linux storage
1616-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02001617
1618Linux with mounted Samba
1619
1620.. code-block:: yaml
1621
1622 linux:
1623 storage:
1624 enabled: true
1625 mount:
1626 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01001627 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001628 - path: /media/myuser/public/
1629 - device: //192.168.0.1/storage
1630 - file_system: cifs
1631 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
1632
Jiri Broulikb017f932017-03-31 13:55:36 +02001633NFS mount
1634
1635.. code-block:: yaml
1636
1637 linux:
1638 storage:
1639 enabled: true
1640 mount:
1641 nfs_glance:
1642 enabled: true
1643 path: /var/lib/glance/images
1644 device: 172.16.10.110:/var/nfs/glance
1645 file_system: nfs
1646 opts: rw,sync
1647
1648
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001649File swap configuration
Filip Pytlounf5383a42015-10-06 16:28:32 +02001650
1651.. code-block:: yaml
1652
1653 linux:
1654 storage:
1655 enabled: true
1656 swap:
1657 file:
1658 enabled: true
1659 engine: file
1660 device: /swapfile
1661 size: 1024
1662
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001663Partition swap configuration
Lachlan Evenson30676512016-01-22 15:43:28 -08001664
1665.. code-block:: yaml
1666
1667 linux:
1668 storage:
1669 enabled: true
1670 swap:
1671 partition:
1672 enabled: true
1673 engine: partition
1674 device: /dev/vg0/swap
1675
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001676LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
1677
1678.. code-block:: yaml
1679
1680 parameters:
1681 linux:
1682 storage:
1683 mount:
1684 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01001685 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001686 device: /dev/vg1/data
1687 file_system: ext4
1688 path: /mnt/data
1689 lvm:
1690 vg1:
1691 enabled: true
1692 devices:
1693 - /dev/sdb
1694 volume:
1695 data:
1696 size: 40G
1697 mount: ${linux:storage:mount:data}
1698
Jakub Pavlik4f742142017-08-08 15:05:50 +02001699Create partitions on disk. Specify size in MB. It expects empty
Piotr Krukd51911b2017-12-04 11:27:08 +01001700disk without any existing partitions. (set startsector=1, if you want to start partitions from 2048)
Jakub Pavlik4f742142017-08-08 15:05:50 +02001701
1702.. code-block:: yaml
1703
1704 linux:
1705 storage:
1706 disk:
1707 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01001708 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02001709 name: /dev/loop1
1710 type: gpt
1711 partitions:
1712 - size: 200 #size in MB
1713 type: fat32
1714 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02001715 mkfs: True
1716 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02001717 /dev/vda1:
1718 partitions:
1719 - size: 5
1720 type: ext2
1721 - size: 10
1722 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02001723
1724Multipath with Fujitsu Eternus DXL
1725
1726.. code-block:: yaml
1727
1728 parameters:
1729 linux:
1730 storage:
1731 multipath:
1732 enabled: true
1733 blacklist_devices:
1734 - /dev/sda
1735 - /dev/sdb
1736 backends:
1737 - fujitsu_eternus_dxl
1738
1739Multipath with Hitachi VSP 1000
1740
1741.. code-block:: yaml
1742
1743 parameters:
1744 linux:
1745 storage:
1746 multipath:
1747 enabled: true
1748 blacklist_devices:
1749 - /dev/sda
1750 - /dev/sdb
1751 backends:
1752 - hitachi_vsp1000
1753
1754Multipath with IBM Storwize
1755
1756.. code-block:: yaml
1757
1758 parameters:
1759 linux:
1760 storage:
1761 multipath:
1762 enabled: true
1763 blacklist_devices:
1764 - /dev/sda
1765 - /dev/sdb
1766 backends:
1767 - ibm_storwize
1768
1769Multipath with multiple backends
1770
1771.. code-block:: yaml
1772
1773 parameters:
1774 linux:
1775 storage:
1776 multipath:
1777 enabled: true
1778 blacklist_devices:
1779 - /dev/sda
1780 - /dev/sdb
1781 - /dev/sdc
1782 - /dev/sdd
1783 backends:
1784 - ibm_storwize
1785 - fujitsu_eternus_dxl
1786 - hitachi_vsp1000
1787
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001788PAM LDAP integration
1789
1790.. code-block:: yaml
1791
1792 parameters:
1793 linux:
1794 system:
1795 auth:
1796 enabled: true
1797 ldap:
1798 enabled: true
1799 binddn: cn=bind,ou=service_users,dc=example,dc=com
1800 bindpw: secret
1801 uri: ldap://127.0.0.1
1802 base: ou=users,dc=example,dc=com
1803 ldap_version: 3
1804 pagesize: 65536
1805 referrals: off
1806 filter:
1807 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1808 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1809 group: (&(objectClass=group)(gidNumber=*))
1810
Ales Komareka634f4b2016-10-02 13:11:04 +02001811Disabled multipath (the default setup)
1812
1813.. code-block:: yaml
1814
1815 parameters:
1816 linux:
1817 storage:
1818 multipath:
1819 enabled: false
1820
Simon Pasquier375001e2017-01-26 13:22:33 +01001821Linux with local loopback device
1822
1823.. code-block:: yaml
1824
1825 linux:
1826 storage:
1827 loopback:
1828 disk1:
1829 file: /srv/disk1
1830 size: 50G
1831
Filip Pytlounb2c8f852016-11-21 17:03:43 +01001832External config generation
1833--------------------------
1834
1835You are able to use config support metadata between formulas and only generate
1836config files for external use, eg. docker, etc.
1837
1838.. code-block:: yaml
1839
1840 parameters:
1841 linux:
1842 system:
1843 config:
1844 pillar:
1845 jenkins:
1846 master:
1847 home: /srv/volumes/jenkins
1848 approved_scripts:
1849 - method java.net.URL openConnection
1850 credentials:
1851 - type: username_password
1852 scope: global
1853 id: test
1854 desc: Testing credentials
1855 username: test
1856 password: test
1857
Vladimir Ereminccf28842017-04-10 23:52:10 +03001858Netconsole Remote Kernel Logging
1859--------------------------------
1860
1861Netconsole logger could be configured for configfs-enabled kernels
1862(`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in
1863runtime (if network is already configured), and on-boot after interface
1864initialization. Notes:
1865
1866 * receiver could be located only in same L3 domain
1867 (or you need to configure gateway MAC manually)
1868 * receiver's MAC is detected only on configuration time
1869 * using broadcast MAC is not recommended
1870
1871.. code-block:: yaml
1872
1873 parameters:
1874 linux:
1875 system:
1876 netconsole:
1877 enabled: true
1878 port: 514 (optional)
1879 loglevel: debug (optional)
1880 target:
1881 192.168.0.1:
1882 interface: bond0
1883 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02001884
Filip Pytlounf5383a42015-10-06 16:28:32 +02001885Usage
1886=====
1887
1888Set mtu of network interface eth0 to 1400
1889
1890.. code-block:: bash
1891
1892 ip link set dev eth0 mtu 1400
1893
1894Read more
1895=========
1896
1897* https://www.archlinux.org/
1898* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
Filip Pytloun018f8712017-02-02 13:02:03 +01001899
1900Documentation and Bugs
1901======================
1902
1903To learn how to install and update salt-formulas, consult the documentation
1904available online at:
1905
1906 http://salt-formulas.readthedocs.io/
1907
1908In the unfortunate event that bugs are discovered, they should be reported to
1909the appropriate issue tracker. Use Github issue tracker for specific salt
1910formula:
1911
1912 https://github.com/salt-formulas/salt-formula-linux/issues
1913
1914For feature requests, bug reports or blueprints affecting entire ecosystem,
1915use Launchpad salt-formulas project:
1916
1917 https://launchpad.net/salt-formulas
1918
1919You can also join salt-formulas-users team and subscribe to mailing list:
1920
1921 https://launchpad.net/~salt-formulas-users
1922
1923Developers wishing to work on the salt-formulas projects should always base
1924their work on master branch and submit pull request against specific formula.
1925
1926 https://github.com/salt-formulas/salt-formula-linux
1927
1928Any questions or feedback is always welcome so feel free to join our IRC
1929channel:
1930
1931 #salt-formulas @ irc.freenode.net