blob: 45c045d59283af9966b0efdd0d3ee643c6eedc0a [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
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001149 tag: 109 # [] to unset a tag
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001150 mtu: 65000
1151 patch-br-prv-br-ens7:
1152 enabled: true
1153 name: prv-ens7
1154 bridge: br-prv
1155 ovs_type: ovs_port
1156 type: ovs_port
1157 port_type: patch
1158 peer: ens7-prv
Oleksii Chupryn694ee722018-06-13 14:08:58 +03001159 tag: 109
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001160 mtu: 65000
1161 ens7:
1162 enabled: true
1163 name: ens7
1164 proto: manual
1165 ovs_port_type: OVSPort
1166 type: ovs_port
1167 ovs_bridge: br-ens7
1168 bridge: br-ens7
Filip Pytlounf5383a42015-10-06 16:28:32 +02001169
Petr Jediný8f8ae542017-07-13 16:19:12 +02001170Debian manual proto interfaces
1171
1172When you are changing interface proto from static in up state to manual, you
1173may need to flush ip addresses. For example, if you want to use the interface
1174and the ip on the bridge. This can be done by setting the ``ipflush_onchange``
1175to true.
1176
1177.. code-block:: yaml
1178
1179 linux:
1180 network:
1181 interface:
1182 eth1:
1183 enabled: true
1184 type: eth
1185 proto: manual
1186 mtu: 9100
1187 ipflush_onchange: true
1188
Jiri Broulik1a191e32018-01-15 15:54:21 +01001189Debian static proto interfaces
1190
1191When you are changing interface proto from dhcp in up state to static, you
1192may need to flush ip addresses and restart interface to assign ip address from a managed file.
1193For example, if you want to use the interface and the ip on the bridge.
1194This can be done by setting the ``ipflush_onchange`` with combination
1195``restart_on_ipflush`` param set to to true.
1196
1197.. code-block:: yaml
1198
1199 linux:
1200 network:
1201 interface:
1202 eth1:
1203 enabled: true
1204 type: eth
1205 proto: static
1206 address: 10.1.0.22
1207 netmask: 255.255.255.0
1208 ipflush_onchange: true
1209 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001210
Petr Jedinýd577cb52017-06-28 20:17:49 +02001211Concatinating and removing interface files
1212
1213Debian based distributions have `/etc/network/interfaces.d/` directory, where
1214you can store configuration of network interfaces in separate files. You can
1215concatinate the files to the defined destination when needed, this operation
1216removes the file from the `/etc/network/interfaces.d/`. If you just need to
1217remove iface files, you can use the `remove_iface_files` key.
1218
1219.. code-block:: yaml
1220
1221 linux:
1222 network:
1223 concat_iface_files:
1224 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1225 dst: '/etc/network/interfaces'
1226 remove_iface_files:
1227 - '/etc/network/interfaces.d/90-custom.cfg'
1228
1229
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001230DHCP client configuration
1231
1232None of the keys is mandatory, include only those you really need. For full list
1233of available options under send, supersede, prepend, append refer to dhcp-options(5)
1234
1235.. code-block:: yaml
1236
1237 linux:
1238 network:
1239 dhclient:
1240 enabled: true
1241 backoff_cutoff: 15
1242 initial_interval: 10
1243 reboot: 10
1244 retry: 60
1245 select_timeout: 0
1246 timeout: 120
1247 send:
1248 - option: host-name
1249 declaration: "= gethostname()"
1250 supersede:
1251 - option: host-name
1252 declaration: "spaceship"
1253 - option: domain-name
1254 declaration: "domain.home"
1255 #- option: arp-cache-timeout
1256 # declaration: 20
1257 prepend:
1258 - option: domain-name-servers
1259 declaration:
1260 - 8.8.8.8
1261 - 8.8.4.4
1262 - option: domain-search
1263 declaration:
1264 - example.com
1265 - eng.example.com
1266 #append:
1267 #- option: domain-name-servers
1268 # declaration: 127.0.0.1
1269 # ip or subnet to reject dhcp offer from
1270 reject:
1271 - 192.33.137.209
1272 - 10.0.2.0/24
1273 request:
1274 - subnet-mask
1275 - broadcast-address
1276 - time-offset
1277 - routers
1278 - domain-name
1279 - domain-name-servers
1280 - domain-search
1281 - host-name
1282 - dhcp6.name-servers
1283 - dhcp6.domain-search
1284 - dhcp6.fqdn
1285 - dhcp6.sntp-servers
1286 - netbios-name-servers
1287 - netbios-scope
1288 - interface-mtu
1289 - rfc3442-classless-static-routes
1290 - ntp-servers
1291 require:
1292 - subnet-mask
1293 - domain-name-servers
1294 # if per interface configuration required add below
1295 interface:
1296 ens2:
1297 initial_interval: 11
1298 reject:
1299 - 192.33.137.210
1300 ens3:
1301 initial_interval: 12
1302 reject:
1303 - 192.33.137.211
1304
Petr Michaleceb14b552017-06-01 10:27:05 +02001305Linux network systemd settings:
1306
1307.. code-block:: yaml
1308
1309 linux:
1310 network:
1311 ...
1312 systemd:
1313 link:
1314 10-iface-dmz:
1315 Match:
1316 MACAddress: c8:5b:67:fa:1a:af
1317 OriginalName: eth0
1318 Link:
1319 Name: dmz0
1320 netdev:
1321 20-bridge-dmz:
1322 match:
1323 name: dmz0
1324 network:
1325 mescription: bridge
1326 bridge: br-dmz0
1327 network:
1328 # works with lowercase, keys are by default capitalized
1329 40-dhcp:
1330 match:
1331 name: '*'
1332 network:
1333 DHCP: yes
1334
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001335
Petr Michalec10462bb2017-03-23 19:18:08 +01001336Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001337
Ales Komarek417e8c52017-08-25 15:10:29 +02001338Use ``/etc/environment`` for static system wide variable assignment after
1339boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001340
1341.. code-block:: yaml
1342
1343 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001344 system:
1345 env:
1346 BOB_VARIABLE: Alice
1347 ...
1348 BOB_PATH:
1349 - /srv/alice/bin
1350 - /srv/bob/bin
1351 ...
1352 ftp_proxy: none
1353 http_proxy: http://global-http-proxy.host.local:8080
1354 https_proxy: ${linux:system:proxy:https}
1355 no_proxy:
1356 - 192.168.0.80
1357 - 192.168.1.80
1358 - .domain.com
1359 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02001360 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001361 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001362 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01001363 ftp: ftp://proxy.host.local:2121
1364 http: http://proxy.host.local:3142
1365 https: https://proxy.host.local:3143
1366 noproxy:
1367 - .domain.com
1368 - .local
1369
1370Configure profile.d scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01001371
Ales Komarek417e8c52017-08-25 15:10:29 +02001372The profile.d scripts are being sourced during .sh execution and support
1373variable expansion in opposite to /etc/environment global settings in
1374``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01001375
1376.. code-block:: yaml
1377
1378 linux:
1379 system:
1380 profile:
1381 locales: |
1382 export LANG=C
1383 export LC_ALL=C
1384 ...
1385 vi_flavors.sh: |
1386 export PAGER=view
1387 export EDITOR=vim
1388 alias vi=vim
1389 shell_locales.sh: |
1390 export LANG=en_US
1391 export LC_ALL=en_US.UTF-8
1392 shell_proxies.sh: |
1393 export FTP_PROXY=ftp://127.0.3.3:2121
1394 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02001395
1396Linux with hosts
1397
Filip Pytloun86506fe2017-01-26 14:36:16 +01001398Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
1399that are not defined in model except defaults for both IPv4 and IPv6 localhost
1400and hostname + fqdn.
Ales Komarek417e8c52017-08-25 15:10:29 +02001401
Filip Pytloun86506fe2017-01-26 14:36:16 +01001402It's good to use this option if you want to ensure /etc/hosts is always in a
1403clean state however it's not enabled by default for safety.
1404
Filip Pytlounf5383a42015-10-06 16:28:32 +02001405.. code-block:: yaml
1406
1407 linux:
1408 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001409 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001410 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001411 # No need to define this one if purge_hosts is true
1412 hostname:
1413 address: 127.0.1.1
1414 names:
1415 - ${linux:network:fqdn}
1416 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02001417 node1:
1418 address: 192.168.10.200
1419 names:
1420 - node2.domain.com
1421 - service2.domain.com
1422 node2:
1423 address: 192.168.10.201
1424 names:
1425 - node2.domain.com
1426 - service2.domain.com
1427
Ales Komarek417e8c52017-08-25 15:10:29 +02001428Linux with hosts collected from mine
1429
1430In this case all dns records defined within infrastrucuture will be passed to
1431local hosts records or any DNS server. Only hosts with `grain` parameter to
1432true will be propagated to the mine.
1433
1434.. code-block:: yaml
1435
1436 linux:
1437 network:
1438 purge_hosts: true
1439 mine_dns_records: true
1440 host:
1441 node1:
1442 address: 192.168.10.200
1443 grain: true
1444 names:
1445 - node2.domain.com
1446 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01001447
Filip Pytlounde9bea52016-01-11 15:39:10 +01001448Setup resolv.conf, nameservers, domain and search domains
1449
1450.. code-block:: yaml
1451
1452 linux:
1453 network:
1454 resolv:
1455 dns:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001456 - 8.8.4.4
1457 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01001458 domain: my.example.com
1459 search:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001460 - my.example.com
1461 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01001462 options:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001463 - ndots: 5
1464 - timeout: 2
1465 - attempts: 2
Filip Pytlounde9bea52016-01-11 15:39:10 +01001466
Ales Komarek417e8c52017-08-25 15:10:29 +02001467setting custom TX queue length for tap interfaces
Andrii Petrenko735761d2017-03-21 17:17:35 -07001468
1469.. code-block:: yaml
1470
1471 linux:
1472 network:
1473 tap_custom_txqueuelen: 10000
1474
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001475DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001476
1477**DPDK OVS NIC**
1478
1479.. code-block:: yaml
1480
1481 linux:
1482 network:
1483 bridge: openvswitch
1484 dpdk:
1485 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001486 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001487 openvswitch:
1488 pmd_cpu_mask: "0x6"
1489 dpdk_socket_mem: "1024,1024"
1490 dpdk_lcore_mask: "0x400"
1491 memory_channels: 2
1492 interface:
1493 dpkd0:
1494 name: ${_param:dpdk_nic}
1495 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001496 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001497 enabled: true
1498 type: dpdk_ovs_port
1499 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001500 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001501 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01001502 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001503 br-prv:
1504 enabled: true
1505 type: dpdk_ovs_bridge
1506
1507**DPDK OVS Bond**
1508
1509.. code-block:: yaml
1510
1511 linux:
1512 network:
1513 bridge: openvswitch
1514 dpdk:
1515 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001516 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001517 openvswitch:
1518 pmd_cpu_mask: "0x6"
1519 dpdk_socket_mem: "1024,1024"
1520 dpdk_lcore_mask: "0x400"
1521 memory_channels: 2
1522 interface:
1523 dpdk_second_nic:
1524 name: ${_param:primary_second_nic}
1525 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001526 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001527 bond: dpdkbond0
1528 enabled: true
1529 type: dpdk_ovs_port
1530 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001531 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001532 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001533 dpdk_first_nic:
1534 name: ${_param:primary_first_nic}
1535 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001536 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001537 bond: dpdkbond0
1538 enabled: true
1539 type: dpdk_ovs_port
1540 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001541 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001542 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001543 dpdkbond0:
1544 enabled: true
1545 bridge: br-prv
1546 type: dpdk_ovs_bond
1547 mode: active-backup
1548 br-prv:
1549 enabled: true
1550 type: dpdk_ovs_bridge
1551
Dzmitry Stremkouskif619b072018-03-15 20:13:42 +01001552**DPDK OVS LACP Bond with vlan tag**
1553
1554.. code-block:: yaml
1555
1556 linux:
1557 network:
1558 bridge: openvswitch
1559 dpdk:
1560 enabled: true
1561 driver: uio
1562 openvswitch:
1563 pmd_cpu_mask: "0x6"
1564 dpdk_socket_mem: "1024,1024"
1565 dpdk_lcore_mask: "0x400"
1566 memory_channels: "2"
1567 interface:
1568 eth3:
1569 enabled: true
1570 type: eth
1571 proto: manual
1572 name: ${_param:tenant_first_nic}
1573 eth4:
1574 enabled: true
1575 type: eth
1576 proto: manual
1577 name: ${_param:tenant_second_nic}
1578 dpdk0:
1579 name: ${_param:tenant_first_nic}
1580 pci: "0000:81:00.0"
1581 driver: igb_uio
1582 bond: bond1
1583 enabled: true
1584 type: dpdk_ovs_port
1585 n_rxq: 2
1586 dpdk1:
1587 name: ${_param:tenant_second_nic}
1588 pci: "0000:81:00.1"
1589 driver: igb_uio
1590 bond: bond1
1591 enabled: true
1592 type: dpdk_ovs_port
1593 n_rxq: 2
1594 bond1:
1595 enabled: true
1596 bridge: br-prv
1597 type: dpdk_ovs_bond
1598 mode: balance-slb
1599 br-prv:
1600 enabled: true
1601 type: dpdk_ovs_bridge
1602 tag: ${_param:tenant_vlan}
1603 address: ${_param:tenant_address}
1604 netmask: ${_param:tenant_network_netmask}
1605
Jakub Pavlikaa759062017-03-13 15:57:26 +01001606**DPDK OVS bridge for VXLAN**
1607
1608If VXLAN is used as tenant segmentation then ip address must be set on br-prv
1609
1610.. code-block:: yaml
1611
1612 linux:
1613 network:
1614 ...
1615 interface:
1616 br-prv:
1617 enabled: true
1618 type: dpdk_ovs_bridge
1619 address: 192.168.50.0
1620 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04001621 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01001622 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001623
Oleksii Chupryne2151ff2018-03-13 16:01:12 +02001624
1625
1626**DPDK OVS bridge with Linux network interface**
1627
1628.. code-block:: yaml
1629
1630 linux:
1631 network:
1632 ...
1633 interface:
1634 eth0:
1635 type: eth
1636 ovs_bridge: br-prv
1637 ...
1638 br-prv:
1639 enabled: true
1640 type: dpdk_ovs_bridge
1641 ...
1642
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001643Linux storage
1644-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02001645
1646Linux with mounted Samba
1647
1648.. code-block:: yaml
1649
1650 linux:
1651 storage:
1652 enabled: true
1653 mount:
1654 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01001655 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001656 - path: /media/myuser/public/
1657 - device: //192.168.0.1/storage
1658 - file_system: cifs
1659 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
1660
Jiri Broulikb017f932017-03-31 13:55:36 +02001661NFS mount
1662
1663.. code-block:: yaml
1664
1665 linux:
1666 storage:
1667 enabled: true
1668 mount:
1669 nfs_glance:
1670 enabled: true
1671 path: /var/lib/glance/images
1672 device: 172.16.10.110:/var/nfs/glance
1673 file_system: nfs
1674 opts: rw,sync
1675
1676
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001677File swap configuration
Filip Pytlounf5383a42015-10-06 16:28:32 +02001678
1679.. code-block:: yaml
1680
1681 linux:
1682 storage:
1683 enabled: true
1684 swap:
1685 file:
1686 enabled: true
1687 engine: file
1688 device: /swapfile
1689 size: 1024
1690
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001691Partition swap configuration
Lachlan Evenson30676512016-01-22 15:43:28 -08001692
1693.. code-block:: yaml
1694
1695 linux:
1696 storage:
1697 enabled: true
1698 swap:
1699 partition:
1700 enabled: true
1701 engine: partition
1702 device: /dev/vg0/swap
1703
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001704LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
1705
1706.. code-block:: yaml
1707
1708 parameters:
1709 linux:
1710 storage:
1711 mount:
1712 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01001713 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001714 device: /dev/vg1/data
1715 file_system: ext4
1716 path: /mnt/data
1717 lvm:
1718 vg1:
1719 enabled: true
1720 devices:
1721 - /dev/sdb
1722 volume:
1723 data:
1724 size: 40G
1725 mount: ${linux:storage:mount:data}
1726
Jakub Pavlik4f742142017-08-08 15:05:50 +02001727Create partitions on disk. Specify size in MB. It expects empty
Piotr Krukd51911b2017-12-04 11:27:08 +01001728disk without any existing partitions. (set startsector=1, if you want to start partitions from 2048)
Jakub Pavlik4f742142017-08-08 15:05:50 +02001729
1730.. code-block:: yaml
1731
1732 linux:
1733 storage:
1734 disk:
1735 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01001736 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02001737 name: /dev/loop1
1738 type: gpt
1739 partitions:
1740 - size: 200 #size in MB
1741 type: fat32
1742 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02001743 mkfs: True
1744 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02001745 /dev/vda1:
1746 partitions:
1747 - size: 5
1748 type: ext2
1749 - size: 10
1750 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02001751
1752Multipath with Fujitsu Eternus DXL
1753
1754.. code-block:: yaml
1755
1756 parameters:
1757 linux:
1758 storage:
1759 multipath:
1760 enabled: true
1761 blacklist_devices:
1762 - /dev/sda
1763 - /dev/sdb
1764 backends:
1765 - fujitsu_eternus_dxl
1766
1767Multipath with Hitachi VSP 1000
1768
1769.. code-block:: yaml
1770
1771 parameters:
1772 linux:
1773 storage:
1774 multipath:
1775 enabled: true
1776 blacklist_devices:
1777 - /dev/sda
1778 - /dev/sdb
1779 backends:
1780 - hitachi_vsp1000
1781
1782Multipath with IBM Storwize
1783
1784.. code-block:: yaml
1785
1786 parameters:
1787 linux:
1788 storage:
1789 multipath:
1790 enabled: true
1791 blacklist_devices:
1792 - /dev/sda
1793 - /dev/sdb
1794 backends:
1795 - ibm_storwize
1796
1797Multipath with multiple backends
1798
1799.. code-block:: yaml
1800
1801 parameters:
1802 linux:
1803 storage:
1804 multipath:
1805 enabled: true
1806 blacklist_devices:
1807 - /dev/sda
1808 - /dev/sdb
1809 - /dev/sdc
1810 - /dev/sdd
1811 backends:
1812 - ibm_storwize
1813 - fujitsu_eternus_dxl
1814 - hitachi_vsp1000
1815
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001816PAM LDAP integration
1817
1818.. code-block:: yaml
1819
1820 parameters:
1821 linux:
1822 system:
1823 auth:
1824 enabled: true
Dzmitry Stremkouski602735d2018-05-09 22:31:39 +02001825 mkhomedir:
1826 enabled: true
1827 umask: 0027
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001828 ldap:
1829 enabled: true
1830 binddn: cn=bind,ou=service_users,dc=example,dc=com
1831 bindpw: secret
1832 uri: ldap://127.0.0.1
1833 base: ou=users,dc=example,dc=com
1834 ldap_version: 3
1835 pagesize: 65536
1836 referrals: off
1837 filter:
1838 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1839 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1840 group: (&(objectClass=group)(gidNumber=*))
1841
Ales Komareka634f4b2016-10-02 13:11:04 +02001842Disabled multipath (the default setup)
1843
1844.. code-block:: yaml
1845
1846 parameters:
1847 linux:
1848 storage:
1849 multipath:
1850 enabled: false
1851
Simon Pasquier375001e2017-01-26 13:22:33 +01001852Linux with local loopback device
1853
1854.. code-block:: yaml
1855
1856 linux:
1857 storage:
1858 loopback:
1859 disk1:
1860 file: /srv/disk1
1861 size: 50G
1862
Filip Pytlounb2c8f852016-11-21 17:03:43 +01001863External config generation
1864--------------------------
1865
1866You are able to use config support metadata between formulas and only generate
1867config files for external use, eg. docker, etc.
1868
1869.. code-block:: yaml
1870
1871 parameters:
1872 linux:
1873 system:
1874 config:
1875 pillar:
1876 jenkins:
1877 master:
1878 home: /srv/volumes/jenkins
1879 approved_scripts:
1880 - method java.net.URL openConnection
1881 credentials:
1882 - type: username_password
1883 scope: global
1884 id: test
1885 desc: Testing credentials
1886 username: test
1887 password: test
1888
Vladimir Ereminccf28842017-04-10 23:52:10 +03001889Netconsole Remote Kernel Logging
1890--------------------------------
1891
1892Netconsole logger could be configured for configfs-enabled kernels
1893(`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in
1894runtime (if network is already configured), and on-boot after interface
1895initialization. Notes:
1896
1897 * receiver could be located only in same L3 domain
1898 (or you need to configure gateway MAC manually)
1899 * receiver's MAC is detected only on configuration time
1900 * using broadcast MAC is not recommended
1901
1902.. code-block:: yaml
1903
1904 parameters:
1905 linux:
1906 system:
1907 netconsole:
1908 enabled: true
1909 port: 514 (optional)
1910 loglevel: debug (optional)
1911 target:
1912 192.168.0.1:
1913 interface: bond0
1914 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02001915
Filip Pytlounf5383a42015-10-06 16:28:32 +02001916Usage
1917=====
1918
1919Set mtu of network interface eth0 to 1400
1920
1921.. code-block:: bash
1922
1923 ip link set dev eth0 mtu 1400
1924
1925Read more
1926=========
1927
1928* https://www.archlinux.org/
1929* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
Filip Pytloun018f8712017-02-02 13:02:03 +01001930
1931Documentation and Bugs
1932======================
1933
1934To learn how to install and update salt-formulas, consult the documentation
1935available online at:
1936
1937 http://salt-formulas.readthedocs.io/
1938
1939In the unfortunate event that bugs are discovered, they should be reported to
1940the appropriate issue tracker. Use Github issue tracker for specific salt
1941formula:
1942
1943 https://github.com/salt-formulas/salt-formula-linux/issues
1944
1945For feature requests, bug reports or blueprints affecting entire ecosystem,
1946use Launchpad salt-formulas project:
1947
1948 https://launchpad.net/salt-formulas
1949
1950You can also join salt-formulas-users team and subscribe to mailing list:
1951
1952 https://launchpad.net/~salt-formulas-users
1953
1954Developers wishing to work on the salt-formulas projects should always base
1955their work on master branch and submit pull request against specific formula.
1956
1957 https://github.com/salt-formulas/salt-formula-linux
1958
1959Any questions or feedback is always welcome so feel free to join our IRC
1960channel:
1961
1962 #salt-formulas @ irc.freenode.net