blob: 84ba3e99ebc2666408454527cffb1a6a50978175 [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
Petr Michalec1c4c8d82017-02-28 19:09:21 +010034Linux with system users, some with password set
Filip Pytlounf5383a42015-10-06 16:28:32 +020035
36.. code-block:: yaml
37
38 linux:
39 system:
40 ...
41 user:
42 jdoe:
43 name: 'jdoe'
44 enabled: true
45 sudo: true
46 shell: /bin/bash
47 full_name: 'Jonh Doe'
48 home: '/home/jdoe'
49 email: 'jonh@doe.com'
50 jsmith:
51 name: 'jsmith'
52 enabled: true
53 full_name: 'Password'
54 home: '/home/jsmith'
55 password: userpassword
56
Petr Michalec1c4c8d82017-02-28 19:09:21 +010057Configure sudo for users and groups under ``/etc/sudoers.d/``.
58This ways ``linux.system.sudo`` pillar map to actual sudo attributes:
59
60.. code-block:: jinja
Aleš Komárek63572992017-04-11 13:16:44 +020061
Petr Michalec1c4c8d82017-02-28 19:09:21 +010062 # simplified template:
63 Cmds_Alias {{ alias }}={{ commands }}
64 {{ user }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
65 %{{ group }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
66
67 # when rendered:
68 saltuser1 ALL=(ALL) NOPASSWD: ALL
69
Petr Michalec1c4c8d82017-02-28 19:09:21 +010070.. code-block:: yaml
Aleš Komárek63572992017-04-11 13:16:44 +020071
Petr Michalec1c4c8d82017-02-28 19:09:21 +010072 linux:
73 system:
74 sudo:
75 enabled: true
76 alias:
77 host:
78 LOCAL:
79 - localhost
80 PRODUCTION:
81 - db1
82 - db2
83 runas:
84 DBA:
85 - postgres
86 - mysql
87 SALT:
88 - root
89 command:
90 # Note: This is not 100% safe when ALL keyword is used, user still may modify configs and hide his actions.
91 # Best practice is to specify full list of commands user is allowed to run.
92 SUPPORT_RESTRICTED:
93 - /bin/vi /etc/sudoers*
94 - /bin/vim /etc/sudoers*
95 - /bin/nano /etc/sudoers*
96 - /bin/emacs /etc/sudoers*
97 - /bin/su - root
98 - /bin/su -
99 - /bin/su
100 - /usr/sbin/visudo
101 SUPPORT_SHELLS:
102 - /bin/sh
103 - /bin/ksh
104 - /bin/bash
105 - /bin/rbash
106 - /bin/dash
107 - /bin/zsh
108 - /bin/csh
109 - /bin/fish
110 - /bin/tcsh
111 - /usr/bin/login
112 - /usr/bin/su
113 - /usr/su
114 ALL_SALT_SAFE:
115 - /usr/bin/salt state*
116 - /usr/bin/salt service*
117 - /usr/bin/salt pillar*
118 - /usr/bin/salt grains*
119 - /usr/bin/salt saltutil*
120 - /usr/bin/salt-call state*
121 - /usr/bin/salt-call service*
122 - /usr/bin/salt-call pillar*
123 - /usr/bin/salt-call grains*
124 - /usr/bin/salt-call saltutil*
125 SALT_TRUSTED:
126 - /usr/bin/salt*
127 users:
128 # saltuser1 with default values: saltuser1 ALL=(ALL) NOPASSWD: ALL
129 saltuser1: {}
130 saltuser2:
131 hosts:
132 - LOCAL
133 # User Alias DBA
134 DBA:
135 hosts:
136 - ALL
137 commands:
138 - ALL_SALT_SAFE
139 groups:
140 db-ops:
141 hosts:
142 - ALL
143 - '!PRODUCTION'
144 runas:
145 - DBA
146 commands:
147 - /bin/cat *
148 - /bin/less *
149 - /bin/ls *
150 salt-ops:
151 hosts:
152 - 'ALL'
153 runas:
154 - SALT
155 commands:
156 - SUPPORT_SHELLS
157 salt-ops-2nd:
158 name: salt-ops
159 nopasswd: false
160 runas:
161 - DBA
162 commands:
163 - ALL
164 - '!SUPPORT_SHELLS'
165 - '!SUPPORT_RESTRICTED'
166
Filip Pytlounf5383a42015-10-06 16:28:32 +0200167Linux with package, latest version
168
169.. code-block:: yaml
170
171 linux:
172 system:
173 ...
174 package:
175 package-name:
176 version: latest
177
178Linux with package from certail repo, version with no upgrades
179
180.. code-block:: yaml
181
182 linux:
183 system:
184 ...
185 package:
186 package-name:
187 version: 2132.323
188 repo: 'custom-repo'
189 hold: true
190
191Linux with package from certail repo, version with no GPG verification
192
193.. code-block:: yaml
194
195 linux:
196 system:
197 ...
198 package:
199 package-name:
200 version: 2132.323
201 repo: 'custom-repo'
202 verify: false
203
Bruno Binet69a9d8d2017-02-16 22:34:32 +0100204Linux with autoupdates (automatically install security package updates)
205
206.. code-block:: yaml
207
208 linux:
209 system:
210 ...
211 autoupdates:
212 enabled: true
213 mail: root@localhost
214 mail_only_on_error: true
215 remove_unused_dependencies: false
216 automatic_reboot: true
217 automatic_reboot_time: "02:00"
218
Filip Pytlounf5383a42015-10-06 16:28:32 +0200219Linux with cron jobs
220
221.. code-block:: yaml
222
223 linux:
224 system:
225 ...
226 job:
227 cmd1:
228 command: '/cmd/to/run'
229 enabled: true
230 user: 'root'
231 hour: 2
232 minute: 0
233
Filip Pytlound0a29e72015-11-30 15:23:34 +0100234Linux security limits (limit sensu user memory usage to max 1GB):
235
236.. code-block:: yaml
237
238 linux:
239 system:
240 ...
241 limit:
242 sensu:
243 enabled: true
244 domain: sensu
245 limits:
246 - type: hard
247 item: as
248 value: 1000000
249
Filip Pytloun7fee0542015-10-15 11:19:24 +0200250Enable autologin on tty1 (may work only for Ubuntu 14.04):
251
252.. code-block:: yaml
253
254 linux:
255 system:
256 console:
257 tty1:
258 autologin: root
Filip Pytloun281d0202016-01-29 14:03:51 +0100259 # Enable serial console
260 ttyS0:
261 autologin: root
262 rate: 115200
263 term: xterm
Filip Pytloun7fee0542015-10-15 11:19:24 +0200264
265To disable set autologin to `false`.
266
Filip Pytloun7731b852016-02-01 11:13:47 +0100267Set ``policy-rc.d`` on Debian-based systems. Action can be any available
268command in ``while true`` loop and ``case`` context.
269Following will disallow dpkg to stop/start services for cassandra package automatically:
270
271.. code-block:: yaml
272
273 linux:
274 system:
275 policyrcd:
276 - package: cassandra
277 action: exit 101
278 - package: '*'
279 action: switch
280
Filip Pytlounc49445a2016-04-04 14:23:20 +0200281Set system locales:
282
283.. code-block:: yaml
284
285 linux:
286 system:
287 locale:
288 en_US.UTF-8:
289 default: true
Filip Pytlounee1745f2016-04-04 17:39:41 +0200290 "cs_CZ.UTF-8 UTF-8":
Filip Pytlounc49445a2016-04-04 14:23:20 +0200291 enabled: true
292
Filip Pytloun281034a2016-01-04 18:06:22 +0100293Kernel
294~~~~~~
295
296Install always up to date LTS kernel and headers from Ubuntu trusty:
297
298.. code-block:: yaml
299
300 linux:
301 system:
302 kernel:
303 type: generic
304 lts: trusty
305 headers: true
306
Tomáš Kukrálba35b212017-02-15 17:59:46 +0100307Load kernel modules and add them to `/etc/modules`:
308
309.. code-block:: yaml
310
311 linux:
312 system:
313 kernel:
314 modules:
315 - nf_conntrack
316 - tp_smapi
317 - 8021q
318
Filip Pytloun281034a2016-01-04 18:06:22 +0100319Install specific kernel version and ensure all other kernel packages are
320not present. Also install extra modules and headers for this kernel:
321
322.. code-block:: yaml
323
324 linux:
325 system:
326 kernel:
327 type: generic
328 extra: true
329 headers: true
330 version: 4.2.0-22
331
Jakub Pavlik32c2cb02016-01-29 12:45:29 +0100332Systcl kernel parameters
333
334.. code-block:: yaml
335
336 linux:
337 system:
338 kernel:
339 sysctl:
340 net.ipv4.tcp_keepalive_intvl: 3
341 net.ipv4.tcp_keepalive_time: 30
342 net.ipv4.tcp_keepalive_probes: 8
343
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100344
345CPU
346~~~
347
348Disable ondemand cpu mode service:
349
350.. code-block:: yaml
351
352 linux:
353 system:
354 cpu:
355 governor: performance
356
Jakub Pavlikb148c8c2017-02-12 21:30:48 +0100357Huge Pages
358~~~~~~~~~~~~
359
360Huge Pages give a performance boost to applications that intensively deal
361with memory allocation/deallocation by decreasing memory fragmentation.
362
363.. code-block:: yaml
364
365 linux:
366 system:
367 kernel:
368 hugepages:
369 small:
370 size: 2M
371 count: 107520
372 mount_point: /mnt/hugepages_2MB
373 mount: false/true # default false
374 large:
375 default: true # default automatically mounted
376 size: 1G
377 count: 210
378 mount_point: /mnt/hugepages_1GB
379
380Note: not recommended to use both pagesizes in concurrently.
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100381
Jakub Pavlik5398d872017-02-13 22:30:47 +0100382Intel SR-IOV
383~~~~~~~~~~~~
384
385PCI-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.
386
387.. code-block:: yaml
388
389 linux:
390 system:
391 kernel:
392 sriov: True
393 unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
394 rc:
395 local: |
396 #!/bin/sh -e
397 # Enable 7 VF on eth1
398 echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
399 exit 0
400
Jakub Pavlik6c9ead12017-02-16 21:53:13 +0100401Isolate CPU options
402~~~~~~~~~~~~~~~~~~~
403
404Remove the specified CPUs, as defined by the cpu_number values, from the general kernel
405SMP balancing and scheduler algroithms. The only way to move a process onto or off an
406"isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the
407maximum value is 1 less than the number of CPUs on the system.
408
409.. code-block:: yaml
410
411 linux:
412 system:
413 kernel:
414 isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Jiri Broulikf8f55a22017-01-26 14:36:46 +0100415
Filip Pytlounf5383a42015-10-06 16:28:32 +0200416Repositories
417~~~~~~~~~~~~
418
419RedHat based Linux with additional OpenStack repo
420
421.. code-block:: yaml
422
423 linux:
424 system:
425 ...
426 repo:
427 rdo-icehouse:
428 enabled: true
429 source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
430 pgpcheck: 0
431
432Ensure system repository to use czech Debian mirror (``default: true``)
433Also pin it's packages with priority 900.
434
435.. code-block:: yaml
436
437 linux:
438 system:
439 repo:
440 debian:
441 default: true
442 source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
443 # Import signing key from URL if needed
444 key_url: "http://dummy.com/public.gpg"
445 pin:
446 - pin: 'origin "ftp.cz.debian.org"'
447 priority: 900
448 package: '*'
449
Petr Michalec10462bb2017-03-23 19:18:08 +0100450
451Package manager proxy setup globally:
452
453.. code-block:: yaml
454
455 linux:
456 system:
457 ...
458 repo:
459 apt-mk:
460 source: "deb http://apt-mk.mirantis.com/ stable main salt"
461 ...
462 proxy:
463 pkg:
464 enabled: true
465 ftp: ftp://ftp-proxy-for-apt.host.local:2121
466 ...
467 # NOTE: Global defaults for any other componet that configure proxy on the system.
468 # If your environment has just one simple proxy, set it on linux:system:proxy.
469 #
470 # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
471 # as for https and http
472 ftp: ftp://proxy.host.local:2121
473 http: http://proxy.host.local:3142
474 https: https://proxy.host.local:3143
475
476Package manager proxy setup per repository:
477
478.. code-block:: yaml
479
480 linux:
481 system:
482 ...
483 repo:
484 debian:
485 source: "deb http://apt-mk.mirantis.com/ stable main salt"
486 ...
487 apt-mk:
488 source: "deb http://apt-mk.mirantis.com/ stable main salt"
489 # per repository proxy
490 proxy:
491 enabled: true
492 http: http://maas-01:8080
493 https: http://maas-01:8080
494 ...
495 proxy:
496 # package manager fallback defaults
497 # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
498 pkg:
499 enabled: true
500 ftp: ftp://proxy.host.local:2121
501 #http: http://proxy.host.local:3142
502 #https: https://proxy.host.local:3143
503 ...
504 # global system fallback system defaults
505 ftp: ftp://proxy.host.local:2121
506 http: http://proxy.host.local:3142
507 https: https://proxy.host.local:3143
508
509
510RC
511~~
512
Jakub Pavlik78859382016-01-21 11:26:39 +0100513rc.local example
514
515.. code-block:: yaml
516
517 linux:
518 system:
519 rc:
520 local: |
521 #!/bin/sh -e
522 #
523 # rc.local
524 #
525 # This script is executed at the end of each multiuser runlevel.
526 # Make sure that the script will "exit 0" on success or any other
527 # value on error.
528 #
529 # In order to enable or disable this script just change the execution
530 # bits.
531 #
532 # By default this script does nothing.
533 exit 0
534
Petr Michalec10462bb2017-03-23 19:18:08 +0100535
Filip Pytloun1f40dac2016-01-22 15:52:57 +0100536Prompt
537~~~~~~
538
539Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every
540user can have different prompt.
541
542.. code-block:: yaml
543
544 linux:
545 system:
546 prompt:
547 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\\]
548 default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
549
550On Debian systems to set prompt system-wide it's necessary to remove setting
551PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from
552``/etc/skel/.bashrc``). This formula will do this automatically, but will not
Filip Pytlound9b68da2016-01-22 15:58:41 +0100553touch existing user's ``~/.bashrc`` files except root.
Jakub Pavlik78859382016-01-21 11:26:39 +0100554
Filip Pytlouneef11c12016-03-25 11:00:23 +0100555Bash
556~~~~
557
558Fix bash configuration to preserve history across sessions (like ZSH does by
559default).
560
561.. code-block:: yaml
562
563 linux:
564 system:
565 bash:
566 preserve_history: true
567
Filip Pytloune874dfb2016-01-22 16:57:34 +0100568Message of the day
569~~~~~~~~~~~~~~~~~~
570
571``pam_motd`` from package ``update-motd`` is used for dynamic messages of the
572day. Setting custom motd will cleanup existing ones.
573
574.. code-block:: yaml
575
576 linux:
577 system:
578 motd:
579 - release: |
580 #!/bin/sh
581 [ -r /etc/lsb-release ] && . /etc/lsb-release
582
583 if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
584 # Fall back to using the very slow lsb_release utility
585 DISTRIB_DESCRIPTION=$(lsb_release -s -d)
586 fi
587
588 printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
589 - warning: |
590 #!/bin/sh
591 printf "This is [company name] network.\n"
592 printf "Unauthorized access strictly prohibited.\n"
593
Filip Pytloun2f70b492016-02-19 15:55:25 +0100594RHEL / CentOS
Filip Pytloun8296bb92016-02-19 18:42:09 +0100595^^^^^^^^^^^^^
Filip Pytloun2f70b492016-02-19 15:55:25 +0100596
597Unfortunately ``update-motd`` is currently not available for RHEL so there's
598no native support for dynamic motd.
599You can still set static one, only pillar structure differs:
600
601.. code-block:: yaml
602
603 linux:
604 system:
605 motd: |
606 This is [company name] network.
607 Unauthorized access strictly prohibited.
608
Filip Pytloun8296bb92016-02-19 18:42:09 +0100609Haveged
610~~~~~~~
611
612If you are running headless server and are low on entropy, it may be a good
613idea to setup Haveged.
614
615.. code-block:: yaml
616
617 linux:
618 system:
619 haveged:
620 enabled: true
621
Filip Pytlounf5383a42015-10-06 16:28:32 +0200622Linux network
623-------------
624
625Linux with network manager
626
627.. code-block:: yaml
628
629 linux:
630 network:
631 enabled: true
632 network_manager: true
633
634Linux with default static network interfaces, default gateway interface and DNS servers
635
636.. code-block:: yaml
637
638 linux:
639 network:
640 enabled: true
641 interface:
642 eth0:
643 enabled: true
644 type: eth
645 address: 192.168.0.102
646 netmask: 255.255.255.0
647 gateway: 192.168.0.1
648 name_servers:
649 - 8.8.8.8
650 - 8.8.4.4
651 mtu: 1500
652
jan kaufman6d30adf2016-01-18 17:30:12 +0100653Linux with bonded interfaces and disabled NetworkManager
Filip Pytlounf5383a42015-10-06 16:28:32 +0200654
655.. code-block:: yaml
656
657 linux:
658 network:
659 enabled: true
660 interface:
661 eth0:
662 type: eth
663 ...
664 eth1:
665 type: eth
666 ...
667 bond0:
668 enabled: true
669 type: bond
670 address: 192.168.0.102
671 netmask: 255.255.255.0
672 mtu: 1500
673 use_in:
674 - interface: ${linux:interface:eth0}
675 - interface: ${linux:interface:eth0}
jan kaufman6d30adf2016-01-18 17:30:12 +0100676 network_manager:
677 disable: true
Filip Pytlounf5383a42015-10-06 16:28:32 +0200678
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100679Linux with vlan interface_params
680
681.. code-block:: yaml
682
683 linux:
684 network:
685 enabled: true
686 interface:
687 vlan69:
688 type: vlan
jan kaufmanc0bd76f2015-12-15 16:45:44 +0100689 use_interfaces:
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100690 - interface: ${linux:interface:bond0}
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100691
Filip Pytlounf5383a42015-10-06 16:28:32 +0200692Linux with wireless interface parameters
693
694.. code-block:: yaml
695
696 linux:
697 network:
698 enabled: true
699 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100700 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +0200701 interface:
702 wlan0:
703 type: eth
704 wireless:
705 essid: example
706 key: example_key
707 security: wpa
708 priority: 1
709
710Linux networks with routes defined
711
712.. code-block:: yaml
713
714 linux:
715 network:
716 enabled: true
717 gateway: 10.0.0.1
Jan Kaufman6a1ad712015-12-11 14:44:19 +0100718 default_interface: eth0
Filip Pytlounf5383a42015-10-06 16:28:32 +0200719 interface:
720 eth0:
721 type: eth
722 route:
723 default:
724 address: 192.168.0.123
725 netmask: 255.255.255.0
726 gateway: 192.168.0.1
727
728Native Linux Bridges
729
730.. code-block:: yaml
731
732 linux:
733 network:
734 interface:
735 eth1:
736 enabled: true
737 type: eth
738 proto: manual
739 up_cmds:
740 - ip address add 0/0 dev $IFACE
741 - ip link set $IFACE up
742 down_cmds:
743 - ip link set $IFACE down
744 br-ex:
745 enabled: true
746 type: bridge
747 address: ${linux:network:host:public_local:address}
748 netmask: 255.255.255.0
749 use_interfaces:
750 - eth1
751
752OpenVswitch Bridges
753
754.. code-block:: yaml
755
756 linux:
757 network:
758 bridge: openvswitch
759 interface:
760 eth1:
761 enabled: true
762 type: eth
763 proto: manual
764 up_cmds:
765 - ip address add 0/0 dev $IFACE
766 - ip link set $IFACE up
767 down_cmds:
768 - ip link set $IFACE down
769 br-ex:
770 enabled: true
771 type: bridge
772 address: ${linux:network:host:public_local:address}
773 netmask: 255.255.255.0
774 use_interfaces:
775 - eth1
776
Petr Michalec10462bb2017-03-23 19:18:08 +0100777Configure global environment variables
778~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
779
780Linux /etc/environment:
781``/etc/environment`` is for static system wide variable assignment after boot. Variable expansion is frequently not supported.
Filip Pytlounf5383a42015-10-06 16:28:32 +0200782
783.. code-block:: yaml
784
785 linux:
Petr Michalec10462bb2017-03-23 19:18:08 +0100786 system:
787 env:
788 BOB_VARIABLE: Alice
789 ...
790 BOB_PATH:
791 - /srv/alice/bin
792 - /srv/bob/bin
793 ...
794 ftp_proxy: none
795 http_proxy: http://global-http-proxy.host.local:8080
796 https_proxy: ${linux:system:proxy:https}
797 no_proxy:
798 - 192.168.0.80
799 - 192.168.1.80
800 - .domain.com
801 - .local
Filip Pytlounf5383a42015-10-06 16:28:32 +0200802 ...
Petr Michalec10462bb2017-03-23 19:18:08 +0100803 # NOTE: global defaults proxy configuration.
Filip Pytlounf5383a42015-10-06 16:28:32 +0200804 proxy:
Petr Michalec10462bb2017-03-23 19:18:08 +0100805 ftp: ftp://proxy.host.local:2121
806 http: http://proxy.host.local:3142
807 https: https://proxy.host.local:3143
808 noproxy:
809 - .domain.com
810 - .local
811
812Configure profile.d scripts
813~~~~~~~~~~~~~~~~~~~~~~~~~~~
814
815Linux /etc/profile.d:
816The profile.d scripts are being sourced during .sh execution and support variable expansion in opposite to /etc/environment
817global settings in ``/etc/environment``.
818
819.. code-block:: yaml
820
821 linux:
822 system:
823 profile:
824 locales: |
825 export LANG=C
826 export LC_ALL=C
827 ...
828 vi_flavors.sh: |
829 export PAGER=view
830 export EDITOR=vim
831 alias vi=vim
832 shell_locales.sh: |
833 export LANG=en_US
834 export LC_ALL=en_US.UTF-8
835 shell_proxies.sh: |
836 export FTP_PROXY=ftp://127.0.3.3:2121
837 export NO_PROXY='.local'
Filip Pytlounf5383a42015-10-06 16:28:32 +0200838
839Linux with hosts
Petr Michalec10462bb2017-03-23 19:18:08 +0100840~~~~~~~~~~~~~~~~
Filip Pytlounf5383a42015-10-06 16:28:32 +0200841
Filip Pytloun86506fe2017-01-26 14:36:16 +0100842Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
843that are not defined in model except defaults for both IPv4 and IPv6 localhost
844and hostname + fqdn.
845It's good to use this option if you want to ensure /etc/hosts is always in a
846clean state however it's not enabled by default for safety.
847
Filip Pytlounf5383a42015-10-06 16:28:32 +0200848.. code-block:: yaml
849
850 linux:
851 network:
852 ...
Filip Pytloun86506fe2017-01-26 14:36:16 +0100853 purge_hosts: true
Filip Pytlounf5383a42015-10-06 16:28:32 +0200854 host:
Filip Pytloun86506fe2017-01-26 14:36:16 +0100855 # No need to define this one if purge_hosts is true
856 hostname:
857 address: 127.0.1.1
858 names:
859 - ${linux:network:fqdn}
860 - ${linux:network:hostname}
Filip Pytlounf5383a42015-10-06 16:28:32 +0200861 node1:
862 address: 192.168.10.200
863 names:
864 - node2.domain.com
865 - service2.domain.com
866 node2:
867 address: 192.168.10.201
868 names:
869 - node2.domain.com
870 - service2.domain.com
871
Filip Pytloun86506fe2017-01-26 14:36:16 +0100872
Filip Pytlounde9bea52016-01-11 15:39:10 +0100873Setup resolv.conf, nameservers, domain and search domains
Petr Michalec10462bb2017-03-23 19:18:08 +0100874~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Filip Pytlounde9bea52016-01-11 15:39:10 +0100875
876.. code-block:: yaml
877
878 linux:
879 network:
880 resolv:
881 dns:
Jakub Pavlik21ca2152017-02-27 22:21:09 +0100882 - 8.8.4.4
883 - 8.8.8.8
Filip Pytlounde9bea52016-01-11 15:39:10 +0100884 domain: my.example.com
885 search:
Jakub Pavlik21ca2152017-02-27 22:21:09 +0100886 - my.example.com
887 - example.com
Marek Celoudf6cd1922016-12-05 13:39:49 +0100888 options:
Jakub Pavlik21ca2152017-02-27 22:21:09 +0100889 - ndots: 5
890 - timeout: 2
891 - attempts: 2
Filip Pytlounde9bea52016-01-11 15:39:10 +0100892
Andrii Petrenko735761d2017-03-21 17:17:35 -0700893**setting custom TX queue length for tap interfaces**
894
895.. code-block:: yaml
896
897 linux:
898 network:
899 tap_custom_txqueuelen: 10000
900
Jakub Pavlik21ca2152017-02-27 22:21:09 +0100901DPDK OVS interfaces
902--------------------
903
904**DPDK OVS NIC**
905
906.. code-block:: yaml
907
908 linux:
909 network:
910 bridge: openvswitch
911 dpdk:
912 enabled: true
913 driver: uio/vfio-pci
914 openvswitch:
915 pmd_cpu_mask: "0x6"
916 dpdk_socket_mem: "1024,1024"
917 dpdk_lcore_mask: "0x400"
918 memory_channels: 2
919 interface:
920 dpkd0:
921 name: ${_param:dpdk_nic}
922 pci: 0000:06:00.0
923 driver: igb_uio/vfio
924 enabled: true
925 type: dpdk_ovs_port
926 n_rxq: 2
927 bridge: br-prv
Jakub Pavlikaa759062017-03-13 15:57:26 +0100928 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +0100929 br-prv:
930 enabled: true
931 type: dpdk_ovs_bridge
932
933**DPDK OVS Bond**
934
935.. code-block:: yaml
936
937 linux:
938 network:
939 bridge: openvswitch
940 dpdk:
941 enabled: true
942 driver: uio/vfio-pci
943 openvswitch:
944 pmd_cpu_mask: "0x6"
945 dpdk_socket_mem: "1024,1024"
946 dpdk_lcore_mask: "0x400"
947 memory_channels: 2
948 interface:
949 dpdk_second_nic:
950 name: ${_param:primary_second_nic}
951 pci: 0000:06:00.0
952 driver: igb_uio/vfio
953 bond: dpdkbond0
954 enabled: true
955 type: dpdk_ovs_port
956 n_rxq: 2
Jakub Pavlikaa759062017-03-13 15:57:26 +0100957 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +0100958 dpdk_first_nic:
959 name: ${_param:primary_first_nic}
960 pci: 0000:05:00.0
961 driver: igb_uio/vfio
962 bond: dpdkbond0
963 enabled: true
964 type: dpdk_ovs_port
965 n_rxq: 2
Jakub Pavlikaa759062017-03-13 15:57:26 +0100966 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +0100967 dpdkbond0:
968 enabled: true
969 bridge: br-prv
970 type: dpdk_ovs_bond
971 mode: active-backup
972 br-prv:
973 enabled: true
974 type: dpdk_ovs_bridge
975
Jakub Pavlikaa759062017-03-13 15:57:26 +0100976**DPDK OVS bridge for VXLAN**
977
978If VXLAN is used as tenant segmentation then ip address must be set on br-prv
979
980.. code-block:: yaml
981
982 linux:
983 network:
984 ...
985 interface:
986 br-prv:
987 enabled: true
988 type: dpdk_ovs_bridge
989 address: 192.168.50.0
990 netmask: 255.255.255.0
991 mtu: 9000
Jakub Pavlik21ca2152017-02-27 22:21:09 +0100992
993Linux storage
994-------------
Filip Pytlounf5383a42015-10-06 16:28:32 +0200995
996Linux with mounted Samba
997
998.. code-block:: yaml
999
1000 linux:
1001 storage:
1002 enabled: true
1003 mount:
1004 samba1:
Simon Pasquier376262a2016-11-16 15:21:51 +01001005 - enabled: true
Filip Pytlounf5383a42015-10-06 16:28:32 +02001006 - path: /media/myuser/public/
1007 - device: //192.168.0.1/storage
1008 - file_system: cifs
1009 - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
1010
Jiri Broulikb017f932017-03-31 13:55:36 +02001011NFS mount
1012
1013.. code-block:: yaml
1014
1015 linux:
1016 storage:
1017 enabled: true
1018 mount:
1019 nfs_glance:
1020 enabled: true
1021 path: /var/lib/glance/images
1022 device: 172.16.10.110:/var/nfs/glance
1023 file_system: nfs
1024 opts: rw,sync
1025
1026
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001027File swap configuration
Filip Pytlounf5383a42015-10-06 16:28:32 +02001028
1029.. code-block:: yaml
1030
1031 linux:
1032 storage:
1033 enabled: true
1034 swap:
1035 file:
1036 enabled: true
1037 engine: file
1038 device: /swapfile
1039 size: 1024
1040
Jakub Pavlik21ca2152017-02-27 22:21:09 +01001041Partition swap configuration
Lachlan Evenson30676512016-01-22 15:43:28 -08001042
1043.. code-block:: yaml
1044
1045 linux:
1046 storage:
1047 enabled: true
1048 swap:
1049 partition:
1050 enabled: true
1051 engine: partition
1052 device: /dev/vg0/swap
1053
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001054LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
1055
1056.. code-block:: yaml
1057
1058 parameters:
1059 linux:
1060 storage:
1061 mount:
1062 data:
Simon Pasquier376262a2016-11-16 15:21:51 +01001063 enabled: true
Filip Pytlounc8a001a2015-12-15 14:09:19 +01001064 device: /dev/vg1/data
1065 file_system: ext4
1066 path: /mnt/data
1067 lvm:
1068 vg1:
1069 enabled: true
1070 devices:
1071 - /dev/sdb
1072 volume:
1073 data:
1074 size: 40G
1075 mount: ${linux:storage:mount:data}
1076
Ales Komareka634f4b2016-10-02 13:11:04 +02001077
1078Multipath with Fujitsu Eternus DXL
1079
1080.. code-block:: yaml
1081
1082 parameters:
1083 linux:
1084 storage:
1085 multipath:
1086 enabled: true
1087 blacklist_devices:
1088 - /dev/sda
1089 - /dev/sdb
1090 backends:
1091 - fujitsu_eternus_dxl
1092
1093Multipath with Hitachi VSP 1000
1094
1095.. code-block:: yaml
1096
1097 parameters:
1098 linux:
1099 storage:
1100 multipath:
1101 enabled: true
1102 blacklist_devices:
1103 - /dev/sda
1104 - /dev/sdb
1105 backends:
1106 - hitachi_vsp1000
1107
1108Multipath with IBM Storwize
1109
1110.. code-block:: yaml
1111
1112 parameters:
1113 linux:
1114 storage:
1115 multipath:
1116 enabled: true
1117 blacklist_devices:
1118 - /dev/sda
1119 - /dev/sdb
1120 backends:
1121 - ibm_storwize
1122
1123Multipath with multiple backends
1124
1125.. code-block:: yaml
1126
1127 parameters:
1128 linux:
1129 storage:
1130 multipath:
1131 enabled: true
1132 blacklist_devices:
1133 - /dev/sda
1134 - /dev/sdb
1135 - /dev/sdc
1136 - /dev/sdd
1137 backends:
1138 - ibm_storwize
1139 - fujitsu_eternus_dxl
1140 - hitachi_vsp1000
1141
1142Disabled multipath (the default setup)
1143
1144.. code-block:: yaml
1145
1146 parameters:
1147 linux:
1148 storage:
1149 multipath:
1150 enabled: false
1151
Simon Pasquier375001e2017-01-26 13:22:33 +01001152Linux with local loopback device
1153
1154.. code-block:: yaml
1155
1156 linux:
1157 storage:
1158 loopback:
1159 disk1:
1160 file: /srv/disk1
1161 size: 50G
1162
Filip Pytlounb2c8f852016-11-21 17:03:43 +01001163External config generation
1164--------------------------
1165
1166You are able to use config support metadata between formulas and only generate
1167config files for external use, eg. docker, etc.
1168
1169.. code-block:: yaml
1170
1171 parameters:
1172 linux:
1173 system:
1174 config:
1175 pillar:
1176 jenkins:
1177 master:
1178 home: /srv/volumes/jenkins
1179 approved_scripts:
1180 - method java.net.URL openConnection
1181 credentials:
1182 - type: username_password
1183 scope: global
1184 id: test
1185 desc: Testing credentials
1186 username: test
1187 password: test
1188
Ales Komareka634f4b2016-10-02 13:11:04 +02001189
Filip Pytlounf5383a42015-10-06 16:28:32 +02001190Usage
1191=====
1192
1193Set mtu of network interface eth0 to 1400
1194
1195.. code-block:: bash
1196
1197 ip link set dev eth0 mtu 1400
1198
1199Read more
1200=========
1201
1202* https://www.archlinux.org/
1203* http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
Filip Pytloun018f8712017-02-02 13:02:03 +01001204
1205Documentation and Bugs
1206======================
1207
1208To learn how to install and update salt-formulas, consult the documentation
1209available online at:
1210
1211 http://salt-formulas.readthedocs.io/
1212
1213In the unfortunate event that bugs are discovered, they should be reported to
1214the appropriate issue tracker. Use Github issue tracker for specific salt
1215formula:
1216
1217 https://github.com/salt-formulas/salt-formula-linux/issues
1218
1219For feature requests, bug reports or blueprints affecting entire ecosystem,
1220use Launchpad salt-formulas project:
1221
1222 https://launchpad.net/salt-formulas
1223
1224You can also join salt-formulas-users team and subscribe to mailing list:
1225
1226 https://launchpad.net/~salt-formulas-users
1227
1228Developers wishing to work on the salt-formulas projects should always base
1229their work on master branch and submit pull request against specific formula.
1230
1231 https://github.com/salt-formulas/salt-formula-linux
1232
1233Any questions or feedback is always welcome so feel free to join our IRC
1234channel:
1235
1236 #salt-formulas @ irc.freenode.net