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