blob: 2492aaf382a0284cac83411ce9edb86a6d2fd019 [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
Filip Pytloune874dfb2016-01-22 16:57:34 +0100825Message of the day
826~~~~~~~~~~~~~~~~~~
827
Dmitry Teselkin538c8242018-04-02 16:13:37 +0300828``pam_motd`` from package ``libpam-modules`` is used for dynamic messages of the
Filip Pytloune874dfb2016-01-22 16:57:34 +0100829day. Setting custom motd will cleanup existing ones.
830
Dmitry Teselkin538c8242018-04-02 16:13:37 +0300831Setting static motd will replace existing ``/etc/motd`` and remove scripts from
832``/etc/update-motd.d``.
833
834Setting static motd:
835
836.. code-block:: yaml
837
838 linux:
839 system:
840 motd: |
841 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
842
843 You must have explicit, authorized permission to access or configure this
844 device. Unauthorized attempts and actions to access or use this system may
845 result in civil and/or criminal penalties.
846 All activities performed on this system are logged and monitored.
847
848Setting dynamic motd:
849
Filip Pytloune874dfb2016-01-22 16:57:34 +0100850.. code-block:: yaml
851
852 linux:
853 system:
854 motd:
855 - release: |
856 #!/bin/sh
857 [ -r /etc/lsb-release ] && . /etc/lsb-release
858
859 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
860 # Fall back to using the very slow lsb_release utility
861 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
862 fi
863
864 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
865 - warning: |
866 #!/bin/sh
867 printf "This is [company name] network.\n"
868 printf "Unauthorized access strictly prohibited.\n"
869
Marek Celoud713e9072017-05-18 15:20:25 +0200870Services
871~~~~~~~~
872
873Stop and disable linux service:
874
875.. code-block:: yaml
876
877 linux:
878 system:
879 service:
880 apt-daily.timer:
881 status: dead
882
883Possible status is dead (disable service by default), running (enable service by default), enabled, disabled.
884
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +0300885Linux with atop service:
886
887.. code-block:: yaml
888
889 linux:
890 system:
891 atop:
892 enabled: true
893 interval: 20
894 logpath: "/var/log/atop"
895 outfile: "/var/log/atop/daily.log"
896
Filip Pytloun2f70b492016-02-19 15:55:25 +0100897RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +0100898^^^^^^^^^^^^^
Filip Pytloun2f70b492016-02-19 15:55:25 +0100899
900Unfortunately ``update-motd`` is currently not available for RHEL so there's
901no native support for dynamic motd.
902You can still set static one, only pillar structure differs:
903
904.. code-block:: yaml
905
906 linux:
907 system:
908 motd: |
909 This is [company name] network.
910 Unauthorized access strictly prohibited.
911
Filip Pytloun8296bb92016-02-19 18:42:09 +0100912Haveged
913~~~~~~~
914
915If you are running headless server and are low on entropy, it may be a good
916idea to setup Haveged.
917
918.. code-block:: yaml
919
920 linux:
921 system:
922 haveged:
923 enabled: true
924
Filip Pytlounf5383a42015-10-06 16:28:32 +0200925Linux network
926-------------
927
928Linux with network manager
929
930.. code-block:: yaml
931
932 linux:
933 network:
934 enabled: true
935 network_manager: true
936
937Linux with default static network interfaces, default gateway interface and DNS servers
938
939.. code-block:: yaml
940
941 linux:
942 network:
943 enabled: true
944 interface:
945 eth0:
946 enabled: true
947 type: eth
948 address: 192.168.0.102
949 netmask: 255.255.255.0
950 gateway: 192.168.0.1
951 name_servers:
952 - 8.8.8.8
953 - 8.8.4.4
954 mtu: 1500
955
jan kaufman6d30adf2016-01-18 17:30:12 +0100956Linux with bonded interfaces and disabled NetworkManager
Filip Pytlounf5383a42015-10-06 16:28:32 +0200957
958.. code-block:: yaml
959
960 linux:
961 network:
962 enabled: true
963 interface:
964 eth0:
965 type: eth
966 ...
967 eth1:
968 type: eth
969 ...
970 bond0:
971 enabled: true
972 type: bond
973 address: 192.168.0.102
974 netmask: 255.255.255.0
975 mtu: 1500
976 use_in:
977 - interface: ${linux:interface:eth0}
978 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +0100979 network_manager:
980 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +0200981
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100982Linux with vlan interface_params
983
984.. code-block:: yaml
985
986 linux:
987 network:
988 enabled: true
989 interface:
990 vlan69:
991 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +0100992 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100993 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100994
Filip Pytlounf5383a42015-10-06 16:28:32 +0200995Linux with wireless interface parameters
996
997.. code-block:: yaml
998
999 linux:
1000 network:
1001 enabled: true
1002 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001003 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001004 interface:
1005 wlan0:
1006 type: eth
1007 wireless:
1008 essid: example
1009 key: example_key
1010 security: wpa
1011 priority: 1
1012
1013Linux networks with routes defined
1014
1015.. code-block:: yaml
1016
1017 linux:
1018 network:
1019 enabled: true
1020 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001021 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001022 interface:
1023 eth0:
1024 type: eth
1025 route:
1026 default:
1027 address: 192.168.0.123
1028 netmask: 255.255.255.0
1029 gateway: 192.168.0.1
1030
1031Native Linux Bridges
1032
1033.. code-block:: yaml
1034
1035 linux:
1036 network:
1037 interface:
1038 eth1:
1039 enabled: true
1040 type: eth
1041 proto: manual
1042 up_cmds:
1043 - ip address add 0/0 dev $IFACE
1044 - ip link set $IFACE up
1045 down_cmds:
1046 - ip link set $IFACE down
1047 br-ex:
1048 enabled: true
1049 type: bridge
1050 address: ${linux:network:host:public_local:address}
1051 netmask: 255.255.255.0
1052 use_interfaces:
1053 - eth1
1054
1055OpenVswitch Bridges
1056
1057.. code-block:: yaml
1058
1059 linux:
1060 network:
1061 bridge: openvswitch
1062 interface:
1063 eth1:
1064 enabled: true
1065 type: eth
1066 proto: manual
1067 up_cmds:
1068 - ip address add 0/0 dev $IFACE
1069 - ip link set $IFACE up
1070 down_cmds:
1071 - ip link set $IFACE down
1072 br-ex:
1073 enabled: true
1074 type: bridge
1075 address: ${linux:network:host:public_local:address}
1076 netmask: 255.255.255.0
1077 use_interfaces:
1078 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001079 br-prv:
1080 enabled: true
1081 type: ovs_bridge
1082 mtu: 65000
1083 br-ens7:
1084 enabled: true
1085 name: br-ens7
1086 type: ovs_bridge
1087 proto: manual
1088 mtu: 9000
1089 use_interfaces:
1090 - ens7
1091 patch-br-ens7-br-prv:
1092 enabled: true
1093 name: ens7-prv
1094 ovs_type: ovs_port
1095 type: ovs_port
1096 bridge: br-ens7
1097 port_type: patch
1098 peer: prv-ens7
1099 mtu: 65000
1100 patch-br-prv-br-ens7:
1101 enabled: true
1102 name: prv-ens7
1103 bridge: br-prv
1104 ovs_type: ovs_port
1105 type: ovs_port
1106 port_type: patch
1107 peer: ens7-prv
1108 mtu: 65000
1109 ens7:
1110 enabled: true
1111 name: ens7
1112 proto: manual
1113 ovs_port_type: OVSPort
1114 type: ovs_port
1115 ovs_bridge: br-ens7
1116 bridge: br-ens7
Filip Pytlounf5383a42015-10-06 16:28:32 +02001117
Petr Jediný8f8ae542017-07-13 16:19:12 +02001118Debian manual proto interfaces
1119
1120When you are changing interface proto from static in up state to manual, you
1121may need to flush ip addresses. For example, if you want to use the interface
1122and the ip on the bridge. This can be done by setting the ``ipflush_onchange``
1123to true.
1124
1125.. code-block:: yaml
1126
1127 linux:
1128 network:
1129 interface:
1130 eth1:
1131 enabled: true
1132 type: eth
1133 proto: manual
1134 mtu: 9100
1135 ipflush_onchange: true
1136
Jiri Broulik1a191e32018-01-15 15:54:21 +01001137Debian static proto interfaces
1138
1139When you are changing interface proto from dhcp in up state to static, you
1140may need to flush ip addresses and restart interface to assign ip address from a managed file.
1141For example, if you want to use the interface and the ip on the bridge.
1142This can be done by setting the ``ipflush_onchange`` with combination
1143``restart_on_ipflush`` param set to to true.
1144
1145.. code-block:: yaml
1146
1147 linux:
1148 network:
1149 interface:
1150 eth1:
1151 enabled: true
1152 type: eth
1153 proto: static
1154 address: 10.1.0.22
1155 netmask: 255.255.255.0
1156 ipflush_onchange: true
1157 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001158
Petr Jedinýd577cb52017-06-28 20:17:49 +02001159Concatinating and removing interface files
1160
1161Debian based distributions have `/etc/network/interfaces.d/` directory, where
1162you can store configuration of network interfaces in separate files. You can
1163concatinate the files to the defined destination when needed, this operation
1164removes the file from the `/etc/network/interfaces.d/`. If you just need to
1165remove iface files, you can use the `remove_iface_files` key.
1166
1167.. code-block:: yaml
1168
1169 linux:
1170 network:
1171 concat_iface_files:
1172 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1173 dst: '/etc/network/interfaces'
1174 remove_iface_files:
1175 - '/etc/network/interfaces.d/90-custom.cfg'
1176
1177
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001178DHCP client configuration
1179
1180None of the keys is mandatory, include only those you really need. For full list
1181of available options under send, supersede, prepend, append refer to dhcp-options(5)
1182
1183.. code-block:: yaml
1184
1185 linux:
1186 network:
1187 dhclient:
1188 enabled: true
1189 backoff_cutoff: 15
1190 initial_interval: 10
1191 reboot: 10
1192 retry: 60
1193 select_timeout: 0
1194 timeout: 120
1195 send:
1196 - option: host-name
1197 declaration: "= gethostname()"
1198 supersede:
1199 - option: host-name
1200 declaration: "spaceship"
1201 - option: domain-name
1202 declaration: "domain.home"
1203 #- option: arp-cache-timeout
1204 # declaration: 20
1205 prepend:
1206 - option: domain-name-servers
1207 declaration:
1208 - 8.8.8.8
1209 - 8.8.4.4
1210 - option: domain-search
1211 declaration:
1212 - example.com
1213 - eng.example.com
1214 #append:
1215 #- option: domain-name-servers
1216 # declaration: 127.0.0.1
1217 # ip or subnet to reject dhcp offer from
1218 reject:
1219 - 192.33.137.209
1220 - 10.0.2.0/24
1221 request:
1222 - subnet-mask
1223 - broadcast-address
1224 - time-offset
1225 - routers
1226 - domain-name
1227 - domain-name-servers
1228 - domain-search
1229 - host-name
1230 - dhcp6.name-servers
1231 - dhcp6.domain-search
1232 - dhcp6.fqdn
1233 - dhcp6.sntp-servers
1234 - netbios-name-servers
1235 - netbios-scope
1236 - interface-mtu
1237 - rfc3442-classless-static-routes
1238 - ntp-servers
1239 require:
1240 - subnet-mask
1241 - domain-name-servers
1242 # if per interface configuration required add below
1243 interface:
1244 ens2:
1245 initial_interval: 11
1246 reject:
1247 - 192.33.137.210
1248 ens3:
1249 initial_interval: 12
1250 reject:
1251 - 192.33.137.211
1252
Petr Michaleceb14b552017-06-01 10:27:05 +02001253Linux network systemd settings:
1254
1255.. code-block:: yaml
1256
1257 linux:
1258 network:
1259 ...
1260 systemd:
1261 link:
1262 10-iface-dmz:
1263 Match:
1264 MACAddress: c8:5b:67:fa:1a:af
1265 OriginalName: eth0
1266 Link:
1267 Name: dmz0
1268 netdev:
1269 20-bridge-dmz:
1270 match:
1271 name: dmz0
1272 network:
1273 mescription: bridge
1274 bridge: br-dmz0
1275 network:
1276 # works with lowercase, keys are by default capitalized
1277 40-dhcp:
1278 match:
1279 name: '*'
1280 network:
1281 DHCP: yes
1282
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001283
Petr Michalec10462bb2017-03-23 19:18:08 +01001284Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001285
Ales Komarek417e8c52017-08-25 15:10:29 +02001286Use ``/etc/environment`` for static system wide variable assignment after
1287boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001288
1289.. code-block:: yaml
1290
1291 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001292 system:
1293 env:
1294 BOB_VARIABLE: Alice
1295 ...
1296 BOB_PATH:
1297 - /srv/alice/bin
1298 - /srv/bob/bin
1299 ...
1300 ftp_proxy: none
1301 http_proxy: http://global-http-proxy.host.local:8080
1302 https_proxy: ${linux:system:proxy:https}
1303 no_proxy:
1304 - 192.168.0.80
1305 - 192.168.1.80
1306 - .domain.com
1307 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02001308 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001309 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001310 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01001311 ftp: ftp://proxy.host.local:2121
1312 http: http://proxy.host.local:3142
1313 https: https://proxy.host.local:3143
1314 noproxy:
1315 - .domain.com
1316 - .local
1317
1318Configure profile.d scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01001319
Ales Komarek417e8c52017-08-25 15:10:29 +02001320The profile.d scripts are being sourced during .sh execution and support
1321variable expansion in opposite to /etc/environment global settings in
1322``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01001323
1324.. code-block:: yaml
1325
1326 linux:
1327 system:
1328 profile:
1329 locales: |
1330 export LANG=C
1331 export LC_ALL=C
1332 ...
1333 vi_flavors.sh: |
1334 export PAGER=view
1335 export EDITOR=vim
1336 alias vi=vim
1337 shell_locales.sh: |
1338 export LANG=en_US
1339 export LC_ALL=en_US.UTF-8
1340 shell_proxies.sh: |
1341 export FTP_PROXY=ftp://127.0.3.3:2121
1342 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02001343
1344Linux with hosts
1345
Filip Pytloun86506fe2017-01-26 14:36:16 +01001346Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
1347that are not defined in model except defaults for both IPv4 and IPv6 localhost
1348and hostname + fqdn.
Ales Komarek417e8c52017-08-25 15:10:29 +02001349
Filip Pytloun86506fe2017-01-26 14:36:16 +01001350It's good to use this option if you want to ensure /etc/hosts is always in a
1351clean state however it's not enabled by default for safety.
1352
Filip Pytlounf5383a42015-10-06 16:28:32 +02001353.. code-block:: yaml
1354
1355 linux:
1356 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001357 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001358 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001359 # No need to define this one if purge_hosts is true
1360 hostname:
1361 address: 127.0.1.1
1362 names:
1363 - ${linux:network:fqdn}
1364 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02001365 node1:
1366 address: 192.168.10.200
1367 names:
1368 - node2.domain.com
1369 - service2.domain.com
1370 node2:
1371 address: 192.168.10.201
1372 names:
1373 - node2.domain.com
1374 - service2.domain.com
1375
Ales Komarek417e8c52017-08-25 15:10:29 +02001376Linux with hosts collected from mine
1377
1378In this case all dns records defined within infrastrucuture will be passed to
1379local hosts records or any DNS server. Only hosts with `grain` parameter to
1380true will be propagated to the mine.
1381
1382.. code-block:: yaml
1383
1384 linux:
1385 network:
1386 purge_hosts: true
1387 mine_dns_records: true
1388 host:
1389 node1:
1390 address: 192.168.10.200
1391 grain: true
1392 names:
1393 - node2.domain.com
1394 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01001395
Filip Pytlounde9bea52016-01-11 15:39:10 +01001396Setup resolv.conf, nameservers, domain and search domains
1397
1398.. code-block:: yaml
1399
1400 linux:
1401 network:
1402 resolv:
1403 dns:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001404 - 8.8.4.4
1405 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01001406 domain: my.example.com
1407 search:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001408 - my.example.com
1409 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01001410 options:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001411 - ndots: 5
1412 - timeout: 2
1413 - attempts: 2
Filip Pytlounde9bea52016-01-11 15:39:10 +01001414
Ales Komarek417e8c52017-08-25 15:10:29 +02001415setting custom TX queue length for tap interfaces
Andrii Petrenko735761d2017-03-21 17:17:35 -07001416
1417.. code-block:: yaml
1418
1419 linux:
1420 network:
1421 tap_custom_txqueuelen: 10000
1422
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001423DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001424
1425**DPDK OVS NIC**
1426
1427.. code-block:: yaml
1428
1429 linux:
1430 network:
1431 bridge: openvswitch
1432 dpdk:
1433 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001434 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001435 openvswitch:
1436 pmd_cpu_mask: "0x6"
1437 dpdk_socket_mem: "1024,1024"
1438 dpdk_lcore_mask: "0x400"
1439 memory_channels: 2
1440 interface:
1441 dpkd0:
1442 name: ${_param:dpdk_nic}
1443 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001444 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001445 enabled: true
1446 type: dpdk_ovs_port
1447 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001448 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001449 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01001450 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001451 br-prv:
1452 enabled: true
1453 type: dpdk_ovs_bridge
1454
1455**DPDK OVS Bond**
1456
1457.. code-block:: yaml
1458
1459 linux:
1460 network:
1461 bridge: openvswitch
1462 dpdk:
1463 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001464 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001465 openvswitch:
1466 pmd_cpu_mask: "0x6"
1467 dpdk_socket_mem: "1024,1024"
1468 dpdk_lcore_mask: "0x400"
1469 memory_channels: 2
1470 interface:
1471 dpdk_second_nic:
1472 name: ${_param:primary_second_nic}
1473 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001474 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001475 bond: dpdkbond0
1476 enabled: true
1477 type: dpdk_ovs_port
1478 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001479 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001480 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001481 dpdk_first_nic:
1482 name: ${_param:primary_first_nic}
1483 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001484 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001485 bond: dpdkbond0
1486 enabled: true
1487 type: dpdk_ovs_port
1488 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001489 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001490 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001491 dpdkbond0:
1492 enabled: true
1493 bridge: br-prv
1494 type: dpdk_ovs_bond
1495 mode: active-backup
1496 br-prv:
1497 enabled: true
1498 type: dpdk_ovs_bridge
1499
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01001500**DPDK OVS LACP Bond with vlan tag**
1501
1502.. code-block:: yaml
1503
1504 linux:
1505 network:
1506 bridge: openvswitch
1507 dpdk:
1508 enabled: true
1509 driver: uio
1510 openvswitch:
1511 pmd_cpu_mask: "0x6"
1512 dpdk_socket_mem: "1024,1024"
1513 dpdk_lcore_mask: "0x400"
1514 memory_channels: "2"
1515 interface:
1516 eth3:
1517 enabled: true
1518 type: eth
1519 proto: manual
1520 name: ${_param:tenant_first_nic}
1521 eth4:
1522 enabled: true
1523 type: eth
1524 proto: manual
1525 name: ${_param:tenant_second_nic}
1526 dpdk0:
1527 name: ${_param:tenant_first_nic}
1528 pci: "0000:81:00.0"
1529 driver: igb_uio
1530 bond: bond1
1531 enabled: true
1532 type: dpdk_ovs_port
1533 n_rxq: 2
1534 dpdk1:
1535 name: ${_param:tenant_second_nic}
1536 pci: "0000:81:00.1"
1537 driver: igb_uio
1538 bond: bond1
1539 enabled: true
1540 type: dpdk_ovs_port
1541 n_rxq: 2
1542 bond1:
1543 enabled: true
1544 bridge: br-prv
1545 type: dpdk_ovs_bond
1546 mode: balance-slb
1547 br-prv:
1548 enabled: true
1549 type: dpdk_ovs_bridge
1550 tag: ${_param:tenant_vlan}
1551 address: ${_param:tenant_address}
1552 netmask: ${_param:tenant_network_netmask}
1553
Jakub Pavlikaa759062017-03-13 15:57:26 +01001554**DPDK OVS bridge for VXLAN**
1555
1556If VXLAN is used as tenant segmentation then ip address must be set on br-prv
1557
1558.. code-block:: yaml
1559
1560 linux:
1561 network:
1562 ...
1563 interface:
1564 br-prv:
1565 enabled: true
1566 type: dpdk_ovs_bridge
1567 address: 192.168.50.0
1568 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04001569 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01001570 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001571
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02001572
1573
1574**DPDK OVS bridge with Linux network interface**
1575
1576.. code-block:: yaml
1577
1578 linux:
1579 network:
1580 ...
1581 interface:
1582 eth0:
1583 type: eth
1584 ovs_bridge: br-prv
1585 ...
1586 br-prv:
1587 enabled: true
1588 type: dpdk_ovs_bridge
1589 ...
1590
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001591Linux storage
1592-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02001593
1594Linux with mounted Samba
1595
1596.. code-block:: yaml
1597
1598 linux:
1599 storage:
1600 enabled: true
1601 mount:
1602 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01001603 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001604 - path: /media/myuser/public/
1605 - device: //192.168.0.1/storage
1606 - file_system: cifs
1607 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
1608
Jiri Broulikb017f932017-03-31 13:55:36 +02001609NFS mount
1610
1611.. code-block:: yaml
1612
1613 linux:
1614 storage:
1615 enabled: true
1616 mount:
1617 nfs_glance:
1618 enabled: true
1619 path: /var/lib/glance/images
1620 device: 172.16.10.110:/var/nfs/glance
1621 file_system: nfs
1622 opts: rw,sync
1623
1624
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001625File swap configuration
Filip Pytlounf5383a42015-10-06 16:28:32 +02001626
1627.. code-block:: yaml
1628
1629 linux:
1630 storage:
1631 enabled: true
1632 swap:
1633 file:
1634 enabled: true
1635 engine: file
1636 device: /swapfile
1637 size: 1024
1638
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001639Partition swap configuration
Lachlan Evenson30676512016-01-22 15:43:28 -08001640
1641.. code-block:: yaml
1642
1643 linux:
1644 storage:
1645 enabled: true
1646 swap:
1647 partition:
1648 enabled: true
1649 engine: partition
1650 device: /dev/vg0/swap
1651
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001652LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
1653
1654.. code-block:: yaml
1655
1656 parameters:
1657 linux:
1658 storage:
1659 mount:
1660 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01001661 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001662 device: /dev/vg1/data
1663 file_system: ext4
1664 path: /mnt/data
1665 lvm:
1666 vg1:
1667 enabled: true
1668 devices:
1669 - /dev/sdb
1670 volume:
1671 data:
1672 size: 40G
1673 mount: ${linux:storage:mount:data}
1674
Jakub Pavlik4f742142017-08-08 15:05:50 +02001675Create partitions on disk. Specify size in MB. It expects empty
Piotr Krukd51911b2017-12-04 11:27:08 +01001676disk without any existing partitions. (set startsector=1, if you want to start partitions from 2048)
Jakub Pavlik4f742142017-08-08 15:05:50 +02001677
1678.. code-block:: yaml
1679
1680 linux:
1681 storage:
1682 disk:
1683 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01001684 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02001685 name: /dev/loop1
1686 type: gpt
1687 partitions:
1688 - size: 200 #size in MB
1689 type: fat32
1690 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02001691 mkfs: True
1692 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02001693 /dev/vda1:
1694 partitions:
1695 - size: 5
1696 type: ext2
1697 - size: 10
1698 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02001699
1700Multipath with Fujitsu Eternus DXL
1701
1702.. code-block:: yaml
1703
1704 parameters:
1705 linux:
1706 storage:
1707 multipath:
1708 enabled: true
1709 blacklist_devices:
1710 - /dev/sda
1711 - /dev/sdb
1712 backends:
1713 - fujitsu_eternus_dxl
1714
1715Multipath with Hitachi VSP 1000
1716
1717.. code-block:: yaml
1718
1719 parameters:
1720 linux:
1721 storage:
1722 multipath:
1723 enabled: true
1724 blacklist_devices:
1725 - /dev/sda
1726 - /dev/sdb
1727 backends:
1728 - hitachi_vsp1000
1729
1730Multipath with IBM Storwize
1731
1732.. code-block:: yaml
1733
1734 parameters:
1735 linux:
1736 storage:
1737 multipath:
1738 enabled: true
1739 blacklist_devices:
1740 - /dev/sda
1741 - /dev/sdb
1742 backends:
1743 - ibm_storwize
1744
1745Multipath with multiple backends
1746
1747.. code-block:: yaml
1748
1749 parameters:
1750 linux:
1751 storage:
1752 multipath:
1753 enabled: true
1754 blacklist_devices:
1755 - /dev/sda
1756 - /dev/sdb
1757 - /dev/sdc
1758 - /dev/sdd
1759 backends:
1760 - ibm_storwize
1761 - fujitsu_eternus_dxl
1762 - hitachi_vsp1000
1763
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001764PAM LDAP integration
1765
1766.. code-block:: yaml
1767
1768 parameters:
1769 linux:
1770 system:
1771 auth:
1772 enabled: true
1773 ldap:
1774 enabled: true
1775 binddn: cn=bind,ou=service_users,dc=example,dc=com
1776 bindpw: secret
1777 uri: ldap://127.0.0.1
1778 base: ou=users,dc=example,dc=com
1779 ldap_version: 3
1780 pagesize: 65536
1781 referrals: off
1782 filter:
1783 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1784 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1785 group: (&(objectClass=group)(gidNumber=*))
1786
Ales Komareka634f4b2016-10-02 13:11:04 +02001787Disabled multipath (the default setup)
1788
1789.. code-block:: yaml
1790
1791 parameters:
1792 linux:
1793 storage:
1794 multipath:
1795 enabled: false
1796
Simon Pasquier375001e2017-01-26 13:22:33 +01001797Linux with local loopback device
1798
1799.. code-block:: yaml
1800
1801 linux:
1802 storage:
1803 loopback:
1804 disk1:
1805 file: /srv/disk1
1806 size: 50G
1807
Filip Pytlounb2c8f852016-11-21 17:03:43 +01001808External config generation
1809--------------------------
1810
1811You are able to use config support metadata between formulas and only generate
1812config files for external use, eg. docker, etc.
1813
1814.. code-block:: yaml
1815
1816 parameters:
1817 linux:
1818 system:
1819 config:
1820 pillar:
1821 jenkins:
1822 master:
1823 home: /srv/volumes/jenkins
1824 approved_scripts:
1825 - method java.net.URL openConnection
1826 credentials:
1827 - type: username_password
1828 scope: global
1829 id: test
1830 desc: Testing credentials
1831 username: test
1832 password: test
1833
Vladimir Ereminccf28842017-04-10 23:52:10 +03001834Netconsole Remote Kernel Logging
1835--------------------------------
1836
1837Netconsole logger could be configured for configfs-enabled kernels
1838(`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in
1839runtime (if network is already configured), and on-boot after interface
1840initialization. Notes:
1841
1842 * receiver could be located only in same L3 domain
1843 (or you need to configure gateway MAC manually)
1844 * receiver's MAC is detected only on configuration time
1845 * using broadcast MAC is not recommended
1846
1847.. code-block:: yaml
1848
1849 parameters:
1850 linux:
1851 system:
1852 netconsole:
1853 enabled: true
1854 port: 514 (optional)
1855 loglevel: debug (optional)
1856 target:
1857 192.168.0.1:
1858 interface: bond0
1859 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02001860
Filip Pytlounf5383a42015-10-06 16:28:32 +02001861Usage
1862=====
1863
1864Set mtu of network interface eth0 to 1400
1865
1866.. code-block:: bash
1867
1868 ip link set dev eth0 mtu 1400
1869
1870Read more
1871=========
1872
1873* https://www.archlinux.org/
1874* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
Filip Pytloun018f8712017-02-02 13:02:03 +01001875
1876Documentation and Bugs
1877======================
1878
1879To learn how to install and update salt-formulas, consult the documentation
1880available online at:
1881
1882 http://salt-formulas.readthedocs.io/
1883
1884In the unfortunate event that bugs are discovered, they should be reported to
1885the appropriate issue tracker. Use Github issue tracker for specific salt
1886formula:
1887
1888 https://github.com/salt-formulas/salt-formula-linux/issues
1889
1890For feature requests, bug reports or blueprints affecting entire ecosystem,
1891use Launchpad salt-formulas project:
1892
1893 https://launchpad.net/salt-formulas
1894
1895You can also join salt-formulas-users team and subscribe to mailing list:
1896
1897 https://launchpad.net/~salt-formulas-users
1898
1899Developers wishing to work on the salt-formulas projects should always base
1900their work on master branch and submit pull request against specific formula.
1901
1902 https://github.com/salt-formulas/salt-formula-linux
1903
1904Any questions or feedback is always welcome so feel free to join our IRC
1905channel:
1906
1907 #salt-formulas @ irc.freenode.net