blob: fea2e1a51084dda85e9115a88e5d1247ff9f875b [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
828``pam_motd`` from package ``update-motd`` is used for dynamic messages of the
829day. Setting custom motd will cleanup existing ones.
830
831.. code-block:: yaml
832
833 linux:
834 system:
835 motd:
836 - release: |
837 #!/bin/sh
838 [ -r /etc/lsb-release ] && . /etc/lsb-release
839
840 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
841 # Fall back to using the very slow lsb_release utility
842 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
843 fi
844
845 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
846 - warning: |
847 #!/bin/sh
848 printf "This is [company name] network.\n"
849 printf "Unauthorized access strictly prohibited.\n"
850
Marek Celoud713e9072017-05-18 15:20:25 +0200851Services
852~~~~~~~~
853
854Stop and disable linux service:
855
856.. code-block:: yaml
857
858 linux:
859 system:
860 service:
861 apt-daily.timer:
862 status: dead
863
864Possible status is dead (disable service by default), running (enable service by default), enabled, disabled.
865
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +0300866Linux with atop service:
867
868.. code-block:: yaml
869
870 linux:
871 system:
872 atop:
873 enabled: true
874 interval: 20
875 logpath: "/var/log/atop"
876 outfile: "/var/log/atop/daily.log"
877
Filip Pytloun2f70b492016-02-19 15:55:25 +0100878RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +0100879^^^^^^^^^^^^^
Filip Pytloun2f70b492016-02-19 15:55:25 +0100880
881Unfortunately ``update-motd`` is currently not available for RHEL so there's
882no native support for dynamic motd.
883You can still set static one, only pillar structure differs:
884
885.. code-block:: yaml
886
887 linux:
888 system:
889 motd: |
890 This is [company name] network.
891 Unauthorized access strictly prohibited.
892
Filip Pytloun8296bb92016-02-19 18:42:09 +0100893Haveged
894~~~~~~~
895
896If you are running headless server and are low on entropy, it may be a good
897idea to setup Haveged.
898
899.. code-block:: yaml
900
901 linux:
902 system:
903 haveged:
904 enabled: true
905
Filip Pytlounf5383a42015-10-06 16:28:32 +0200906Linux network
907-------------
908
909Linux with network manager
910
911.. code-block:: yaml
912
913 linux:
914 network:
915 enabled: true
916 network_manager: true
917
918Linux with default static network interfaces, default gateway interface and DNS servers
919
920.. code-block:: yaml
921
922 linux:
923 network:
924 enabled: true
925 interface:
926 eth0:
927 enabled: true
928 type: eth
929 address: 192.168.0.102
930 netmask: 255.255.255.0
931 gateway: 192.168.0.1
932 name_servers:
933 - 8.8.8.8
934 - 8.8.4.4
935 mtu: 1500
936
jan kaufman6d30adf2016-01-18 17:30:12 +0100937Linux with bonded interfaces and disabled NetworkManager
Filip Pytlounf5383a42015-10-06 16:28:32 +0200938
939.. code-block:: yaml
940
941 linux:
942 network:
943 enabled: true
944 interface:
945 eth0:
946 type: eth
947 ...
948 eth1:
949 type: eth
950 ...
951 bond0:
952 enabled: true
953 type: bond
954 address: 192.168.0.102
955 netmask: 255.255.255.0
956 mtu: 1500
957 use_in:
958 - interface: ${linux:interface:eth0}
959 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +0100960 network_manager:
961 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +0200962
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100963Linux with vlan interface_params
964
965.. code-block:: yaml
966
967 linux:
968 network:
969 enabled: true
970 interface:
971 vlan69:
972 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +0100973 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100974 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100975
Filip Pytlounf5383a42015-10-06 16:28:32 +0200976Linux with wireless interface parameters
977
978.. code-block:: yaml
979
980 linux:
981 network:
982 enabled: true
983 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100984 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +0200985 interface:
986 wlan0:
987 type: eth
988 wireless:
989 essid: example
990 key: example_key
991 security: wpa
992 priority: 1
993
994Linux networks with routes defined
995
996.. code-block:: yaml
997
998 linux:
999 network:
1000 enabled: true
1001 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001002 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001003 interface:
1004 eth0:
1005 type: eth
1006 route:
1007 default:
1008 address: 192.168.0.123
1009 netmask: 255.255.255.0
1010 gateway: 192.168.0.1
1011
1012Native Linux Bridges
1013
1014.. code-block:: yaml
1015
1016 linux:
1017 network:
1018 interface:
1019 eth1:
1020 enabled: true
1021 type: eth
1022 proto: manual
1023 up_cmds:
1024 - ip address add 0/0 dev $IFACE
1025 - ip link set $IFACE up
1026 down_cmds:
1027 - ip link set $IFACE down
1028 br-ex:
1029 enabled: true
1030 type: bridge
1031 address: ${linux:network:host:public_local:address}
1032 netmask: 255.255.255.0
1033 use_interfaces:
1034 - eth1
1035
1036OpenVswitch Bridges
1037
1038.. code-block:: yaml
1039
1040 linux:
1041 network:
1042 bridge: openvswitch
1043 interface:
1044 eth1:
1045 enabled: true
1046 type: eth
1047 proto: manual
1048 up_cmds:
1049 - ip address add 0/0 dev $IFACE
1050 - ip link set $IFACE up
1051 down_cmds:
1052 - ip link set $IFACE down
1053 br-ex:
1054 enabled: true
1055 type: bridge
1056 address: ${linux:network:host:public_local:address}
1057 netmask: 255.255.255.0
1058 use_interfaces:
1059 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001060 br-prv:
1061 enabled: true
1062 type: ovs_bridge
1063 mtu: 65000
1064 br-ens7:
1065 enabled: true
1066 name: br-ens7
1067 type: ovs_bridge
1068 proto: manual
1069 mtu: 9000
1070 use_interfaces:
1071 - ens7
1072 patch-br-ens7-br-prv:
1073 enabled: true
1074 name: ens7-prv
1075 ovs_type: ovs_port
1076 type: ovs_port
1077 bridge: br-ens7
1078 port_type: patch
1079 peer: prv-ens7
1080 mtu: 65000
1081 patch-br-prv-br-ens7:
1082 enabled: true
1083 name: prv-ens7
1084 bridge: br-prv
1085 ovs_type: ovs_port
1086 type: ovs_port
1087 port_type: patch
1088 peer: ens7-prv
1089 mtu: 65000
1090 ens7:
1091 enabled: true
1092 name: ens7
1093 proto: manual
1094 ovs_port_type: OVSPort
1095 type: ovs_port
1096 ovs_bridge: br-ens7
1097 bridge: br-ens7
Filip Pytlounf5383a42015-10-06 16:28:32 +02001098
Petr Jediný8f8ae542017-07-13 16:19:12 +02001099Debian manual proto interfaces
1100
1101When you are changing interface proto from static in up state to manual, you
1102may need to flush ip addresses. For example, if you want to use the interface
1103and the ip on the bridge. This can be done by setting the ``ipflush_onchange``
1104to true.
1105
1106.. code-block:: yaml
1107
1108 linux:
1109 network:
1110 interface:
1111 eth1:
1112 enabled: true
1113 type: eth
1114 proto: manual
1115 mtu: 9100
1116 ipflush_onchange: true
1117
Jiri Broulik1a191e32018-01-15 15:54:21 +01001118Debian static proto interfaces
1119
1120When you are changing interface proto from dhcp in up state to static, you
1121may need to flush ip addresses and restart interface to assign ip address from a managed file.
1122For example, if you want to use the interface and the ip on the bridge.
1123This can be done by setting the ``ipflush_onchange`` with combination
1124``restart_on_ipflush`` param set to to true.
1125
1126.. code-block:: yaml
1127
1128 linux:
1129 network:
1130 interface:
1131 eth1:
1132 enabled: true
1133 type: eth
1134 proto: static
1135 address: 10.1.0.22
1136 netmask: 255.255.255.0
1137 ipflush_onchange: true
1138 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001139
Petr Jedinýd577cb52017-06-28 20:17:49 +02001140Concatinating and removing interface files
1141
1142Debian based distributions have `/etc/network/interfaces.d/` directory, where
1143you can store configuration of network interfaces in separate files. You can
1144concatinate the files to the defined destination when needed, this operation
1145removes the file from the `/etc/network/interfaces.d/`. If you just need to
1146remove iface files, you can use the `remove_iface_files` key.
1147
1148.. code-block:: yaml
1149
1150 linux:
1151 network:
1152 concat_iface_files:
1153 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1154 dst: '/etc/network/interfaces'
1155 remove_iface_files:
1156 - '/etc/network/interfaces.d/90-custom.cfg'
1157
1158
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001159DHCP client configuration
1160
1161None of the keys is mandatory, include only those you really need. For full list
1162of available options under send, supersede, prepend, append refer to dhcp-options(5)
1163
1164.. code-block:: yaml
1165
1166 linux:
1167 network:
1168 dhclient:
1169 enabled: true
1170 backoff_cutoff: 15
1171 initial_interval: 10
1172 reboot: 10
1173 retry: 60
1174 select_timeout: 0
1175 timeout: 120
1176 send:
1177 - option: host-name
1178 declaration: "= gethostname()"
1179 supersede:
1180 - option: host-name
1181 declaration: "spaceship"
1182 - option: domain-name
1183 declaration: "domain.home"
1184 #- option: arp-cache-timeout
1185 # declaration: 20
1186 prepend:
1187 - option: domain-name-servers
1188 declaration:
1189 - 8.8.8.8
1190 - 8.8.4.4
1191 - option: domain-search
1192 declaration:
1193 - example.com
1194 - eng.example.com
1195 #append:
1196 #- option: domain-name-servers
1197 # declaration: 127.0.0.1
1198 # ip or subnet to reject dhcp offer from
1199 reject:
1200 - 192.33.137.209
1201 - 10.0.2.0/24
1202 request:
1203 - subnet-mask
1204 - broadcast-address
1205 - time-offset
1206 - routers
1207 - domain-name
1208 - domain-name-servers
1209 - domain-search
1210 - host-name
1211 - dhcp6.name-servers
1212 - dhcp6.domain-search
1213 - dhcp6.fqdn
1214 - dhcp6.sntp-servers
1215 - netbios-name-servers
1216 - netbios-scope
1217 - interface-mtu
1218 - rfc3442-classless-static-routes
1219 - ntp-servers
1220 require:
1221 - subnet-mask
1222 - domain-name-servers
1223 # if per interface configuration required add below
1224 interface:
1225 ens2:
1226 initial_interval: 11
1227 reject:
1228 - 192.33.137.210
1229 ens3:
1230 initial_interval: 12
1231 reject:
1232 - 192.33.137.211
1233
Petr Michaleceb14b552017-06-01 10:27:05 +02001234Linux network systemd settings:
1235
1236.. code-block:: yaml
1237
1238 linux:
1239 network:
1240 ...
1241 systemd:
1242 link:
1243 10-iface-dmz:
1244 Match:
1245 MACAddress: c8:5b:67:fa:1a:af
1246 OriginalName: eth0
1247 Link:
1248 Name: dmz0
1249 netdev:
1250 20-bridge-dmz:
1251 match:
1252 name: dmz0
1253 network:
1254 mescription: bridge
1255 bridge: br-dmz0
1256 network:
1257 # works with lowercase, keys are by default capitalized
1258 40-dhcp:
1259 match:
1260 name: '*'
1261 network:
1262 DHCP: yes
1263
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001264
Petr Michalec10462bb2017-03-23 19:18:08 +01001265Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001266
Ales Komarek417e8c52017-08-25 15:10:29 +02001267Use ``/etc/environment`` for static system wide variable assignment after
1268boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001269
1270.. code-block:: yaml
1271
1272 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001273 system:
1274 env:
1275 BOB_VARIABLE: Alice
1276 ...
1277 BOB_PATH:
1278 - /srv/alice/bin
1279 - /srv/bob/bin
1280 ...
1281 ftp_proxy: none
1282 http_proxy: http://global-http-proxy.host.local:8080
1283 https_proxy: ${linux:system:proxy:https}
1284 no_proxy:
1285 - 192.168.0.80
1286 - 192.168.1.80
1287 - .domain.com
1288 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02001289 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001290 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001291 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01001292 ftp: ftp://proxy.host.local:2121
1293 http: http://proxy.host.local:3142
1294 https: https://proxy.host.local:3143
1295 noproxy:
1296 - .domain.com
1297 - .local
1298
1299Configure profile.d scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01001300
Ales Komarek417e8c52017-08-25 15:10:29 +02001301The profile.d scripts are being sourced during .sh execution and support
1302variable expansion in opposite to /etc/environment global settings in
1303``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01001304
1305.. code-block:: yaml
1306
1307 linux:
1308 system:
1309 profile:
1310 locales: |
1311 export LANG=C
1312 export LC_ALL=C
1313 ...
1314 vi_flavors.sh: |
1315 export PAGER=view
1316 export EDITOR=vim
1317 alias vi=vim
1318 shell_locales.sh: |
1319 export LANG=en_US
1320 export LC_ALL=en_US.UTF-8
1321 shell_proxies.sh: |
1322 export FTP_PROXY=ftp://127.0.3.3:2121
1323 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02001324
1325Linux with hosts
1326
Filip Pytloun86506fe2017-01-26 14:36:16 +01001327Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
1328that are not defined in model except defaults for both IPv4 and IPv6 localhost
1329and hostname + fqdn.
Ales Komarek417e8c52017-08-25 15:10:29 +02001330
Filip Pytloun86506fe2017-01-26 14:36:16 +01001331It's good to use this option if you want to ensure /etc/hosts is always in a
1332clean state however it's not enabled by default for safety.
1333
Filip Pytlounf5383a42015-10-06 16:28:32 +02001334.. code-block:: yaml
1335
1336 linux:
1337 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001338 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001339 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001340 # No need to define this one if purge_hosts is true
1341 hostname:
1342 address: 127.0.1.1
1343 names:
1344 - ${linux:network:fqdn}
1345 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02001346 node1:
1347 address: 192.168.10.200
1348 names:
1349 - node2.domain.com
1350 - service2.domain.com
1351 node2:
1352 address: 192.168.10.201
1353 names:
1354 - node2.domain.com
1355 - service2.domain.com
1356
Ales Komarek417e8c52017-08-25 15:10:29 +02001357Linux with hosts collected from mine
1358
1359In this case all dns records defined within infrastrucuture will be passed to
1360local hosts records or any DNS server. Only hosts with `grain` parameter to
1361true will be propagated to the mine.
1362
1363.. code-block:: yaml
1364
1365 linux:
1366 network:
1367 purge_hosts: true
1368 mine_dns_records: true
1369 host:
1370 node1:
1371 address: 192.168.10.200
1372 grain: true
1373 names:
1374 - node2.domain.com
1375 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01001376
Filip Pytlounde9bea52016-01-11 15:39:10 +01001377Setup resolv.conf, nameservers, domain and search domains
1378
1379.. code-block:: yaml
1380
1381 linux:
1382 network:
1383 resolv:
1384 dns:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001385 - 8.8.4.4
1386 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01001387 domain: my.example.com
1388 search:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001389 - my.example.com
1390 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01001391 options:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001392 - ndots: 5
1393 - timeout: 2
1394 - attempts: 2
Filip Pytlounde9bea52016-01-11 15:39:10 +01001395
Ales Komarek417e8c52017-08-25 15:10:29 +02001396setting custom TX queue length for tap interfaces
Andrii Petrenko735761d2017-03-21 17:17:35 -07001397
1398.. code-block:: yaml
1399
1400 linux:
1401 network:
1402 tap_custom_txqueuelen: 10000
1403
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001404DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001405
1406**DPDK OVS NIC**
1407
1408.. code-block:: yaml
1409
1410 linux:
1411 network:
1412 bridge: openvswitch
1413 dpdk:
1414 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001415 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001416 openvswitch:
1417 pmd_cpu_mask: "0x6"
1418 dpdk_socket_mem: "1024,1024"
1419 dpdk_lcore_mask: "0x400"
1420 memory_channels: 2
1421 interface:
1422 dpkd0:
1423 name: ${_param:dpdk_nic}
1424 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001425 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001426 enabled: true
1427 type: dpdk_ovs_port
1428 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001429 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001430 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01001431 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001432 br-prv:
1433 enabled: true
1434 type: dpdk_ovs_bridge
1435
1436**DPDK OVS Bond**
1437
1438.. code-block:: yaml
1439
1440 linux:
1441 network:
1442 bridge: openvswitch
1443 dpdk:
1444 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001445 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001446 openvswitch:
1447 pmd_cpu_mask: "0x6"
1448 dpdk_socket_mem: "1024,1024"
1449 dpdk_lcore_mask: "0x400"
1450 memory_channels: 2
1451 interface:
1452 dpdk_second_nic:
1453 name: ${_param:primary_second_nic}
1454 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001455 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001456 bond: dpdkbond0
1457 enabled: true
1458 type: dpdk_ovs_port
1459 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001460 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001461 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001462 dpdk_first_nic:
1463 name: ${_param:primary_first_nic}
1464 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001465 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001466 bond: dpdkbond0
1467 enabled: true
1468 type: dpdk_ovs_port
1469 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001470 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001471 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001472 dpdkbond0:
1473 enabled: true
1474 bridge: br-prv
1475 type: dpdk_ovs_bond
1476 mode: active-backup
1477 br-prv:
1478 enabled: true
1479 type: dpdk_ovs_bridge
1480
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01001481**DPDK OVS LACP Bond with vlan tag**
1482
1483.. code-block:: yaml
1484
1485 linux:
1486 network:
1487 bridge: openvswitch
1488 dpdk:
1489 enabled: true
1490 driver: uio
1491 openvswitch:
1492 pmd_cpu_mask: "0x6"
1493 dpdk_socket_mem: "1024,1024"
1494 dpdk_lcore_mask: "0x400"
1495 memory_channels: "2"
1496 interface:
1497 eth3:
1498 enabled: true
1499 type: eth
1500 proto: manual
1501 name: ${_param:tenant_first_nic}
1502 eth4:
1503 enabled: true
1504 type: eth
1505 proto: manual
1506 name: ${_param:tenant_second_nic}
1507 dpdk0:
1508 name: ${_param:tenant_first_nic}
1509 pci: "0000:81:00.0"
1510 driver: igb_uio
1511 bond: bond1
1512 enabled: true
1513 type: dpdk_ovs_port
1514 n_rxq: 2
1515 dpdk1:
1516 name: ${_param:tenant_second_nic}
1517 pci: "0000:81:00.1"
1518 driver: igb_uio
1519 bond: bond1
1520 enabled: true
1521 type: dpdk_ovs_port
1522 n_rxq: 2
1523 bond1:
1524 enabled: true
1525 bridge: br-prv
1526 type: dpdk_ovs_bond
1527 mode: balance-slb
1528 br-prv:
1529 enabled: true
1530 type: dpdk_ovs_bridge
1531 tag: ${_param:tenant_vlan}
1532 address: ${_param:tenant_address}
1533 netmask: ${_param:tenant_network_netmask}
1534
Jakub Pavlikaa759062017-03-13 15:57:26 +01001535**DPDK OVS bridge for VXLAN**
1536
1537If VXLAN is used as tenant segmentation then ip address must be set on br-prv
1538
1539.. code-block:: yaml
1540
1541 linux:
1542 network:
1543 ...
1544 interface:
1545 br-prv:
1546 enabled: true
1547 type: dpdk_ovs_bridge
1548 address: 192.168.50.0
1549 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04001550 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01001551 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001552
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02001553
1554
1555**DPDK OVS bridge with Linux network interface**
1556
1557.. code-block:: yaml
1558
1559 linux:
1560 network:
1561 ...
1562 interface:
1563 eth0:
1564 type: eth
1565 ovs_bridge: br-prv
1566 ...
1567 br-prv:
1568 enabled: true
1569 type: dpdk_ovs_bridge
1570 ...
1571
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001572Linux storage
1573-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02001574
1575Linux with mounted Samba
1576
1577.. code-block:: yaml
1578
1579 linux:
1580 storage:
1581 enabled: true
1582 mount:
1583 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01001584 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001585 - path: /media/myuser/public/
1586 - device: //192.168.0.1/storage
1587 - file_system: cifs
1588 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
1589
Jiri Broulikb017f932017-03-31 13:55:36 +02001590NFS mount
1591
1592.. code-block:: yaml
1593
1594 linux:
1595 storage:
1596 enabled: true
1597 mount:
1598 nfs_glance:
1599 enabled: true
1600 path: /var/lib/glance/images
1601 device: 172.16.10.110:/var/nfs/glance
1602 file_system: nfs
1603 opts: rw,sync
1604
1605
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001606File swap configuration
Filip Pytlounf5383a42015-10-06 16:28:32 +02001607
1608.. code-block:: yaml
1609
1610 linux:
1611 storage:
1612 enabled: true
1613 swap:
1614 file:
1615 enabled: true
1616 engine: file
1617 device: /swapfile
1618 size: 1024
1619
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001620Partition swap configuration
Lachlan Evenson30676512016-01-22 15:43:28 -08001621
1622.. code-block:: yaml
1623
1624 linux:
1625 storage:
1626 enabled: true
1627 swap:
1628 partition:
1629 enabled: true
1630 engine: partition
1631 device: /dev/vg0/swap
1632
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001633LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
1634
1635.. code-block:: yaml
1636
1637 parameters:
1638 linux:
1639 storage:
1640 mount:
1641 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01001642 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001643 device: /dev/vg1/data
1644 file_system: ext4
1645 path: /mnt/data
1646 lvm:
1647 vg1:
1648 enabled: true
1649 devices:
1650 - /dev/sdb
1651 volume:
1652 data:
1653 size: 40G
1654 mount: ${linux:storage:mount:data}
1655
Jakub Pavlik4f742142017-08-08 15:05:50 +02001656Create partitions on disk. Specify size in MB. It expects empty
Piotr Krukd51911b2017-12-04 11:27:08 +01001657disk without any existing partitions. (set startsector=1, if you want to start partitions from 2048)
Jakub Pavlik4f742142017-08-08 15:05:50 +02001658
1659.. code-block:: yaml
1660
1661 linux:
1662 storage:
1663 disk:
1664 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01001665 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02001666 name: /dev/loop1
1667 type: gpt
1668 partitions:
1669 - size: 200 #size in MB
1670 type: fat32
1671 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02001672 mkfs: True
1673 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02001674 /dev/vda1:
1675 partitions:
1676 - size: 5
1677 type: ext2
1678 - size: 10
1679 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02001680
1681Multipath with Fujitsu Eternus DXL
1682
1683.. code-block:: yaml
1684
1685 parameters:
1686 linux:
1687 storage:
1688 multipath:
1689 enabled: true
1690 blacklist_devices:
1691 - /dev/sda
1692 - /dev/sdb
1693 backends:
1694 - fujitsu_eternus_dxl
1695
1696Multipath with Hitachi VSP 1000
1697
1698.. code-block:: yaml
1699
1700 parameters:
1701 linux:
1702 storage:
1703 multipath:
1704 enabled: true
1705 blacklist_devices:
1706 - /dev/sda
1707 - /dev/sdb
1708 backends:
1709 - hitachi_vsp1000
1710
1711Multipath with IBM Storwize
1712
1713.. code-block:: yaml
1714
1715 parameters:
1716 linux:
1717 storage:
1718 multipath:
1719 enabled: true
1720 blacklist_devices:
1721 - /dev/sda
1722 - /dev/sdb
1723 backends:
1724 - ibm_storwize
1725
1726Multipath with multiple backends
1727
1728.. code-block:: yaml
1729
1730 parameters:
1731 linux:
1732 storage:
1733 multipath:
1734 enabled: true
1735 blacklist_devices:
1736 - /dev/sda
1737 - /dev/sdb
1738 - /dev/sdc
1739 - /dev/sdd
1740 backends:
1741 - ibm_storwize
1742 - fujitsu_eternus_dxl
1743 - hitachi_vsp1000
1744
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001745PAM LDAP integration
1746
1747.. code-block:: yaml
1748
1749 parameters:
1750 linux:
1751 system:
1752 auth:
1753 enabled: true
1754 ldap:
1755 enabled: true
1756 binddn: cn=bind,ou=service_users,dc=example,dc=com
1757 bindpw: secret
1758 uri: ldap://127.0.0.1
1759 base: ou=users,dc=example,dc=com
1760 ldap_version: 3
1761 pagesize: 65536
1762 referrals: off
1763 filter:
1764 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1765 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1766 group: (&(objectClass=group)(gidNumber=*))
1767
Ales Komareka634f4b2016-10-02 13:11:04 +02001768Disabled multipath (the default setup)
1769
1770.. code-block:: yaml
1771
1772 parameters:
1773 linux:
1774 storage:
1775 multipath:
1776 enabled: false
1777
Simon Pasquier375001e2017-01-26 13:22:33 +01001778Linux with local loopback device
1779
1780.. code-block:: yaml
1781
1782 linux:
1783 storage:
1784 loopback:
1785 disk1:
1786 file: /srv/disk1
1787 size: 50G
1788
Filip Pytlounb2c8f852016-11-21 17:03:43 +01001789External config generation
1790--------------------------
1791
1792You are able to use config support metadata between formulas and only generate
1793config files for external use, eg. docker, etc.
1794
1795.. code-block:: yaml
1796
1797 parameters:
1798 linux:
1799 system:
1800 config:
1801 pillar:
1802 jenkins:
1803 master:
1804 home: /srv/volumes/jenkins
1805 approved_scripts:
1806 - method java.net.URL openConnection
1807 credentials:
1808 - type: username_password
1809 scope: global
1810 id: test
1811 desc: Testing credentials
1812 username: test
1813 password: test
1814
Vladimir Ereminccf28842017-04-10 23:52:10 +03001815Netconsole Remote Kernel Logging
1816--------------------------------
1817
1818Netconsole logger could be configured for configfs-enabled kernels
1819(`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in
1820runtime (if network is already configured), and on-boot after interface
1821initialization. Notes:
1822
1823 * receiver could be located only in same L3 domain
1824 (or you need to configure gateway MAC manually)
1825 * receiver's MAC is detected only on configuration time
1826 * using broadcast MAC is not recommended
1827
1828.. code-block:: yaml
1829
1830 parameters:
1831 linux:
1832 system:
1833 netconsole:
1834 enabled: true
1835 port: 514 (optional)
1836 loglevel: debug (optional)
1837 target:
1838 192.168.0.1:
1839 interface: bond0
1840 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02001841
Filip Pytlounf5383a42015-10-06 16:28:32 +02001842Usage
1843=====
1844
1845Set mtu of network interface eth0 to 1400
1846
1847.. code-block:: bash
1848
1849 ip link set dev eth0 mtu 1400
1850
1851Read more
1852=========
1853
1854* https://www.archlinux.org/
1855* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
Filip Pytloun018f8712017-02-02 13:02:03 +01001856
1857Documentation and Bugs
1858======================
1859
1860To learn how to install and update salt-formulas, consult the documentation
1861available online at:
1862
1863 http://salt-formulas.readthedocs.io/
1864
1865In the unfortunate event that bugs are discovered, they should be reported to
1866the appropriate issue tracker. Use Github issue tracker for specific salt
1867formula:
1868
1869 https://github.com/salt-formulas/salt-formula-linux/issues
1870
1871For feature requests, bug reports or blueprints affecting entire ecosystem,
1872use Launchpad salt-formulas project:
1873
1874 https://launchpad.net/salt-formulas
1875
1876You can also join salt-formulas-users team and subscribe to mailing list:
1877
1878 https://launchpad.net/~salt-formulas-users
1879
1880Developers wishing to work on the salt-formulas projects should always base
1881their work on master branch and submit pull request against specific formula.
1882
1883 https://github.com/salt-formulas/salt-formula-linux
1884
1885Any questions or feedback is always welcome so feel free to join our IRC
1886channel:
1887
1888 #salt-formulas @ irc.freenode.net