blob: 45139c4810dcc6459062ce92bfe9271dc752f6fd [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
Bruno Binet9c2fe222018-06-08 16:57:32 +0200392Ensure presence of file to be serialized through one of the serializer modules
393(see: https://docs.saltstack.com/en/latest/ref/serializers/all/index.html):
394
395.. code-block:: yaml
396
397 linux:
398 system:
399 file:
400 /tmp/test.json:
401 serialize: json
402 contents:
403 foo: 1
404 bar: 'bar'
405
Filip Pytloun281034a2016-01-04 18:06:22 +0100406Kernel
407~~~~~~
408
409Install always up to date LTS kernel and headers from Ubuntu trusty:
410
411.. code-block:: yaml
412
413 linux:
414 system:
415 kernel:
416 type: generic
417 lts: trusty
418 headers: true
419
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100420Load kernel modules and add them to `/etc/modules`:
421
422.. code-block:: yaml
423
424 linux:
425 system:
426 kernel:
427 modules:
428 - nf_conntrack
429 - tp_smapi
430 - 8021q
431
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300432Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
433will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`:
434
435.. code-block:: yaml
436
437 linux:
438 system:
439 kernel:
440 module:
441 nf_conntrack:
442 option:
443 hashsize: 262144
444
445
446
Filip Pytloun281034a2016-01-04 18:06:22 +0100447Install specific kernel version and ensure all other kernel packages are
448not present. Also install extra modules and headers for this kernel:
449
450.. code-block:: yaml
451
452 linux:
453 system:
454 kernel:
455 type: generic
456 extra: true
457 headers: true
458 version: 4.2.0-22
459
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100460Systcl kernel parameters
461
462.. code-block:: yaml
463
464 linux:
465 system:
466 kernel:
467 sysctl:
468 net.ipv4.tcp_keepalive_intvl: 3
469 net.ipv4.tcp_keepalive_time: 30
470 net.ipv4.tcp_keepalive_probes: 8
471
Michael Polenchukebf55522018-01-25 13:22:39 +0400472Configure kernel boot options:
473
474.. code-block:: yaml
475
476 linux:
477 system:
478 kernel:
479 boot_options:
480 - elevator=deadline
481 - spectre_v2=off
482 - nopti
483
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100484
485CPU
486~~~
487
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300488Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100489
490.. code-block:: yaml
491
492 linux:
493 system:
494 cpu:
495 governor: performance
496
Nick Metzf04f5f32018-01-08 15:25:04 +0100497
Jiri Broulik303905d2018-01-11 14:12:48 +0100498CGROUPS
499~~~~~~~
500
501Setup linux cgroups:
502
503.. code-block:: yaml
504
505 linux:
506 system:
507 cgroup:
508 enabled: true
509 group:
510 ceph_group_1:
511 controller:
512 cpu:
513 shares:
514 value: 250
515 cpuacct:
516 usage:
517 value: 0
518 cpuset:
519 cpus:
520 value: 1,2,3
521 memory:
522 limit_in_bytes:
523 value: 2G
524 memsw.limit_in_bytes:
525 value: 3G
526 mapping:
527 subjects:
528 - '@ceph'
529 generic_group_1:
530 controller:
531 cpu:
532 shares:
533 value: 250
534 cpuacct:
535 usage:
536 value: 0
537 mapping:
538 subjects:
539 - '*:firefox'
540 - 'student:cp'
541
542
Nick Metzf04f5f32018-01-08 15:25:04 +0100543Shared Libraries
544~~~~~~~~~~~~~~~~
545
546Set additional shared library to Linux system library path
547
548.. code-block:: yaml
549
550 linux:
551 system:
552 ld:
553 library:
554 java:
555 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
556 - /opt/java/jre/lib/amd64/server
557
558
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200559Certificates
560~~~~~~~~~~~~
561
562Add certificate authority into system trusted CA bundle
563
564.. code-block:: yaml
565
566 linux:
567 system:
568 ca_certificates:
569 mycert: |
570 -----BEGIN CERTIFICATE-----
571 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
572 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
573 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
574 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
575 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
576 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
577 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
578 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
579 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
580 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
581 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
582 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
583 -----END CERTIFICATE-----
584
Filip Pytloun361096c2017-08-23 10:57:20 +0200585Sysfs
586~~~~~
587
588Install sysfsutils and set sysfs attributes:
589
590.. code-block:: yaml
591
592 linux:
593 system:
594 sysfs:
595 scheduler:
596 block/sda/queue/scheduler: deadline
597 power:
598 mode:
599 power/state: 0660
600 owner:
601 power/state: "root:power"
602 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
603
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100604Huge Pages
605~~~~~~~~~~~~
606
607Huge Pages give a performance boost to applications that intensively deal
608with memory allocation/deallocation by decreasing memory fragmentation.
609
610.. code-block:: yaml
611
612 linux:
613 system:
614 kernel:
615 hugepages:
616 small:
617 size: 2M
618 count: 107520
619 mount_point: /mnt/hugepages_2MB
Michael Polenchukd9369fe2018-05-08 17:53:08 +0400620 mount: false/true # default is true (mount immediately) / false (just save in the fstab)
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100621 large:
622 default: true # default automatically mounted
623 size: 1G
624 count: 210
625 mount_point: /mnt/hugepages_1GB
626
627Note: not recommended to use both pagesizes in concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100628
Jakub Pavlik5398d872017-02-13 22:30:47 +0100629Intel SR-IOV
630~~~~~~~~~~~~
631
632PCI-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.
633
634.. code-block:: yaml
635
636 linux:
637 system:
638 kernel:
639 sriov: True
640 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
641 rc:
642 local: |
643 #!/bin/sh -e
644 # Enable 7 VF on eth1
645 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
646 exit 0
647
Jakub Pavlik6c9ead12017-02-16 21:53:13 +0100648Isolate CPU options
649~~~~~~~~~~~~~~~~~~~
650
651Remove the specified CPUs, as defined by the cpu_number values, from the general kernel
652SMP balancing and scheduler algroithms. The only way to move a process onto or off an
653"isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the
654maximum value is 1 less than the number of CPUs on the system.
655
656.. code-block:: yaml
657
658 linux:
659 system:
660 kernel:
661 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100662
Filip Pytlounf5383a42015-10-06 16:28:32 +0200663Repositories
664~~~~~~~~~~~~
665
666RedHat based Linux with additional OpenStack repo
667
668.. code-block:: yaml
669
670 linux:
671 system:
672 ...
673 repo:
674 rdo-icehouse:
675 enabled: true
676 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
677 pgpcheck: 0
678
679Ensure system repository to use czech Debian mirror (``default: true``)
680Also pin it's packages with priority 900.
681
682.. code-block:: yaml
683
684 linux:
685 system:
686 repo:
687 debian:
688 default: true
689 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
690 # Import signing key from URL if needed
691 key_url: "http://dummy.com/public.gpg"
692 pin:
693 - pin: 'origin "ftp.cz.debian.org"'
694 priority: 900
695 package: '*'
696
Petr Michalec10462bb2017-03-23 19:18:08 +0100697
698Package manager proxy setup globally:
699
700.. code-block:: yaml
701
702 linux:
703 system:
704 ...
705 repo:
706 apt-mk:
707 source: "deb http://apt-mk.mirantis.com/ stable main salt"
708 ...
709 proxy:
710 pkg:
711 enabled: true
712 ftp: ftp://ftp-proxy-for-apt.host.local:2121
713 ...
714 # NOTE: Global defaults for any other componet that configure proxy on the system.
715 # If your environment has just one simple proxy, set it on linux:system:proxy.
716 #
717 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
718 # as for https and http
719 ftp: ftp://proxy.host.local:2121
720 http: http://proxy.host.local:3142
721 https: https://proxy.host.local:3143
722
723Package manager proxy setup per repository:
724
725.. code-block:: yaml
726
727 linux:
728 system:
729 ...
730 repo:
731 debian:
732 source: "deb http://apt-mk.mirantis.com/ stable main salt"
733 ...
734 apt-mk:
735 source: "deb http://apt-mk.mirantis.com/ stable main salt"
736 # per repository proxy
737 proxy:
738 enabled: true
739 http: http://maas-01:8080
740 https: http://maas-01:8080
741 ...
742 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600743 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +0100744 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
745 pkg:
746 enabled: true
747 ftp: ftp://proxy.host.local:2121
748 #http: http://proxy.host.local:3142
749 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600750 ...
Petr Michalec10462bb2017-03-23 19:18:08 +0100751 # global system fallback system defaults
752 ftp: ftp://proxy.host.local:2121
753 http: http://proxy.host.local:3142
754 https: https://proxy.host.local:3143
755
756
Jiri Broulik34a29b42017-04-25 14:42:54 +0200757Remove all repositories:
758
759.. code-block:: yaml
760
761 linux:
762 system:
763 purge_repos: true
764
Filip Pytlounc512e6c2017-11-22 14:28:10 +0100765Setup custom apt config options:
766
767.. code-block:: yaml
768
769 linux:
770 system:
771 apt:
772 config:
773 compression-workaround:
774 "Acquire::CompressionTypes::Order": "gz"
775 docker-clean:
776 "DPkg::Post-Invoke":
777 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
778 "APT::Update::Post-Invoke":
779 - "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 +0200780
Petr Michalec10462bb2017-03-23 19:18:08 +0100781RC
782~~
783
Jakub Pavlik78859382016-01-21 11:26:39 +0100784rc.local example
785
786.. code-block:: yaml
787
788 linux:
789 system:
790 rc:
791 local: |
792 #!/bin/sh -e
793 #
794 # rc.local
795 #
796 # This script is executed at the end of each multiuser runlevel.
797 # Make sure that the script will "exit 0" on success or any other
798 # value on error.
799 #
800 # In order to enable or disable this script just change the execution
801 # bits.
802 #
803 # By default this script does nothing.
804 exit 0
805
Petr Michalec10462bb2017-03-23 19:18:08 +0100806
Filip Pytloun1f40dac2016-01-22 15:52:57 +0100807Prompt
808~~~~~~
809
810Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every
811user can have different prompt.
812
813.. code-block:: yaml
814
815 linux:
816 system:
817 prompt:
818 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\\]
819 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
820
821On Debian systems to set prompt system-wide it's necessary to remove setting
822PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from
823``/etc/skel/.bashrc``). This formula will do this automatically, but will not
Filip Pytlound9b68da2016-01-22 15:58:41 +0100824touch existing user's ``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +0100825
Filip Pytlouneef11c12016-03-25 11:00:23 +0100826Bash
827~~~~
828
829Fix bash configuration to preserve history across sessions (like ZSH does by
830default).
831
832.. code-block:: yaml
833
834 linux:
835 system:
836 bash:
837 preserve_history: true
838
Dmitry Teselkin949398e2018-05-03 15:50:00 +0300839Login banner message
840~~~~~~~~~~~~~~~~~~~~
841
842/etc/issue is a text file which contains a message or system
843identification to be printed before the login prompt. It may contain
844various @char and \char sequences, if supported by the getty-type
845program employed on the system.
846
847Setting logon banner message is easy:
848
849.. code-block:: yaml
850
851 liunx:
852 system:
853 banner:
854 enabled: true
855 contents: |
856 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
857
858 You must have explicit, authorized permission to access or configure this
859 device. Unauthorized attempts and actions to access or use this system may
860 result in civil and/or criminal penalties.
861 All activities performed on this system are logged and monitored.
862
Filip Pytloune874dfb2016-01-22 16:57:34 +0100863Message of the day
864~~~~~~~~~~~~~~~~~~
865
Dmitry Teselkin538c8242018-04-02 16:13:37 +0300866``pam_motd`` from package ``libpam-modules`` is used for dynamic messages of the
Filip Pytloune874dfb2016-01-22 16:57:34 +0100867day. Setting custom motd will cleanup existing ones.
868
Dmitry Teselkin538c8242018-04-02 16:13:37 +0300869Setting static motd will replace existing ``/etc/motd`` and remove scripts from
870``/etc/update-motd.d``.
871
872Setting static motd:
873
874.. code-block:: yaml
875
876 linux:
877 system:
878 motd: |
879 UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
880
881 You must have explicit, authorized permission to access or configure this
882 device. Unauthorized attempts and actions to access or use this system may
883 result in civil and/or criminal penalties.
884 All activities performed on this system are logged and monitored.
885
886Setting dynamic motd:
887
Filip Pytloune874dfb2016-01-22 16:57:34 +0100888.. code-block:: yaml
889
890 linux:
891 system:
892 motd:
893 - release: |
894 #!/bin/sh
895 [ -r /etc/lsb-release ] && . /etc/lsb-release
896
897 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
898 # Fall back to using the very slow lsb_release utility
899 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
900 fi
901
902 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
903 - warning: |
904 #!/bin/sh
905 printf "This is [company name] network.\n"
906 printf "Unauthorized access strictly prohibited.\n"
907
Marek Celoud713e9072017-05-18 15:20:25 +0200908Services
909~~~~~~~~
910
911Stop and disable linux service:
912
913.. code-block:: yaml
914
915 linux:
916 system:
917 service:
918 apt-daily.timer:
919 status: dead
920
921Possible status is dead (disable service by default), running (enable service by default), enabled, disabled.
922
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +0300923Linux with atop service:
924
925.. code-block:: yaml
926
927 linux:
928 system:
929 atop:
930 enabled: true
931 interval: 20
932 logpath: "/var/log/atop"
933 outfile: "/var/log/atop/daily.log"
934
Oleksii Chupryn144432b2018-05-22 10:34:48 +0300935Linux with mcelog service:
936
937.. code-block:: yaml
938
939 linux:
940 system:
941 mcelog:
942 enabled: true
943 logging:
944 syslog: true
945 syslog_error: true
946
Filip Pytloun2f70b492016-02-19 15:55:25 +0100947RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +0100948^^^^^^^^^^^^^
Filip Pytloun2f70b492016-02-19 15:55:25 +0100949
950Unfortunately ``update-motd`` is currently not available for RHEL so there's
951no native support for dynamic motd.
952You can still set static one, only pillar structure differs:
953
954.. code-block:: yaml
955
956 linux:
957 system:
958 motd: |
959 This is [company name] network.
960 Unauthorized access strictly prohibited.
961
Filip Pytloun8296bb92016-02-19 18:42:09 +0100962Haveged
963~~~~~~~
964
965If you are running headless server and are low on entropy, it may be a good
966idea to setup Haveged.
967
968.. code-block:: yaml
969
970 linux:
971 system:
972 haveged:
973 enabled: true
974
Filip Pytlounf5383a42015-10-06 16:28:32 +0200975Linux network
976-------------
977
978Linux with network manager
979
980.. code-block:: yaml
981
982 linux:
983 network:
984 enabled: true
985 network_manager: true
986
987Linux with default static network interfaces, default gateway interface and DNS servers
988
989.. code-block:: yaml
990
991 linux:
992 network:
993 enabled: true
994 interface:
995 eth0:
996 enabled: true
997 type: eth
998 address: 192.168.0.102
999 netmask: 255.255.255.0
1000 gateway: 192.168.0.1
1001 name_servers:
1002 - 8.8.8.8
1003 - 8.8.4.4
1004 mtu: 1500
1005
jan kaufman6d30adf2016-01-18 17:30:12 +01001006Linux with bonded interfaces and disabled NetworkManager
Filip Pytlounf5383a42015-10-06 16:28:32 +02001007
1008.. code-block:: yaml
1009
1010 linux:
1011 network:
1012 enabled: true
1013 interface:
1014 eth0:
1015 type: eth
1016 ...
1017 eth1:
1018 type: eth
1019 ...
1020 bond0:
1021 enabled: true
1022 type: bond
1023 address: 192.168.0.102
1024 netmask: 255.255.255.0
1025 mtu: 1500
1026 use_in:
1027 - interface: ${linux:interface:eth0}
1028 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +01001029 network_manager:
1030 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001031
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001032Linux with vlan interface_params
1033
1034.. code-block:: yaml
1035
1036 linux:
1037 network:
1038 enabled: true
1039 interface:
1040 vlan69:
1041 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +01001042 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001043 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001044
Filip Pytlounf5383a42015-10-06 16:28:32 +02001045Linux with wireless interface parameters
1046
1047.. code-block:: yaml
1048
1049 linux:
1050 network:
1051 enabled: true
1052 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001053 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001054 interface:
1055 wlan0:
1056 type: eth
1057 wireless:
1058 essid: example
1059 key: example_key
1060 security: wpa
1061 priority: 1
1062
1063Linux networks with routes defined
1064
1065.. code-block:: yaml
1066
1067 linux:
1068 network:
1069 enabled: true
1070 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +01001071 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +02001072 interface:
1073 eth0:
1074 type: eth
1075 route:
1076 default:
1077 address: 192.168.0.123
1078 netmask: 255.255.255.0
1079 gateway: 192.168.0.1
1080
1081Native Linux Bridges
1082
1083.. code-block:: yaml
1084
1085 linux:
1086 network:
1087 interface:
1088 eth1:
1089 enabled: true
1090 type: eth
1091 proto: manual
1092 up_cmds:
1093 - ip address add 0/0 dev $IFACE
1094 - ip link set $IFACE up
1095 down_cmds:
1096 - ip link set $IFACE down
1097 br-ex:
1098 enabled: true
1099 type: bridge
1100 address: ${linux:network:host:public_local:address}
1101 netmask: 255.255.255.0
1102 use_interfaces:
1103 - eth1
1104
1105OpenVswitch Bridges
1106
1107.. code-block:: yaml
1108
1109 linux:
1110 network:
1111 bridge: openvswitch
1112 interface:
1113 eth1:
1114 enabled: true
1115 type: eth
1116 proto: manual
1117 up_cmds:
1118 - ip address add 0/0 dev $IFACE
1119 - ip link set $IFACE up
1120 down_cmds:
1121 - ip link set $IFACE down
1122 br-ex:
1123 enabled: true
1124 type: bridge
1125 address: ${linux:network:host:public_local:address}
1126 netmask: 255.255.255.0
1127 use_interfaces:
1128 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001129 br-prv:
1130 enabled: true
1131 type: ovs_bridge
1132 mtu: 65000
1133 br-ens7:
1134 enabled: true
1135 name: br-ens7
1136 type: ovs_bridge
1137 proto: manual
1138 mtu: 9000
1139 use_interfaces:
1140 - ens7
1141 patch-br-ens7-br-prv:
1142 enabled: true
1143 name: ens7-prv
1144 ovs_type: ovs_port
1145 type: ovs_port
1146 bridge: br-ens7
1147 port_type: patch
1148 peer: prv-ens7
1149 mtu: 65000
1150 patch-br-prv-br-ens7:
1151 enabled: true
1152 name: prv-ens7
1153 bridge: br-prv
1154 ovs_type: ovs_port
1155 type: ovs_port
1156 port_type: patch
1157 peer: ens7-prv
1158 mtu: 65000
1159 ens7:
1160 enabled: true
1161 name: ens7
1162 proto: manual
1163 ovs_port_type: OVSPort
1164 type: ovs_port
1165 ovs_bridge: br-ens7
1166 bridge: br-ens7
Filip Pytlounf5383a42015-10-06 16:28:32 +02001167
Petr Jediný8f8ae542017-07-13 16:19:12 +02001168Debian manual proto interfaces
1169
1170When you are changing interface proto from static in up state to manual, you
1171may need to flush ip addresses. For example, if you want to use the interface
1172and the ip on the bridge. This can be done by setting the ``ipflush_onchange``
1173to true.
1174
1175.. code-block:: yaml
1176
1177 linux:
1178 network:
1179 interface:
1180 eth1:
1181 enabled: true
1182 type: eth
1183 proto: manual
1184 mtu: 9100
1185 ipflush_onchange: true
1186
Jiri Broulik1a191e32018-01-15 15:54:21 +01001187Debian static proto interfaces
1188
1189When you are changing interface proto from dhcp in up state to static, you
1190may need to flush ip addresses and restart interface to assign ip address from a managed file.
1191For example, if you want to use the interface and the ip on the bridge.
1192This can be done by setting the ``ipflush_onchange`` with combination
1193``restart_on_ipflush`` param set to to true.
1194
1195.. code-block:: yaml
1196
1197 linux:
1198 network:
1199 interface:
1200 eth1:
1201 enabled: true
1202 type: eth
1203 proto: static
1204 address: 10.1.0.22
1205 netmask: 255.255.255.0
1206 ipflush_onchange: true
1207 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001208
Petr Jedinýd577cb52017-06-28 20:17:49 +02001209Concatinating and removing interface files
1210
1211Debian based distributions have `/etc/network/interfaces.d/` directory, where
1212you can store configuration of network interfaces in separate files. You can
1213concatinate the files to the defined destination when needed, this operation
1214removes the file from the `/etc/network/interfaces.d/`. If you just need to
1215remove iface files, you can use the `remove_iface_files` key.
1216
1217.. code-block:: yaml
1218
1219 linux:
1220 network:
1221 concat_iface_files:
1222 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1223 dst: '/etc/network/interfaces'
1224 remove_iface_files:
1225 - '/etc/network/interfaces.d/90-custom.cfg'
1226
1227
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001228DHCP client configuration
1229
1230None of the keys is mandatory, include only those you really need. For full list
1231of available options under send, supersede, prepend, append refer to dhcp-options(5)
1232
1233.. code-block:: yaml
1234
1235 linux:
1236 network:
1237 dhclient:
1238 enabled: true
1239 backoff_cutoff: 15
1240 initial_interval: 10
1241 reboot: 10
1242 retry: 60
1243 select_timeout: 0
1244 timeout: 120
1245 send:
1246 - option: host-name
1247 declaration: "= gethostname()"
1248 supersede:
1249 - option: host-name
1250 declaration: "spaceship"
1251 - option: domain-name
1252 declaration: "domain.home"
1253 #- option: arp-cache-timeout
1254 # declaration: 20
1255 prepend:
1256 - option: domain-name-servers
1257 declaration:
1258 - 8.8.8.8
1259 - 8.8.4.4
1260 - option: domain-search
1261 declaration:
1262 - example.com
1263 - eng.example.com
1264 #append:
1265 #- option: domain-name-servers
1266 # declaration: 127.0.0.1
1267 # ip or subnet to reject dhcp offer from
1268 reject:
1269 - 192.33.137.209
1270 - 10.0.2.0/24
1271 request:
1272 - subnet-mask
1273 - broadcast-address
1274 - time-offset
1275 - routers
1276 - domain-name
1277 - domain-name-servers
1278 - domain-search
1279 - host-name
1280 - dhcp6.name-servers
1281 - dhcp6.domain-search
1282 - dhcp6.fqdn
1283 - dhcp6.sntp-servers
1284 - netbios-name-servers
1285 - netbios-scope
1286 - interface-mtu
1287 - rfc3442-classless-static-routes
1288 - ntp-servers
1289 require:
1290 - subnet-mask
1291 - domain-name-servers
1292 # if per interface configuration required add below
1293 interface:
1294 ens2:
1295 initial_interval: 11
1296 reject:
1297 - 192.33.137.210
1298 ens3:
1299 initial_interval: 12
1300 reject:
1301 - 192.33.137.211
1302
Petr Michaleceb14b552017-06-01 10:27:05 +02001303Linux network systemd settings:
1304
1305.. code-block:: yaml
1306
1307 linux:
1308 network:
1309 ...
1310 systemd:
1311 link:
1312 10-iface-dmz:
1313 Match:
1314 MACAddress: c8:5b:67:fa:1a:af
1315 OriginalName: eth0
1316 Link:
1317 Name: dmz0
1318 netdev:
1319 20-bridge-dmz:
1320 match:
1321 name: dmz0
1322 network:
1323 mescription: bridge
1324 bridge: br-dmz0
1325 network:
1326 # works with lowercase, keys are by default capitalized
1327 40-dhcp:
1328 match:
1329 name: '*'
1330 network:
1331 DHCP: yes
1332
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001333
Petr Michalec10462bb2017-03-23 19:18:08 +01001334Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001335
Ales Komarek417e8c52017-08-25 15:10:29 +02001336Use ``/etc/environment`` for static system wide variable assignment after
1337boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001338
1339.. code-block:: yaml
1340
1341 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001342 system:
1343 env:
1344 BOB_VARIABLE: Alice
1345 ...
1346 BOB_PATH:
1347 - /srv/alice/bin
1348 - /srv/bob/bin
1349 ...
1350 ftp_proxy: none
1351 http_proxy: http://global-http-proxy.host.local:8080
1352 https_proxy: ${linux:system:proxy:https}
1353 no_proxy:
1354 - 192.168.0.80
1355 - 192.168.1.80
1356 - .domain.com
1357 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02001358 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001359 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001360 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01001361 ftp: ftp://proxy.host.local:2121
1362 http: http://proxy.host.local:3142
1363 https: https://proxy.host.local:3143
1364 noproxy:
1365 - .domain.com
1366 - .local
1367
1368Configure profile.d scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01001369
Ales Komarek417e8c52017-08-25 15:10:29 +02001370The profile.d scripts are being sourced during .sh execution and support
1371variable expansion in opposite to /etc/environment global settings in
1372``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01001373
1374.. code-block:: yaml
1375
1376 linux:
1377 system:
1378 profile:
1379 locales: |
1380 export LANG=C
1381 export LC_ALL=C
1382 ...
1383 vi_flavors.sh: |
1384 export PAGER=view
1385 export EDITOR=vim
1386 alias vi=vim
1387 shell_locales.sh: |
1388 export LANG=en_US
1389 export LC_ALL=en_US.UTF-8
1390 shell_proxies.sh: |
1391 export FTP_PROXY=ftp://127.0.3.3:2121
1392 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02001393
1394Linux with hosts
1395
Filip Pytloun86506fe2017-01-26 14:36:16 +01001396Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
1397that are not defined in model except defaults for both IPv4 and IPv6 localhost
1398and hostname + fqdn.
Ales Komarek417e8c52017-08-25 15:10:29 +02001399
Filip Pytloun86506fe2017-01-26 14:36:16 +01001400It's good to use this option if you want to ensure /etc/hosts is always in a
1401clean state however it's not enabled by default for safety.
1402
Filip Pytlounf5383a42015-10-06 16:28:32 +02001403.. code-block:: yaml
1404
1405 linux:
1406 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001407 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001408 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001409 # No need to define this one if purge_hosts is true
1410 hostname:
1411 address: 127.0.1.1
1412 names:
1413 - ${linux:network:fqdn}
1414 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02001415 node1:
1416 address: 192.168.10.200
1417 names:
1418 - node2.domain.com
1419 - service2.domain.com
1420 node2:
1421 address: 192.168.10.201
1422 names:
1423 - node2.domain.com
1424 - service2.domain.com
1425
Ales Komarek417e8c52017-08-25 15:10:29 +02001426Linux with hosts collected from mine
1427
1428In this case all dns records defined within infrastrucuture will be passed to
1429local hosts records or any DNS server. Only hosts with `grain` parameter to
1430true will be propagated to the mine.
1431
1432.. code-block:: yaml
1433
1434 linux:
1435 network:
1436 purge_hosts: true
1437 mine_dns_records: true
1438 host:
1439 node1:
1440 address: 192.168.10.200
1441 grain: true
1442 names:
1443 - node2.domain.com
1444 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01001445
Filip Pytlounde9bea52016-01-11 15:39:10 +01001446Setup resolv.conf, nameservers, domain and search domains
1447
1448.. code-block:: yaml
1449
1450 linux:
1451 network:
1452 resolv:
1453 dns:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001454 - 8.8.4.4
1455 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01001456 domain: my.example.com
1457 search:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001458 - my.example.com
1459 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01001460 options:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001461 - ndots: 5
1462 - timeout: 2
1463 - attempts: 2
Filip Pytlounde9bea52016-01-11 15:39:10 +01001464
Ales Komarek417e8c52017-08-25 15:10:29 +02001465setting custom TX queue length for tap interfaces
Andrii Petrenko735761d2017-03-21 17:17:35 -07001466
1467.. code-block:: yaml
1468
1469 linux:
1470 network:
1471 tap_custom_txqueuelen: 10000
1472
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001473DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001474
1475**DPDK OVS NIC**
1476
1477.. code-block:: yaml
1478
1479 linux:
1480 network:
1481 bridge: openvswitch
1482 dpdk:
1483 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001484 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001485 openvswitch:
1486 pmd_cpu_mask: "0x6"
1487 dpdk_socket_mem: "1024,1024"
1488 dpdk_lcore_mask: "0x400"
1489 memory_channels: 2
1490 interface:
1491 dpkd0:
1492 name: ${_param:dpdk_nic}
1493 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001494 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001495 enabled: true
1496 type: dpdk_ovs_port
1497 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001498 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001499 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01001500 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001501 br-prv:
1502 enabled: true
1503 type: dpdk_ovs_bridge
1504
1505**DPDK OVS Bond**
1506
1507.. code-block:: yaml
1508
1509 linux:
1510 network:
1511 bridge: openvswitch
1512 dpdk:
1513 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001514 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001515 openvswitch:
1516 pmd_cpu_mask: "0x6"
1517 dpdk_socket_mem: "1024,1024"
1518 dpdk_lcore_mask: "0x400"
1519 memory_channels: 2
1520 interface:
1521 dpdk_second_nic:
1522 name: ${_param:primary_second_nic}
1523 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001524 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001525 bond: dpdkbond0
1526 enabled: true
1527 type: dpdk_ovs_port
1528 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001529 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001530 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001531 dpdk_first_nic:
1532 name: ${_param:primary_first_nic}
1533 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001534 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001535 bond: dpdkbond0
1536 enabled: true
1537 type: dpdk_ovs_port
1538 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001539 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001540 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001541 dpdkbond0:
1542 enabled: true
1543 bridge: br-prv
1544 type: dpdk_ovs_bond
1545 mode: active-backup
1546 br-prv:
1547 enabled: true
1548 type: dpdk_ovs_bridge
1549
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01001550**DPDK OVS LACP Bond with vlan tag**
1551
1552.. code-block:: yaml
1553
1554 linux:
1555 network:
1556 bridge: openvswitch
1557 dpdk:
1558 enabled: true
1559 driver: uio
1560 openvswitch:
1561 pmd_cpu_mask: "0x6"
1562 dpdk_socket_mem: "1024,1024"
1563 dpdk_lcore_mask: "0x400"
1564 memory_channels: "2"
1565 interface:
1566 eth3:
1567 enabled: true
1568 type: eth
1569 proto: manual
1570 name: ${_param:tenant_first_nic}
1571 eth4:
1572 enabled: true
1573 type: eth
1574 proto: manual
1575 name: ${_param:tenant_second_nic}
1576 dpdk0:
1577 name: ${_param:tenant_first_nic}
1578 pci: "0000:81:00.0"
1579 driver: igb_uio
1580 bond: bond1
1581 enabled: true
1582 type: dpdk_ovs_port
1583 n_rxq: 2
1584 dpdk1:
1585 name: ${_param:tenant_second_nic}
1586 pci: "0000:81:00.1"
1587 driver: igb_uio
1588 bond: bond1
1589 enabled: true
1590 type: dpdk_ovs_port
1591 n_rxq: 2
1592 bond1:
1593 enabled: true
1594 bridge: br-prv
1595 type: dpdk_ovs_bond
1596 mode: balance-slb
1597 br-prv:
1598 enabled: true
1599 type: dpdk_ovs_bridge
1600 tag: ${_param:tenant_vlan}
1601 address: ${_param:tenant_address}
1602 netmask: ${_param:tenant_network_netmask}
1603
Jakub Pavlikaa759062017-03-13 15:57:26 +01001604**DPDK OVS bridge for VXLAN**
1605
1606If VXLAN is used as tenant segmentation then ip address must be set on br-prv
1607
1608.. code-block:: yaml
1609
1610 linux:
1611 network:
1612 ...
1613 interface:
1614 br-prv:
1615 enabled: true
1616 type: dpdk_ovs_bridge
1617 address: 192.168.50.0
1618 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04001619 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01001620 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001621
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02001622
1623
1624**DPDK OVS bridge with Linux network interface**
1625
1626.. code-block:: yaml
1627
1628 linux:
1629 network:
1630 ...
1631 interface:
1632 eth0:
1633 type: eth
1634 ovs_bridge: br-prv
1635 ...
1636 br-prv:
1637 enabled: true
1638 type: dpdk_ovs_bridge
1639 ...
1640
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001641Linux storage
1642-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02001643
1644Linux with mounted Samba
1645
1646.. code-block:: yaml
1647
1648 linux:
1649 storage:
1650 enabled: true
1651 mount:
1652 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01001653 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001654 - path: /media/myuser/public/
1655 - device: //192.168.0.1/storage
1656 - file_system: cifs
1657 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
1658
Jiri Broulikb017f932017-03-31 13:55:36 +02001659NFS mount
1660
1661.. code-block:: yaml
1662
1663 linux:
1664 storage:
1665 enabled: true
1666 mount:
1667 nfs_glance:
1668 enabled: true
1669 path: /var/lib/glance/images
1670 device: 172.16.10.110:/var/nfs/glance
1671 file_system: nfs
1672 opts: rw,sync
1673
1674
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001675File swap configuration
Filip Pytlounf5383a42015-10-06 16:28:32 +02001676
1677.. code-block:: yaml
1678
1679 linux:
1680 storage:
1681 enabled: true
1682 swap:
1683 file:
1684 enabled: true
1685 engine: file
1686 device: /swapfile
1687 size: 1024
1688
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001689Partition swap configuration
Lachlan Evenson30676512016-01-22 15:43:28 -08001690
1691.. code-block:: yaml
1692
1693 linux:
1694 storage:
1695 enabled: true
1696 swap:
1697 partition:
1698 enabled: true
1699 engine: partition
1700 device: /dev/vg0/swap
1701
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001702LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
1703
1704.. code-block:: yaml
1705
1706 parameters:
1707 linux:
1708 storage:
1709 mount:
1710 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01001711 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001712 device: /dev/vg1/data
1713 file_system: ext4
1714 path: /mnt/data
1715 lvm:
1716 vg1:
1717 enabled: true
1718 devices:
1719 - /dev/sdb
1720 volume:
1721 data:
1722 size: 40G
1723 mount: ${linux:storage:mount:data}
1724
Jakub Pavlik4f742142017-08-08 15:05:50 +02001725Create partitions on disk. Specify size in MB. It expects empty
Piotr Krukd51911b2017-12-04 11:27:08 +01001726disk without any existing partitions. (set startsector=1, if you want to start partitions from 2048)
Jakub Pavlik4f742142017-08-08 15:05:50 +02001727
1728.. code-block:: yaml
1729
1730 linux:
1731 storage:
1732 disk:
1733 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01001734 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02001735 name: /dev/loop1
1736 type: gpt
1737 partitions:
1738 - size: 200 #size in MB
1739 type: fat32
1740 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02001741 mkfs: True
1742 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02001743 /dev/vda1:
1744 partitions:
1745 - size: 5
1746 type: ext2
1747 - size: 10
1748 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02001749
1750Multipath with Fujitsu Eternus DXL
1751
1752.. code-block:: yaml
1753
1754 parameters:
1755 linux:
1756 storage:
1757 multipath:
1758 enabled: true
1759 blacklist_devices:
1760 - /dev/sda
1761 - /dev/sdb
1762 backends:
1763 - fujitsu_eternus_dxl
1764
1765Multipath with Hitachi VSP 1000
1766
1767.. code-block:: yaml
1768
1769 parameters:
1770 linux:
1771 storage:
1772 multipath:
1773 enabled: true
1774 blacklist_devices:
1775 - /dev/sda
1776 - /dev/sdb
1777 backends:
1778 - hitachi_vsp1000
1779
1780Multipath with IBM Storwize
1781
1782.. code-block:: yaml
1783
1784 parameters:
1785 linux:
1786 storage:
1787 multipath:
1788 enabled: true
1789 blacklist_devices:
1790 - /dev/sda
1791 - /dev/sdb
1792 backends:
1793 - ibm_storwize
1794
1795Multipath with multiple backends
1796
1797.. code-block:: yaml
1798
1799 parameters:
1800 linux:
1801 storage:
1802 multipath:
1803 enabled: true
1804 blacklist_devices:
1805 - /dev/sda
1806 - /dev/sdb
1807 - /dev/sdc
1808 - /dev/sdd
1809 backends:
1810 - ibm_storwize
1811 - fujitsu_eternus_dxl
1812 - hitachi_vsp1000
1813
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001814PAM LDAP integration
1815
1816.. code-block:: yaml
1817
1818 parameters:
1819 linux:
1820 system:
1821 auth:
1822 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02001823 mkhomedir:
1824 enabled: true
1825 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001826 ldap:
1827 enabled: true
1828 binddn: cn=bind,ou=service_users,dc=example,dc=com
1829 bindpw: secret
1830 uri: ldap://127.0.0.1
1831 base: ou=users,dc=example,dc=com
1832 ldap_version: 3
1833 pagesize: 65536
1834 referrals: off
1835 filter:
1836 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1837 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1838 group: (&(objectClass=group)(gidNumber=*))
1839
Ales Komareka634f4b2016-10-02 13:11:04 +02001840Disabled multipath (the default setup)
1841
1842.. code-block:: yaml
1843
1844 parameters:
1845 linux:
1846 storage:
1847 multipath:
1848 enabled: false
1849
Simon Pasquier375001e2017-01-26 13:22:33 +01001850Linux with local loopback device
1851
1852.. code-block:: yaml
1853
1854 linux:
1855 storage:
1856 loopback:
1857 disk1:
1858 file: /srv/disk1
1859 size: 50G
1860
Filip Pytlounb2c8f852016-11-21 17:03:43 +01001861External config generation
1862--------------------------
1863
1864You are able to use config support metadata between formulas and only generate
1865config files for external use, eg. docker, etc.
1866
1867.. code-block:: yaml
1868
1869 parameters:
1870 linux:
1871 system:
1872 config:
1873 pillar:
1874 jenkins:
1875 master:
1876 home: /srv/volumes/jenkins
1877 approved_scripts:
1878 - method java.net.URL openConnection
1879 credentials:
1880 - type: username_password
1881 scope: global
1882 id: test
1883 desc: Testing credentials
1884 username: test
1885 password: test
1886
Vladimir Ereminccf28842017-04-10 23:52:10 +03001887Netconsole Remote Kernel Logging
1888--------------------------------
1889
1890Netconsole logger could be configured for configfs-enabled kernels
1891(`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in
1892runtime (if network is already configured), and on-boot after interface
1893initialization. Notes:
1894
1895 * receiver could be located only in same L3 domain
1896 (or you need to configure gateway MAC manually)
1897 * receiver's MAC is detected only on configuration time
1898 * using broadcast MAC is not recommended
1899
1900.. code-block:: yaml
1901
1902 parameters:
1903 linux:
1904 system:
1905 netconsole:
1906 enabled: true
1907 port: 514 (optional)
1908 loglevel: debug (optional)
1909 target:
1910 192.168.0.1:
1911 interface: bond0
1912 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02001913
Filip Pytlounf5383a42015-10-06 16:28:32 +02001914Usage
1915=====
1916
1917Set mtu of network interface eth0 to 1400
1918
1919.. code-block:: bash
1920
1921 ip link set dev eth0 mtu 1400
1922
1923Read more
1924=========
1925
1926* https://www.archlinux.org/
1927* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
Filip Pytloun018f8712017-02-02 13:02:03 +01001928
1929Documentation and Bugs
1930======================
1931
1932To learn how to install and update salt-formulas, consult the documentation
1933available online at:
1934
1935 http://salt-formulas.readthedocs.io/
1936
1937In the unfortunate event that bugs are discovered, they should be reported to
1938the appropriate issue tracker. Use Github issue tracker for specific salt
1939formula:
1940
1941 https://github.com/salt-formulas/salt-formula-linux/issues
1942
1943For feature requests, bug reports or blueprints affecting entire ecosystem,
1944use Launchpad salt-formulas project:
1945
1946 https://launchpad.net/salt-formulas
1947
1948You can also join salt-formulas-users team and subscribe to mailing list:
1949
1950 https://launchpad.net/~salt-formulas-users
1951
1952Developers wishing to work on the salt-formulas projects should always base
1953their work on master branch and submit pull request against specific formula.
1954
1955 https://github.com/salt-formulas/salt-formula-linux
1956
1957Any questions or feedback is always welcome so feel free to join our IRC
1958channel:
1959
1960 #salt-formulas @ irc.freenode.net