blob: 8628f80e3721078581e7f2855335af7adbc01d05 [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
Filip Pytloun281034a2016-01-04 18:06:22 +0100344Kernel
345~~~~~~
346
347Install always up to date LTS kernel and headers from Ubuntu trusty:
348
349.. code-block:: yaml
350
351 linux:
352 system:
353 kernel:
354 type: generic
355 lts: trusty
356 headers: true
357
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100358Load kernel modules and add them to `/etc/modules`:
359
360.. code-block:: yaml
361
362 linux:
363 system:
364 kernel:
365 modules:
366 - nf_conntrack
367 - tp_smapi
368 - 8021q
369
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300370Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
371will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`:
372
373.. code-block:: yaml
374
375 linux:
376 system:
377 kernel:
378 module:
379 nf_conntrack:
380 option:
381 hashsize: 262144
382
383
384
Filip Pytloun281034a2016-01-04 18:06:22 +0100385Install specific kernel version and ensure all other kernel packages are
386not present. Also install extra modules and headers for this kernel:
387
388.. code-block:: yaml
389
390 linux:
391 system:
392 kernel:
393 type: generic
394 extra: true
395 headers: true
396 version: 4.2.0-22
397
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100398Systcl kernel parameters
399
400.. code-block:: yaml
401
402 linux:
403 system:
404 kernel:
405 sysctl:
406 net.ipv4.tcp_keepalive_intvl: 3
407 net.ipv4.tcp_keepalive_time: 30
408 net.ipv4.tcp_keepalive_probes: 8
409
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100410
411CPU
412~~~
413
teoyaomiqui32b1f7c2017-05-24 14:36:09 +0300414Enable cpufreq governor for every cpu:
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100415
416.. code-block:: yaml
417
418 linux:
419 system:
420 cpu:
421 governor: performance
422
Nick Metzf04f5f32018-01-08 15:25:04 +0100423
Jiri Broulik303905d2018-01-11 14:12:48 +0100424CGROUPS
425~~~~~~~
426
427Setup linux cgroups:
428
429.. code-block:: yaml
430
431 linux:
432 system:
433 cgroup:
434 enabled: true
435 group:
436 ceph_group_1:
437 controller:
438 cpu:
439 shares:
440 value: 250
441 cpuacct:
442 usage:
443 value: 0
444 cpuset:
445 cpus:
446 value: 1,2,3
447 memory:
448 limit_in_bytes:
449 value: 2G
450 memsw.limit_in_bytes:
451 value: 3G
452 mapping:
453 subjects:
454 - '@ceph'
455 generic_group_1:
456 controller:
457 cpu:
458 shares:
459 value: 250
460 cpuacct:
461 usage:
462 value: 0
463 mapping:
464 subjects:
465 - '*:firefox'
466 - 'student:cp'
467
468
Nick Metzf04f5f32018-01-08 15:25:04 +0100469Shared Libraries
470~~~~~~~~~~~~~~~~
471
472Set additional shared library to Linux system library path
473
474.. code-block:: yaml
475
476 linux:
477 system:
478 ld:
479 library:
480 java:
481 - /usr/lib/jvm/jre-openjdk/lib/amd64/server
482 - /opt/java/jre/lib/amd64/server
483
484
Filip Pytloun2fde88b2017-10-05 10:30:29 +0200485Certificates
486~~~~~~~~~~~~
487
488Add certificate authority into system trusted CA bundle
489
490.. code-block:: yaml
491
492 linux:
493 system:
494 ca_certificates:
495 mycert: |
496 -----BEGIN CERTIFICATE-----
497 MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
498 A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
499 cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
500 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
501 BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
502 YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
503 ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
504 BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
505 I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
506 CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
507 lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
508 AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
509 -----END CERTIFICATE-----
510
Filip Pytloun361096c2017-08-23 10:57:20 +0200511Sysfs
512~~~~~
513
514Install sysfsutils and set sysfs attributes:
515
516.. code-block:: yaml
517
518 linux:
519 system:
520 sysfs:
521 scheduler:
522 block/sda/queue/scheduler: deadline
523 power:
524 mode:
525 power/state: 0660
526 owner:
527 power/state: "root:power"
528 devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
529
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100530Huge Pages
531~~~~~~~~~~~~
532
533Huge Pages give a performance boost to applications that intensively deal
534with memory allocation/deallocation by decreasing memory fragmentation.
535
536.. code-block:: yaml
537
538 linux:
539 system:
540 kernel:
541 hugepages:
542 small:
543 size: 2M
544 count: 107520
545 mount_point: /mnt/hugepages_2MB
546 mount: false/true # default false
547 large:
548 default: true # default automatically mounted
549 size: 1G
550 count: 210
551 mount_point: /mnt/hugepages_1GB
552
553Note: not recommended to use both pagesizes in concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100554
Jakub Pavlik5398d872017-02-13 22:30:47 +0100555Intel SR-IOV
556~~~~~~~~~~~~
557
558PCI-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.
559
560.. code-block:: yaml
561
562 linux:
563 system:
564 kernel:
565 sriov: True
566 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
567 rc:
568 local: |
569 #!/bin/sh -e
570 # Enable 7 VF on eth1
571 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
572 exit 0
573
Jakub Pavlik6c9ead12017-02-16 21:53:13 +0100574Isolate CPU options
575~~~~~~~~~~~~~~~~~~~
576
577Remove the specified CPUs, as defined by the cpu_number values, from the general kernel
578SMP balancing and scheduler algroithms. The only way to move a process onto or off an
579"isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the
580maximum value is 1 less than the number of CPUs on the system.
581
582.. code-block:: yaml
583
584 linux:
585 system:
586 kernel:
587 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100588
Filip Pytlounf5383a42015-10-06 16:28:32 +0200589Repositories
590~~~~~~~~~~~~
591
592RedHat based Linux with additional OpenStack repo
593
594.. code-block:: yaml
595
596 linux:
597 system:
598 ...
599 repo:
600 rdo-icehouse:
601 enabled: true
602 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
603 pgpcheck: 0
604
605Ensure system repository to use czech Debian mirror (``default: true``)
606Also pin it's packages with priority 900.
607
608.. code-block:: yaml
609
610 linux:
611 system:
612 repo:
613 debian:
614 default: true
615 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
616 # Import signing key from URL if needed
617 key_url: "http://dummy.com/public.gpg"
618 pin:
619 - pin: 'origin "ftp.cz.debian.org"'
620 priority: 900
621 package: '*'
622
Petr Michalec10462bb2017-03-23 19:18:08 +0100623
624Package manager proxy setup globally:
625
626.. code-block:: yaml
627
628 linux:
629 system:
630 ...
631 repo:
632 apt-mk:
633 source: "deb http://apt-mk.mirantis.com/ stable main salt"
634 ...
635 proxy:
636 pkg:
637 enabled: true
638 ftp: ftp://ftp-proxy-for-apt.host.local:2121
639 ...
640 # NOTE: Global defaults for any other componet that configure proxy on the system.
641 # If your environment has just one simple proxy, set it on linux:system:proxy.
642 #
643 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
644 # as for https and http
645 ftp: ftp://proxy.host.local:2121
646 http: http://proxy.host.local:3142
647 https: https://proxy.host.local:3143
648
649Package manager proxy setup per repository:
650
651.. code-block:: yaml
652
653 linux:
654 system:
655 ...
656 repo:
657 debian:
658 source: "deb http://apt-mk.mirantis.com/ stable main salt"
659 ...
660 apt-mk:
661 source: "deb http://apt-mk.mirantis.com/ stable main salt"
662 # per repository proxy
663 proxy:
664 enabled: true
665 http: http://maas-01:8080
666 https: http://maas-01:8080
667 ...
668 proxy:
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600669 # package manager fallback defaults
Petr Michalec10462bb2017-03-23 19:18:08 +0100670 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
671 pkg:
672 enabled: true
673 ftp: ftp://proxy.host.local:2121
674 #http: http://proxy.host.local:3142
675 #https: https://proxy.host.local:3143
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -0600676 ...
Petr Michalec10462bb2017-03-23 19:18:08 +0100677 # global system fallback system defaults
678 ftp: ftp://proxy.host.local:2121
679 http: http://proxy.host.local:3142
680 https: https://proxy.host.local:3143
681
682
Jiri Broulik34a29b42017-04-25 14:42:54 +0200683Remove all repositories:
684
685.. code-block:: yaml
686
687 linux:
688 system:
689 purge_repos: true
690
Filip Pytlounc512e6c2017-11-22 14:28:10 +0100691Setup custom apt config options:
692
693.. code-block:: yaml
694
695 linux:
696 system:
697 apt:
698 config:
699 compression-workaround:
700 "Acquire::CompressionTypes::Order": "gz"
701 docker-clean:
702 "DPkg::Post-Invoke":
703 - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
704 "APT::Update::Post-Invoke":
705 - "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 +0200706
Petr Michalec10462bb2017-03-23 19:18:08 +0100707RC
708~~
709
Jakub Pavlik78859382016-01-21 11:26:39 +0100710rc.local example
711
712.. code-block:: yaml
713
714 linux:
715 system:
716 rc:
717 local: |
718 #!/bin/sh -e
719 #
720 # rc.local
721 #
722 # This script is executed at the end of each multiuser runlevel.
723 # Make sure that the script will "exit 0" on success or any other
724 # value on error.
725 #
726 # In order to enable or disable this script just change the execution
727 # bits.
728 #
729 # By default this script does nothing.
730 exit 0
731
Petr Michalec10462bb2017-03-23 19:18:08 +0100732
Filip Pytloun1f40dac2016-01-22 15:52:57 +0100733Prompt
734~~~~~~
735
736Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every
737user can have different prompt.
738
739.. code-block:: yaml
740
741 linux:
742 system:
743 prompt:
744 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\\]
745 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
746
747On Debian systems to set prompt system-wide it's necessary to remove setting
748PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from
749``/etc/skel/.bashrc``). This formula will do this automatically, but will not
Filip Pytlound9b68da2016-01-22 15:58:41 +0100750touch existing user's ``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +0100751
Filip Pytlouneef11c12016-03-25 11:00:23 +0100752Bash
753~~~~
754
755Fix bash configuration to preserve history across sessions (like ZSH does by
756default).
757
758.. code-block:: yaml
759
760 linux:
761 system:
762 bash:
763 preserve_history: true
764
Filip Pytloune874dfb2016-01-22 16:57:34 +0100765Message of the day
766~~~~~~~~~~~~~~~~~~
767
768``pam_motd`` from package ``update-motd`` is used for dynamic messages of the
769day. Setting custom motd will cleanup existing ones.
770
771.. code-block:: yaml
772
773 linux:
774 system:
775 motd:
776 - release: |
777 #!/bin/sh
778 [ -r /etc/lsb-release ] && . /etc/lsb-release
779
780 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
781 # Fall back to using the very slow lsb_release utility
782 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
783 fi
784
785 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
786 - warning: |
787 #!/bin/sh
788 printf "This is [company name] network.\n"
789 printf "Unauthorized access strictly prohibited.\n"
790
Marek Celoud713e9072017-05-18 15:20:25 +0200791Services
792~~~~~~~~
793
794Stop and disable linux service:
795
796.. code-block:: yaml
797
798 linux:
799 system:
800 service:
801 apt-daily.timer:
802 status: dead
803
804Possible status is dead (disable service by default), running (enable service by default), enabled, disabled.
805
Serhiy Ovsianikov67bd56a2017-08-11 15:56:01 +0300806Linux with atop service:
807
808.. code-block:: yaml
809
810 linux:
811 system:
812 atop:
813 enabled: true
814 interval: 20
815 logpath: "/var/log/atop"
816 outfile: "/var/log/atop/daily.log"
817
Filip Pytloun2f70b492016-02-19 15:55:25 +0100818RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +0100819^^^^^^^^^^^^^
Filip Pytloun2f70b492016-02-19 15:55:25 +0100820
821Unfortunately ``update-motd`` is currently not available for RHEL so there's
822no native support for dynamic motd.
823You can still set static one, only pillar structure differs:
824
825.. code-block:: yaml
826
827 linux:
828 system:
829 motd: |
830 This is [company name] network.
831 Unauthorized access strictly prohibited.
832
Filip Pytloun8296bb92016-02-19 18:42:09 +0100833Haveged
834~~~~~~~
835
836If you are running headless server and are low on entropy, it may be a good
837idea to setup Haveged.
838
839.. code-block:: yaml
840
841 linux:
842 system:
843 haveged:
844 enabled: true
845
Filip Pytlounf5383a42015-10-06 16:28:32 +0200846Linux network
847-------------
848
849Linux with network manager
850
851.. code-block:: yaml
852
853 linux:
854 network:
855 enabled: true
856 network_manager: true
857
858Linux with default static network interfaces, default gateway interface and DNS servers
859
860.. code-block:: yaml
861
862 linux:
863 network:
864 enabled: true
865 interface:
866 eth0:
867 enabled: true
868 type: eth
869 address: 192.168.0.102
870 netmask: 255.255.255.0
871 gateway: 192.168.0.1
872 name_servers:
873 - 8.8.8.8
874 - 8.8.4.4
875 mtu: 1500
876
jan kaufman6d30adf2016-01-18 17:30:12 +0100877Linux with bonded interfaces and disabled NetworkManager
Filip Pytlounf5383a42015-10-06 16:28:32 +0200878
879.. code-block:: yaml
880
881 linux:
882 network:
883 enabled: true
884 interface:
885 eth0:
886 type: eth
887 ...
888 eth1:
889 type: eth
890 ...
891 bond0:
892 enabled: true
893 type: bond
894 address: 192.168.0.102
895 netmask: 255.255.255.0
896 mtu: 1500
897 use_in:
898 - interface: ${linux:interface:eth0}
899 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +0100900 network_manager:
901 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +0200902
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100903Linux with vlan interface_params
904
905.. code-block:: yaml
906
907 linux:
908 network:
909 enabled: true
910 interface:
911 vlan69:
912 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +0100913 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100914 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100915
Filip Pytlounf5383a42015-10-06 16:28:32 +0200916Linux with wireless interface parameters
917
918.. code-block:: yaml
919
920 linux:
921 network:
922 enabled: true
923 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100924 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +0200925 interface:
926 wlan0:
927 type: eth
928 wireless:
929 essid: example
930 key: example_key
931 security: wpa
932 priority: 1
933
934Linux networks with routes defined
935
936.. code-block:: yaml
937
938 linux:
939 network:
940 enabled: true
941 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100942 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +0200943 interface:
944 eth0:
945 type: eth
946 route:
947 default:
948 address: 192.168.0.123
949 netmask: 255.255.255.0
950 gateway: 192.168.0.1
951
952Native Linux Bridges
953
954.. code-block:: yaml
955
956 linux:
957 network:
958 interface:
959 eth1:
960 enabled: true
961 type: eth
962 proto: manual
963 up_cmds:
964 - ip address add 0/0 dev $IFACE
965 - ip link set $IFACE up
966 down_cmds:
967 - ip link set $IFACE down
968 br-ex:
969 enabled: true
970 type: bridge
971 address: ${linux:network:host:public_local:address}
972 netmask: 255.255.255.0
973 use_interfaces:
974 - eth1
975
976OpenVswitch Bridges
977
978.. code-block:: yaml
979
980 linux:
981 network:
982 bridge: openvswitch
983 interface:
984 eth1:
985 enabled: true
986 type: eth
987 proto: manual
988 up_cmds:
989 - ip address add 0/0 dev $IFACE
990 - ip link set $IFACE up
991 down_cmds:
992 - ip link set $IFACE down
993 br-ex:
994 enabled: true
995 type: bridge
996 address: ${linux:network:host:public_local:address}
997 netmask: 255.255.255.0
998 use_interfaces:
999 - eth1
Dmitry Stremkouskia581ea72017-10-18 14:24:16 +03001000 br-prv:
1001 enabled: true
1002 type: ovs_bridge
1003 mtu: 65000
1004 br-ens7:
1005 enabled: true
1006 name: br-ens7
1007 type: ovs_bridge
1008 proto: manual
1009 mtu: 9000
1010 use_interfaces:
1011 - ens7
1012 patch-br-ens7-br-prv:
1013 enabled: true
1014 name: ens7-prv
1015 ovs_type: ovs_port
1016 type: ovs_port
1017 bridge: br-ens7
1018 port_type: patch
1019 peer: prv-ens7
1020 mtu: 65000
1021 patch-br-prv-br-ens7:
1022 enabled: true
1023 name: prv-ens7
1024 bridge: br-prv
1025 ovs_type: ovs_port
1026 type: ovs_port
1027 port_type: patch
1028 peer: ens7-prv
1029 mtu: 65000
1030 ens7:
1031 enabled: true
1032 name: ens7
1033 proto: manual
1034 ovs_port_type: OVSPort
1035 type: ovs_port
1036 ovs_bridge: br-ens7
1037 bridge: br-ens7
Filip Pytlounf5383a42015-10-06 16:28:32 +02001038
Petr Jediný8f8ae542017-07-13 16:19:12 +02001039Debian manual proto interfaces
1040
1041When you are changing interface proto from static in up state to manual, you
1042may need to flush ip addresses. For example, if you want to use the interface
1043and the ip on the bridge. This can be done by setting the ``ipflush_onchange``
1044to true.
1045
1046.. code-block:: yaml
1047
1048 linux:
1049 network:
1050 interface:
1051 eth1:
1052 enabled: true
1053 type: eth
1054 proto: manual
1055 mtu: 9100
1056 ipflush_onchange: true
1057
Jiri Broulik1a191e32018-01-15 15:54:21 +01001058Debian static proto interfaces
1059
1060When you are changing interface proto from dhcp in up state to static, you
1061may need to flush ip addresses and restart interface to assign ip address from a managed file.
1062For example, if you want to use the interface and the ip on the bridge.
1063This can be done by setting the ``ipflush_onchange`` with combination
1064``restart_on_ipflush`` param set to to true.
1065
1066.. code-block:: yaml
1067
1068 linux:
1069 network:
1070 interface:
1071 eth1:
1072 enabled: true
1073 type: eth
1074 proto: static
1075 address: 10.1.0.22
1076 netmask: 255.255.255.0
1077 ipflush_onchange: true
1078 restart_on_ipflush: true
Petr Jediný8f8ae542017-07-13 16:19:12 +02001079
Petr Jedinýd577cb52017-06-28 20:17:49 +02001080Concatinating and removing interface files
1081
1082Debian based distributions have `/etc/network/interfaces.d/` directory, where
1083you can store configuration of network interfaces in separate files. You can
1084concatinate the files to the defined destination when needed, this operation
1085removes the file from the `/etc/network/interfaces.d/`. If you just need to
1086remove iface files, you can use the `remove_iface_files` key.
1087
1088.. code-block:: yaml
1089
1090 linux:
1091 network:
1092 concat_iface_files:
1093 - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
1094 dst: '/etc/network/interfaces'
1095 remove_iface_files:
1096 - '/etc/network/interfaces.d/90-custom.cfg'
1097
1098
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001099DHCP client configuration
1100
1101None of the keys is mandatory, include only those you really need. For full list
1102of available options under send, supersede, prepend, append refer to dhcp-options(5)
1103
1104.. code-block:: yaml
1105
1106 linux:
1107 network:
1108 dhclient:
1109 enabled: true
1110 backoff_cutoff: 15
1111 initial_interval: 10
1112 reboot: 10
1113 retry: 60
1114 select_timeout: 0
1115 timeout: 120
1116 send:
1117 - option: host-name
1118 declaration: "= gethostname()"
1119 supersede:
1120 - option: host-name
1121 declaration: "spaceship"
1122 - option: domain-name
1123 declaration: "domain.home"
1124 #- option: arp-cache-timeout
1125 # declaration: 20
1126 prepend:
1127 - option: domain-name-servers
1128 declaration:
1129 - 8.8.8.8
1130 - 8.8.4.4
1131 - option: domain-search
1132 declaration:
1133 - example.com
1134 - eng.example.com
1135 #append:
1136 #- option: domain-name-servers
1137 # declaration: 127.0.0.1
1138 # ip or subnet to reject dhcp offer from
1139 reject:
1140 - 192.33.137.209
1141 - 10.0.2.0/24
1142 request:
1143 - subnet-mask
1144 - broadcast-address
1145 - time-offset
1146 - routers
1147 - domain-name
1148 - domain-name-servers
1149 - domain-search
1150 - host-name
1151 - dhcp6.name-servers
1152 - dhcp6.domain-search
1153 - dhcp6.fqdn
1154 - dhcp6.sntp-servers
1155 - netbios-name-servers
1156 - netbios-scope
1157 - interface-mtu
1158 - rfc3442-classless-static-routes
1159 - ntp-servers
1160 require:
1161 - subnet-mask
1162 - domain-name-servers
1163 # if per interface configuration required add below
1164 interface:
1165 ens2:
1166 initial_interval: 11
1167 reject:
1168 - 192.33.137.210
1169 ens3:
1170 initial_interval: 12
1171 reject:
1172 - 192.33.137.211
1173
Petr Michaleceb14b552017-06-01 10:27:05 +02001174Linux network systemd settings:
1175
1176.. code-block:: yaml
1177
1178 linux:
1179 network:
1180 ...
1181 systemd:
1182 link:
1183 10-iface-dmz:
1184 Match:
1185 MACAddress: c8:5b:67:fa:1a:af
1186 OriginalName: eth0
1187 Link:
1188 Name: dmz0
1189 netdev:
1190 20-bridge-dmz:
1191 match:
1192 name: dmz0
1193 network:
1194 mescription: bridge
1195 bridge: br-dmz0
1196 network:
1197 # works with lowercase, keys are by default capitalized
1198 40-dhcp:
1199 match:
1200 name: '*'
1201 network:
1202 DHCP: yes
1203
Oleksandr Vlasov27a6c3a2017-04-11 16:01:19 -06001204
Petr Michalec10462bb2017-03-23 19:18:08 +01001205Configure global environment variables
Petr Michalec10462bb2017-03-23 19:18:08 +01001206
Ales Komarek417e8c52017-08-25 15:10:29 +02001207Use ``/etc/environment`` for static system wide variable assignment after
1208boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001209
1210.. code-block:: yaml
1211
1212 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +01001213 system:
1214 env:
1215 BOB_VARIABLE: Alice
1216 ...
1217 BOB_PATH:
1218 - /srv/alice/bin
1219 - /srv/bob/bin
1220 ...
1221 ftp_proxy: none
1222 http_proxy: http://global-http-proxy.host.local:8080
1223 https_proxy: ${linux:system:proxy:https}
1224 no_proxy:
1225 - 192.168.0.80
1226 - 192.168.1.80
1227 - .domain.com
1228 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +02001229 ...
Petr Michalec10462bb2017-03-23 19:18:08 +01001230 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +02001231 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +01001232 ftp: ftp://proxy.host.local:2121
1233 http: http://proxy.host.local:3142
1234 https: https://proxy.host.local:3143
1235 noproxy:
1236 - .domain.com
1237 - .local
1238
1239Configure profile.d scripts
Petr Michalec10462bb2017-03-23 19:18:08 +01001240
Ales Komarek417e8c52017-08-25 15:10:29 +02001241The profile.d scripts are being sourced during .sh execution and support
1242variable expansion in opposite to /etc/environment global settings in
1243``/etc/environment``.
Petr Michalec10462bb2017-03-23 19:18:08 +01001244
1245.. code-block:: yaml
1246
1247 linux:
1248 system:
1249 profile:
1250 locales: |
1251 export LANG=C
1252 export LC_ALL=C
1253 ...
1254 vi_flavors.sh: |
1255 export PAGER=view
1256 export EDITOR=vim
1257 alias vi=vim
1258 shell_locales.sh: |
1259 export LANG=en_US
1260 export LC_ALL=en_US.UTF-8
1261 shell_proxies.sh: |
1262 export FTP_PROXY=ftp://127.0.3.3:2121
1263 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +02001264
1265Linux with hosts
1266
Filip Pytloun86506fe2017-01-26 14:36:16 +01001267Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
1268that are not defined in model except defaults for both IPv4 and IPv6 localhost
1269and hostname + fqdn.
Ales Komarek417e8c52017-08-25 15:10:29 +02001270
Filip Pytloun86506fe2017-01-26 14:36:16 +01001271It's good to use this option if you want to ensure /etc/hosts is always in a
1272clean state however it's not enabled by default for safety.
1273
Filip Pytlounf5383a42015-10-06 16:28:32 +02001274.. code-block:: yaml
1275
1276 linux:
1277 network:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001278 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001279 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +01001280 # No need to define this one if purge_hosts is true
1281 hostname:
1282 address: 127.0.1.1
1283 names:
1284 - ${linux:network:fqdn}
1285 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +02001286 node1:
1287 address: 192.168.10.200
1288 names:
1289 - node2.domain.com
1290 - service2.domain.com
1291 node2:
1292 address: 192.168.10.201
1293 names:
1294 - node2.domain.com
1295 - service2.domain.com
1296
Ales Komarek417e8c52017-08-25 15:10:29 +02001297Linux with hosts collected from mine
1298
1299In this case all dns records defined within infrastrucuture will be passed to
1300local hosts records or any DNS server. Only hosts with `grain` parameter to
1301true will be propagated to the mine.
1302
1303.. code-block:: yaml
1304
1305 linux:
1306 network:
1307 purge_hosts: true
1308 mine_dns_records: true
1309 host:
1310 node1:
1311 address: 192.168.10.200
1312 grain: true
1313 names:
1314 - node2.domain.com
1315 - service2.domain.com
Filip Pytloun86506fe2017-01-26 14:36:16 +01001316
Filip Pytlounde9bea52016-01-11 15:39:10 +01001317Setup resolv.conf, nameservers, domain and search domains
1318
1319.. code-block:: yaml
1320
1321 linux:
1322 network:
1323 resolv:
1324 dns:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001325 - 8.8.4.4
1326 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +01001327 domain: my.example.com
1328 search:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001329 - my.example.com
1330 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +01001331 options:
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001332 - ndots: 5
1333 - timeout: 2
1334 - attempts: 2
Filip Pytlounde9bea52016-01-11 15:39:10 +01001335
Ales Komarek417e8c52017-08-25 15:10:29 +02001336setting custom TX queue length for tap interfaces
Andrii Petrenko735761d2017-03-21 17:17:35 -07001337
1338.. code-block:: yaml
1339
1340 linux:
1341 network:
1342 tap_custom_txqueuelen: 10000
1343
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001344DPDK OVS interfaces
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001345
1346**DPDK OVS NIC**
1347
1348.. code-block:: yaml
1349
1350 linux:
1351 network:
1352 bridge: openvswitch
1353 dpdk:
1354 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001355 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001356 openvswitch:
1357 pmd_cpu_mask: "0x6"
1358 dpdk_socket_mem: "1024,1024"
1359 dpdk_lcore_mask: "0x400"
1360 memory_channels: 2
1361 interface:
1362 dpkd0:
1363 name: ${_param:dpdk_nic}
1364 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001365 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001366 enabled: true
1367 type: dpdk_ovs_port
1368 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001369 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001370 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +01001371 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001372 br-prv:
1373 enabled: true
1374 type: dpdk_ovs_bridge
1375
1376**DPDK OVS Bond**
1377
1378.. code-block:: yaml
1379
1380 linux:
1381 network:
1382 bridge: openvswitch
1383 dpdk:
1384 enabled: true
Oleg Bondarev9a466792017-05-25 15:55:42 +04001385 driver: uio/vfio
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001386 openvswitch:
1387 pmd_cpu_mask: "0x6"
1388 dpdk_socket_mem: "1024,1024"
1389 dpdk_lcore_mask: "0x400"
1390 memory_channels: 2
1391 interface:
1392 dpdk_second_nic:
1393 name: ${_param:primary_second_nic}
1394 pci: 0000:06:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001395 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001396 bond: dpdkbond0
1397 enabled: true
1398 type: dpdk_ovs_port
1399 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001400 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001401 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001402 dpdk_first_nic:
1403 name: ${_param:primary_first_nic}
1404 pci: 0000:05:00.0
Oleg Bondarev9a466792017-05-25 15:55:42 +04001405 driver: igb_uio/vfio-pci
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001406 bond: dpdkbond0
1407 enabled: true
1408 type: dpdk_ovs_port
1409 n_rxq: 2
Oleg Bondarev43dbbd32017-05-24 17:06:19 +04001410 pmd_rxq_affinity: "0:1,1:2"
Jakub Pavlikaa759062017-03-13 15:57:26 +01001411 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001412 dpdkbond0:
1413 enabled: true
1414 bridge: br-prv
1415 type: dpdk_ovs_bond
1416 mode: active-backup
1417 br-prv:
1418 enabled: true
1419 type: dpdk_ovs_bridge
1420
Jakub Pavlikaa759062017-03-13 15:57:26 +01001421**DPDK OVS bridge for VXLAN**
1422
1423If VXLAN is used as tenant segmentation then ip address must be set on br-prv
1424
1425.. code-block:: yaml
1426
1427 linux:
1428 network:
1429 ...
1430 interface:
1431 br-prv:
1432 enabled: true
1433 type: dpdk_ovs_bridge
1434 address: 192.168.50.0
1435 netmask: 255.255.255.0
Michael Polenchukd173d552018-01-22 15:22:47 +04001436 tag: 101
Jakub Pavlikaa759062017-03-13 15:57:26 +01001437 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001438
1439Linux storage
1440-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +02001441
1442Linux with mounted Samba
1443
1444.. code-block:: yaml
1445
1446 linux:
1447 storage:
1448 enabled: true
1449 mount:
1450 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01001451 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001452 - path: /media/myuser/public/
1453 - device: //192.168.0.1/storage
1454 - file_system: cifs
1455 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
1456
Jiri Broulikb017f932017-03-31 13:55:36 +02001457NFS mount
1458
1459.. code-block:: yaml
1460
1461 linux:
1462 storage:
1463 enabled: true
1464 mount:
1465 nfs_glance:
1466 enabled: true
1467 path: /var/lib/glance/images
1468 device: 172.16.10.110:/var/nfs/glance
1469 file_system: nfs
1470 opts: rw,sync
1471
1472
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001473File swap configuration
Filip Pytlounf5383a42015-10-06 16:28:32 +02001474
1475.. code-block:: yaml
1476
1477 linux:
1478 storage:
1479 enabled: true
1480 swap:
1481 file:
1482 enabled: true
1483 engine: file
1484 device: /swapfile
1485 size: 1024
1486
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001487Partition swap configuration
Lachlan Evenson30676512016-01-22 15:43:28 -08001488
1489.. code-block:: yaml
1490
1491 linux:
1492 storage:
1493 enabled: true
1494 swap:
1495 partition:
1496 enabled: true
1497 engine: partition
1498 device: /dev/vg0/swap
1499
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001500LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
1501
1502.. code-block:: yaml
1503
1504 parameters:
1505 linux:
1506 storage:
1507 mount:
1508 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01001509 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001510 device: /dev/vg1/data
1511 file_system: ext4
1512 path: /mnt/data
1513 lvm:
1514 vg1:
1515 enabled: true
1516 devices:
1517 - /dev/sdb
1518 volume:
1519 data:
1520 size: 40G
1521 mount: ${linux:storage:mount:data}
1522
Jakub Pavlik4f742142017-08-08 15:05:50 +02001523Create partitions on disk. Specify size in MB. It expects empty
Piotr Krukd51911b2017-12-04 11:27:08 +01001524disk without any existing partitions. (set startsector=1, if you want to start partitions from 2048)
Jakub Pavlik4f742142017-08-08 15:05:50 +02001525
1526.. code-block:: yaml
1527
1528 linux:
1529 storage:
1530 disk:
1531 first_drive:
Piotr Krukd51911b2017-12-04 11:27:08 +01001532 startsector: 1
Jakub Pavlik4f742142017-08-08 15:05:50 +02001533 name: /dev/loop1
1534 type: gpt
1535 partitions:
1536 - size: 200 #size in MB
1537 type: fat32
1538 - size: 300 #size in MB
Jakub Pavlik8e2140a2017-08-14 23:29:57 +02001539 mkfs: True
1540 type: xfs
Jakub Pavlik4f742142017-08-08 15:05:50 +02001541 /dev/vda1:
1542 partitions:
1543 - size: 5
1544 type: ext2
1545 - size: 10
1546 type: ext4
Ales Komareka634f4b2016-10-02 13:11:04 +02001547
1548Multipath with Fujitsu Eternus DXL
1549
1550.. code-block:: yaml
1551
1552 parameters:
1553 linux:
1554 storage:
1555 multipath:
1556 enabled: true
1557 blacklist_devices:
1558 - /dev/sda
1559 - /dev/sdb
1560 backends:
1561 - fujitsu_eternus_dxl
1562
1563Multipath with Hitachi VSP 1000
1564
1565.. code-block:: yaml
1566
1567 parameters:
1568 linux:
1569 storage:
1570 multipath:
1571 enabled: true
1572 blacklist_devices:
1573 - /dev/sda
1574 - /dev/sdb
1575 backends:
1576 - hitachi_vsp1000
1577
1578Multipath with IBM Storwize
1579
1580.. code-block:: yaml
1581
1582 parameters:
1583 linux:
1584 storage:
1585 multipath:
1586 enabled: true
1587 blacklist_devices:
1588 - /dev/sda
1589 - /dev/sdb
1590 backends:
1591 - ibm_storwize
1592
1593Multipath with multiple backends
1594
1595.. code-block:: yaml
1596
1597 parameters:
1598 linux:
1599 storage:
1600 multipath:
1601 enabled: true
1602 blacklist_devices:
1603 - /dev/sda
1604 - /dev/sdb
1605 - /dev/sdc
1606 - /dev/sdd
1607 backends:
1608 - ibm_storwize
1609 - fujitsu_eternus_dxl
1610 - hitachi_vsp1000
1611
Dmitry Stremkouski7d8d67a2017-11-15 13:08:19 +03001612PAM LDAP integration
1613
1614.. code-block:: yaml
1615
1616 parameters:
1617 linux:
1618 system:
1619 auth:
1620 enabled: true
1621 ldap:
1622 enabled: true
1623 binddn: cn=bind,ou=service_users,dc=example,dc=com
1624 bindpw: secret
1625 uri: ldap://127.0.0.1
1626 base: ou=users,dc=example,dc=com
1627 ldap_version: 3
1628 pagesize: 65536
1629 referrals: off
1630 filter:
1631 passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1632 shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
1633 group: (&(objectClass=group)(gidNumber=*))
1634
Ales Komareka634f4b2016-10-02 13:11:04 +02001635Disabled multipath (the default setup)
1636
1637.. code-block:: yaml
1638
1639 parameters:
1640 linux:
1641 storage:
1642 multipath:
1643 enabled: false
1644
Simon Pasquier375001e2017-01-26 13:22:33 +01001645Linux with local loopback device
1646
1647.. code-block:: yaml
1648
1649 linux:
1650 storage:
1651 loopback:
1652 disk1:
1653 file: /srv/disk1
1654 size: 50G
1655
Filip Pytlounb2c8f852016-11-21 17:03:43 +01001656External config generation
1657--------------------------
1658
1659You are able to use config support metadata between formulas and only generate
1660config files for external use, eg. docker, etc.
1661
1662.. code-block:: yaml
1663
1664 parameters:
1665 linux:
1666 system:
1667 config:
1668 pillar:
1669 jenkins:
1670 master:
1671 home: /srv/volumes/jenkins
1672 approved_scripts:
1673 - method java.net.URL openConnection
1674 credentials:
1675 - type: username_password
1676 scope: global
1677 id: test
1678 desc: Testing credentials
1679 username: test
1680 password: test
1681
Vladimir Ereminccf28842017-04-10 23:52:10 +03001682Netconsole Remote Kernel Logging
1683--------------------------------
1684
1685Netconsole logger could be configured for configfs-enabled kernels
1686(`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in
1687runtime (if network is already configured), and on-boot after interface
1688initialization. Notes:
1689
1690 * receiver could be located only in same L3 domain
1691 (or you need to configure gateway MAC manually)
1692 * receiver's MAC is detected only on configuration time
1693 * using broadcast MAC is not recommended
1694
1695.. code-block:: yaml
1696
1697 parameters:
1698 linux:
1699 system:
1700 netconsole:
1701 enabled: true
1702 port: 514 (optional)
1703 loglevel: debug (optional)
1704 target:
1705 192.168.0.1:
1706 interface: bond0
1707 mac: "ff:ff:ff:ff:ff:ff" (optional)
Ales Komareka634f4b2016-10-02 13:11:04 +02001708
Filip Pytlounf5383a42015-10-06 16:28:32 +02001709Usage
1710=====
1711
1712Set mtu of network interface eth0 to 1400
1713
1714.. code-block:: bash
1715
1716 ip link set dev eth0 mtu 1400
1717
1718Read more
1719=========
1720
1721* https://www.archlinux.org/
1722* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
Filip Pytloun018f8712017-02-02 13:02:03 +01001723
1724Documentation and Bugs
1725======================
1726
1727To learn how to install and update salt-formulas, consult the documentation
1728available online at:
1729
1730 http://salt-formulas.readthedocs.io/
1731
1732In the unfortunate event that bugs are discovered, they should be reported to
1733the appropriate issue tracker. Use Github issue tracker for specific salt
1734formula:
1735
1736 https://github.com/salt-formulas/salt-formula-linux/issues
1737
1738For feature requests, bug reports or blueprints affecting entire ecosystem,
1739use Launchpad salt-formulas project:
1740
1741 https://launchpad.net/salt-formulas
1742
1743You can also join salt-formulas-users team and subscribe to mailing list:
1744
1745 https://launchpad.net/~salt-formulas-users
1746
1747Developers wishing to work on the salt-formulas projects should always base
1748their work on master branch and submit pull request against specific formula.
1749
1750 https://github.com/salt-formulas/salt-formula-linux
1751
1752Any questions or feedback is always welcome so feel free to join our IRC
1753channel:
1754
1755 #salt-formulas @ irc.freenode.net