Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1 | |
| 2 | ===== |
| 3 | Linux |
| 4 | ===== |
| 5 | |
| 6 | Linux Operating Systems. |
| 7 | |
| 8 | * Ubuntu |
| 9 | * CentOS |
| 10 | * RedHat |
| 11 | * Fedora |
| 12 | * Arch |
| 13 | |
| 14 | Sample pillars |
| 15 | ============== |
| 16 | |
| 17 | Linux system |
| 18 | ------------ |
| 19 | |
| 20 | Basic 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 | |
| 34 | Linux with system users, sowe with password set |
| 35 | |
| 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 | |
| 57 | Linux with package, latest version |
| 58 | |
| 59 | .. code-block:: yaml |
| 60 | |
| 61 | linux: |
| 62 | system: |
| 63 | ... |
| 64 | package: |
| 65 | package-name: |
| 66 | version: latest |
| 67 | |
| 68 | Linux with package from certail repo, version with no upgrades |
| 69 | |
| 70 | .. code-block:: yaml |
| 71 | |
| 72 | linux: |
| 73 | system: |
| 74 | ... |
| 75 | package: |
| 76 | package-name: |
| 77 | version: 2132.323 |
| 78 | repo: 'custom-repo' |
| 79 | hold: true |
| 80 | |
| 81 | Linux with package from certail repo, version with no GPG verification |
| 82 | |
| 83 | .. code-block:: yaml |
| 84 | |
| 85 | linux: |
| 86 | system: |
| 87 | ... |
| 88 | package: |
| 89 | package-name: |
| 90 | version: 2132.323 |
| 91 | repo: 'custom-repo' |
| 92 | verify: false |
| 93 | |
Bruno Binet | 69a9d8d | 2017-02-16 22:34:32 +0100 | [diff] [blame] | 94 | Linux with autoupdates (automatically install security package updates) |
| 95 | |
| 96 | .. code-block:: yaml |
| 97 | |
| 98 | linux: |
| 99 | system: |
| 100 | ... |
| 101 | autoupdates: |
| 102 | enabled: true |
| 103 | mail: root@localhost |
| 104 | mail_only_on_error: true |
| 105 | remove_unused_dependencies: false |
| 106 | automatic_reboot: true |
| 107 | automatic_reboot_time: "02:00" |
| 108 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 109 | Linux with cron jobs |
| 110 | |
| 111 | .. code-block:: yaml |
| 112 | |
| 113 | linux: |
| 114 | system: |
| 115 | ... |
| 116 | job: |
| 117 | cmd1: |
| 118 | command: '/cmd/to/run' |
| 119 | enabled: true |
| 120 | user: 'root' |
| 121 | hour: 2 |
| 122 | minute: 0 |
| 123 | |
Filip Pytloun | d0a29e7 | 2015-11-30 15:23:34 +0100 | [diff] [blame] | 124 | Linux security limits (limit sensu user memory usage to max 1GB): |
| 125 | |
| 126 | .. code-block:: yaml |
| 127 | |
| 128 | linux: |
| 129 | system: |
| 130 | ... |
| 131 | limit: |
| 132 | sensu: |
| 133 | enabled: true |
| 134 | domain: sensu |
| 135 | limits: |
| 136 | - type: hard |
| 137 | item: as |
| 138 | value: 1000000 |
| 139 | |
Filip Pytloun | 7fee054 | 2015-10-15 11:19:24 +0200 | [diff] [blame] | 140 | Enable autologin on tty1 (may work only for Ubuntu 14.04): |
| 141 | |
| 142 | .. code-block:: yaml |
| 143 | |
| 144 | linux: |
| 145 | system: |
| 146 | console: |
| 147 | tty1: |
| 148 | autologin: root |
Filip Pytloun | 281d020 | 2016-01-29 14:03:51 +0100 | [diff] [blame] | 149 | # Enable serial console |
| 150 | ttyS0: |
| 151 | autologin: root |
| 152 | rate: 115200 |
| 153 | term: xterm |
Filip Pytloun | 7fee054 | 2015-10-15 11:19:24 +0200 | [diff] [blame] | 154 | |
| 155 | To disable set autologin to `false`. |
| 156 | |
Filip Pytloun | 7731b85 | 2016-02-01 11:13:47 +0100 | [diff] [blame] | 157 | Set ``policy-rc.d`` on Debian-based systems. Action can be any available |
| 158 | command in ``while true`` loop and ``case`` context. |
| 159 | Following will disallow dpkg to stop/start services for cassandra package automatically: |
| 160 | |
| 161 | .. code-block:: yaml |
| 162 | |
| 163 | linux: |
| 164 | system: |
| 165 | policyrcd: |
| 166 | - package: cassandra |
| 167 | action: exit 101 |
| 168 | - package: '*' |
| 169 | action: switch |
| 170 | |
Filip Pytloun | c49445a | 2016-04-04 14:23:20 +0200 | [diff] [blame] | 171 | Set system locales: |
| 172 | |
| 173 | .. code-block:: yaml |
| 174 | |
| 175 | linux: |
| 176 | system: |
| 177 | locale: |
| 178 | en_US.UTF-8: |
| 179 | default: true |
Filip Pytloun | ee1745f | 2016-04-04 17:39:41 +0200 | [diff] [blame] | 180 | "cs_CZ.UTF-8 UTF-8": |
Filip Pytloun | c49445a | 2016-04-04 14:23:20 +0200 | [diff] [blame] | 181 | enabled: true |
| 182 | |
Filip Pytloun | 281034a | 2016-01-04 18:06:22 +0100 | [diff] [blame] | 183 | Kernel |
| 184 | ~~~~~~ |
| 185 | |
| 186 | Install always up to date LTS kernel and headers from Ubuntu trusty: |
| 187 | |
| 188 | .. code-block:: yaml |
| 189 | |
| 190 | linux: |
| 191 | system: |
| 192 | kernel: |
| 193 | type: generic |
| 194 | lts: trusty |
| 195 | headers: true |
| 196 | |
Tomáš Kukrál | ba35b21 | 2017-02-15 17:59:46 +0100 | [diff] [blame] | 197 | Load kernel modules and add them to `/etc/modules`: |
| 198 | |
| 199 | .. code-block:: yaml |
| 200 | |
| 201 | linux: |
| 202 | system: |
| 203 | kernel: |
| 204 | modules: |
| 205 | - nf_conntrack |
| 206 | - tp_smapi |
| 207 | - 8021q |
| 208 | |
Filip Pytloun | 281034a | 2016-01-04 18:06:22 +0100 | [diff] [blame] | 209 | Install specific kernel version and ensure all other kernel packages are |
| 210 | not present. Also install extra modules and headers for this kernel: |
| 211 | |
| 212 | .. code-block:: yaml |
| 213 | |
| 214 | linux: |
| 215 | system: |
| 216 | kernel: |
| 217 | type: generic |
| 218 | extra: true |
| 219 | headers: true |
| 220 | version: 4.2.0-22 |
| 221 | |
Jakub Pavlik | 32c2cb0 | 2016-01-29 12:45:29 +0100 | [diff] [blame] | 222 | Systcl kernel parameters |
| 223 | |
| 224 | .. code-block:: yaml |
| 225 | |
| 226 | linux: |
| 227 | system: |
| 228 | kernel: |
| 229 | sysctl: |
| 230 | net.ipv4.tcp_keepalive_intvl: 3 |
| 231 | net.ipv4.tcp_keepalive_time: 30 |
| 232 | net.ipv4.tcp_keepalive_probes: 8 |
| 233 | |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 234 | |
| 235 | CPU |
| 236 | ~~~ |
| 237 | |
| 238 | Disable ondemand cpu mode service: |
| 239 | |
| 240 | .. code-block:: yaml |
| 241 | |
| 242 | linux: |
| 243 | system: |
| 244 | cpu: |
| 245 | governor: performance |
| 246 | |
Jakub Pavlik | b148c8c | 2017-02-12 21:30:48 +0100 | [diff] [blame] | 247 | Huge Pages |
| 248 | ~~~~~~~~~~~~ |
| 249 | |
| 250 | Huge Pages give a performance boost to applications that intensively deal |
| 251 | with memory allocation/deallocation by decreasing memory fragmentation. |
| 252 | |
| 253 | .. code-block:: yaml |
| 254 | |
| 255 | linux: |
| 256 | system: |
| 257 | kernel: |
| 258 | hugepages: |
| 259 | small: |
| 260 | size: 2M |
| 261 | count: 107520 |
| 262 | mount_point: /mnt/hugepages_2MB |
| 263 | mount: false/true # default false |
| 264 | large: |
| 265 | default: true # default automatically mounted |
| 266 | size: 1G |
| 267 | count: 210 |
| 268 | mount_point: /mnt/hugepages_1GB |
| 269 | |
| 270 | Note: not recommended to use both pagesizes in concurrently. |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 271 | |
Jakub Pavlik | 5398d87 | 2017-02-13 22:30:47 +0100 | [diff] [blame] | 272 | Intel SR-IOV |
| 273 | ~~~~~~~~~~~~ |
| 274 | |
| 275 | PCI-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. |
| 276 | |
| 277 | .. code-block:: yaml |
| 278 | |
| 279 | linux: |
| 280 | system: |
| 281 | kernel: |
| 282 | sriov: True |
| 283 | unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround |
| 284 | rc: |
| 285 | local: | |
| 286 | #!/bin/sh -e |
| 287 | # Enable 7 VF on eth1 |
| 288 | echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a |
| 289 | exit 0 |
| 290 | |
Jakub Pavlik | 6c9ead1 | 2017-02-16 21:53:13 +0100 | [diff] [blame] | 291 | Isolate CPU options |
| 292 | ~~~~~~~~~~~~~~~~~~~ |
| 293 | |
| 294 | Remove the specified CPUs, as defined by the cpu_number values, from the general kernel |
| 295 | SMP balancing and scheduler algroithms. The only way to move a process onto or off an |
| 296 | "isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the |
| 297 | maximum value is 1 less than the number of CPUs on the system. |
| 298 | |
| 299 | .. code-block:: yaml |
| 300 | |
| 301 | linux: |
| 302 | system: |
| 303 | kernel: |
| 304 | isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0 |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 305 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 306 | Repositories |
| 307 | ~~~~~~~~~~~~ |
| 308 | |
| 309 | RedHat based Linux with additional OpenStack repo |
| 310 | |
| 311 | .. code-block:: yaml |
| 312 | |
| 313 | linux: |
| 314 | system: |
| 315 | ... |
| 316 | repo: |
| 317 | rdo-icehouse: |
| 318 | enabled: true |
| 319 | source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/' |
| 320 | pgpcheck: 0 |
| 321 | |
| 322 | Ensure system repository to use czech Debian mirror (``default: true``) |
| 323 | Also pin it's packages with priority 900. |
| 324 | |
| 325 | .. code-block:: yaml |
| 326 | |
| 327 | linux: |
| 328 | system: |
| 329 | repo: |
| 330 | debian: |
| 331 | default: true |
| 332 | source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free" |
| 333 | # Import signing key from URL if needed |
| 334 | key_url: "http://dummy.com/public.gpg" |
| 335 | pin: |
| 336 | - pin: 'origin "ftp.cz.debian.org"' |
| 337 | priority: 900 |
| 338 | package: '*' |
| 339 | |
Jakub Pavlik | 7885938 | 2016-01-21 11:26:39 +0100 | [diff] [blame] | 340 | rc.local example |
| 341 | |
| 342 | .. code-block:: yaml |
| 343 | |
| 344 | linux: |
| 345 | system: |
| 346 | rc: |
| 347 | local: | |
| 348 | #!/bin/sh -e |
| 349 | # |
| 350 | # rc.local |
| 351 | # |
| 352 | # This script is executed at the end of each multiuser runlevel. |
| 353 | # Make sure that the script will "exit 0" on success or any other |
| 354 | # value on error. |
| 355 | # |
| 356 | # In order to enable or disable this script just change the execution |
| 357 | # bits. |
| 358 | # |
| 359 | # By default this script does nothing. |
| 360 | exit 0 |
| 361 | |
Filip Pytloun | 1f40dac | 2016-01-22 15:52:57 +0100 | [diff] [blame] | 362 | Prompt |
| 363 | ~~~~~~ |
| 364 | |
| 365 | Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every |
| 366 | user can have different prompt. |
| 367 | |
| 368 | .. code-block:: yaml |
| 369 | |
| 370 | linux: |
| 371 | system: |
| 372 | prompt: |
| 373 | 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\\] |
| 374 | default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w] |
| 375 | |
| 376 | On Debian systems to set prompt system-wide it's necessary to remove setting |
| 377 | PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from |
| 378 | ``/etc/skel/.bashrc``). This formula will do this automatically, but will not |
Filip Pytloun | d9b68da | 2016-01-22 15:58:41 +0100 | [diff] [blame] | 379 | touch existing user's ``~/.bashrc`` files except root. |
Jakub Pavlik | 7885938 | 2016-01-21 11:26:39 +0100 | [diff] [blame] | 380 | |
Filip Pytloun | eef11c1 | 2016-03-25 11:00:23 +0100 | [diff] [blame] | 381 | Bash |
| 382 | ~~~~ |
| 383 | |
| 384 | Fix bash configuration to preserve history across sessions (like ZSH does by |
| 385 | default). |
| 386 | |
| 387 | .. code-block:: yaml |
| 388 | |
| 389 | linux: |
| 390 | system: |
| 391 | bash: |
| 392 | preserve_history: true |
| 393 | |
Filip Pytloun | e874dfb | 2016-01-22 16:57:34 +0100 | [diff] [blame] | 394 | Message of the day |
| 395 | ~~~~~~~~~~~~~~~~~~ |
| 396 | |
| 397 | ``pam_motd`` from package ``update-motd`` is used for dynamic messages of the |
| 398 | day. Setting custom motd will cleanup existing ones. |
| 399 | |
| 400 | .. code-block:: yaml |
| 401 | |
| 402 | linux: |
| 403 | system: |
| 404 | motd: |
| 405 | - release: | |
| 406 | #!/bin/sh |
| 407 | [ -r /etc/lsb-release ] && . /etc/lsb-release |
| 408 | |
| 409 | if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then |
| 410 | # Fall back to using the very slow lsb_release utility |
| 411 | DISTRIB_DESCRIPTION=$(lsb_release -s -d) |
| 412 | fi |
| 413 | |
| 414 | printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)" |
| 415 | - warning: | |
| 416 | #!/bin/sh |
| 417 | printf "This is [company name] network.\n" |
| 418 | printf "Unauthorized access strictly prohibited.\n" |
| 419 | |
Filip Pytloun | 2f70b49 | 2016-02-19 15:55:25 +0100 | [diff] [blame] | 420 | RHEL / CentOS |
Filip Pytloun | 8296bb9 | 2016-02-19 18:42:09 +0100 | [diff] [blame] | 421 | ^^^^^^^^^^^^^ |
Filip Pytloun | 2f70b49 | 2016-02-19 15:55:25 +0100 | [diff] [blame] | 422 | |
| 423 | Unfortunately ``update-motd`` is currently not available for RHEL so there's |
| 424 | no native support for dynamic motd. |
| 425 | You can still set static one, only pillar structure differs: |
| 426 | |
| 427 | .. code-block:: yaml |
| 428 | |
| 429 | linux: |
| 430 | system: |
| 431 | motd: | |
| 432 | This is [company name] network. |
| 433 | Unauthorized access strictly prohibited. |
| 434 | |
Filip Pytloun | 8296bb9 | 2016-02-19 18:42:09 +0100 | [diff] [blame] | 435 | Haveged |
| 436 | ~~~~~~~ |
| 437 | |
| 438 | If you are running headless server and are low on entropy, it may be a good |
| 439 | idea to setup Haveged. |
| 440 | |
| 441 | .. code-block:: yaml |
| 442 | |
| 443 | linux: |
| 444 | system: |
| 445 | haveged: |
| 446 | enabled: true |
| 447 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 448 | Linux network |
| 449 | ------------- |
| 450 | |
| 451 | Linux with network manager |
| 452 | |
| 453 | .. code-block:: yaml |
| 454 | |
| 455 | linux: |
| 456 | network: |
| 457 | enabled: true |
| 458 | network_manager: true |
| 459 | |
| 460 | Linux with default static network interfaces, default gateway interface and DNS servers |
| 461 | |
| 462 | .. code-block:: yaml |
| 463 | |
| 464 | linux: |
| 465 | network: |
| 466 | enabled: true |
| 467 | interface: |
| 468 | eth0: |
| 469 | enabled: true |
| 470 | type: eth |
| 471 | address: 192.168.0.102 |
| 472 | netmask: 255.255.255.0 |
| 473 | gateway: 192.168.0.1 |
| 474 | name_servers: |
| 475 | - 8.8.8.8 |
| 476 | - 8.8.4.4 |
| 477 | mtu: 1500 |
| 478 | |
jan kaufman | 6d30adf | 2016-01-18 17:30:12 +0100 | [diff] [blame] | 479 | Linux with bonded interfaces and disabled NetworkManager |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 480 | |
| 481 | .. code-block:: yaml |
| 482 | |
| 483 | linux: |
| 484 | network: |
| 485 | enabled: true |
| 486 | interface: |
| 487 | eth0: |
| 488 | type: eth |
| 489 | ... |
| 490 | eth1: |
| 491 | type: eth |
| 492 | ... |
| 493 | bond0: |
| 494 | enabled: true |
| 495 | type: bond |
| 496 | address: 192.168.0.102 |
| 497 | netmask: 255.255.255.0 |
| 498 | mtu: 1500 |
| 499 | use_in: |
| 500 | - interface: ${linux:interface:eth0} |
| 501 | - interface: ${linux:interface:eth0} |
jan kaufman | 6d30adf | 2016-01-18 17:30:12 +0100 | [diff] [blame] | 502 | network_manager: |
| 503 | disable: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 504 | |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 505 | Linux with vlan interface_params |
| 506 | |
| 507 | .. code-block:: yaml |
| 508 | |
| 509 | linux: |
| 510 | network: |
| 511 | enabled: true |
| 512 | interface: |
| 513 | vlan69: |
| 514 | type: vlan |
jan kaufman | c0bd76f | 2015-12-15 16:45:44 +0100 | [diff] [blame] | 515 | use_interfaces: |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 516 | - interface: ${linux:interface:bond0} |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 517 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 518 | Linux with wireless interface parameters |
| 519 | |
| 520 | .. code-block:: yaml |
| 521 | |
| 522 | linux: |
| 523 | network: |
| 524 | enabled: true |
| 525 | gateway: 10.0.0.1 |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 526 | default_interface: eth0 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 527 | interface: |
| 528 | wlan0: |
| 529 | type: eth |
| 530 | wireless: |
| 531 | essid: example |
| 532 | key: example_key |
| 533 | security: wpa |
| 534 | priority: 1 |
| 535 | |
| 536 | Linux networks with routes defined |
| 537 | |
| 538 | .. code-block:: yaml |
| 539 | |
| 540 | linux: |
| 541 | network: |
| 542 | enabled: true |
| 543 | gateway: 10.0.0.1 |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 544 | default_interface: eth0 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 545 | interface: |
| 546 | eth0: |
| 547 | type: eth |
| 548 | route: |
| 549 | default: |
| 550 | address: 192.168.0.123 |
| 551 | netmask: 255.255.255.0 |
| 552 | gateway: 192.168.0.1 |
| 553 | |
| 554 | Native Linux Bridges |
| 555 | |
| 556 | .. code-block:: yaml |
| 557 | |
| 558 | linux: |
| 559 | network: |
| 560 | interface: |
| 561 | eth1: |
| 562 | enabled: true |
| 563 | type: eth |
| 564 | proto: manual |
| 565 | up_cmds: |
| 566 | - ip address add 0/0 dev $IFACE |
| 567 | - ip link set $IFACE up |
| 568 | down_cmds: |
| 569 | - ip link set $IFACE down |
| 570 | br-ex: |
| 571 | enabled: true |
| 572 | type: bridge |
| 573 | address: ${linux:network:host:public_local:address} |
| 574 | netmask: 255.255.255.0 |
| 575 | use_interfaces: |
| 576 | - eth1 |
| 577 | |
| 578 | OpenVswitch Bridges |
| 579 | |
| 580 | .. code-block:: yaml |
| 581 | |
| 582 | linux: |
| 583 | network: |
| 584 | bridge: openvswitch |
| 585 | interface: |
| 586 | eth1: |
| 587 | enabled: true |
| 588 | type: eth |
| 589 | proto: manual |
| 590 | up_cmds: |
| 591 | - ip address add 0/0 dev $IFACE |
| 592 | - ip link set $IFACE up |
| 593 | down_cmds: |
| 594 | - ip link set $IFACE down |
| 595 | br-ex: |
| 596 | enabled: true |
| 597 | type: bridge |
| 598 | address: ${linux:network:host:public_local:address} |
| 599 | netmask: 255.255.255.0 |
| 600 | use_interfaces: |
| 601 | - eth1 |
| 602 | |
| 603 | Linux with proxy |
| 604 | |
| 605 | .. code-block:: yaml |
| 606 | |
| 607 | linux: |
| 608 | network: |
| 609 | ... |
| 610 | proxy: |
| 611 | host: proxy.domain.com |
| 612 | port: 3128 |
| 613 | |
| 614 | Linux with hosts |
| 615 | |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 616 | Parameter purge_hosts will enforce whole /etc/hosts file, removing entries |
| 617 | that are not defined in model except defaults for both IPv4 and IPv6 localhost |
| 618 | and hostname + fqdn. |
| 619 | It's good to use this option if you want to ensure /etc/hosts is always in a |
| 620 | clean state however it's not enabled by default for safety. |
| 621 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 622 | .. code-block:: yaml |
| 623 | |
| 624 | linux: |
| 625 | network: |
| 626 | ... |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 627 | purge_hosts: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 628 | host: |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 629 | # No need to define this one if purge_hosts is true |
| 630 | hostname: |
| 631 | address: 127.0.1.1 |
| 632 | names: |
| 633 | - ${linux:network:fqdn} |
| 634 | - ${linux:network:hostname} |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 635 | node1: |
| 636 | address: 192.168.10.200 |
| 637 | names: |
| 638 | - node2.domain.com |
| 639 | - service2.domain.com |
| 640 | node2: |
| 641 | address: 192.168.10.201 |
| 642 | names: |
| 643 | - node2.domain.com |
| 644 | - service2.domain.com |
| 645 | |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 646 | |
Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 647 | Setup resolv.conf, nameservers, domain and search domains |
| 648 | |
| 649 | .. code-block:: yaml |
| 650 | |
| 651 | linux: |
| 652 | network: |
| 653 | resolv: |
| 654 | dns: |
| 655 | - 8.8.4.4 |
| 656 | - 8.8.8.8 |
| 657 | domain: my.example.com |
| 658 | search: |
| 659 | - my.example.com |
| 660 | - example.com |
Marek Celoud | f6cd192 | 2016-12-05 13:39:49 +0100 | [diff] [blame] | 661 | options: |
| 662 | - ndots:5 |
| 663 | - timeout:2 |
| 664 | - attempts:2 |
Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 665 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 666 | Linux storage pillars |
| 667 | --------------------- |
| 668 | |
| 669 | Linux with mounted Samba |
| 670 | |
| 671 | .. code-block:: yaml |
| 672 | |
| 673 | linux: |
| 674 | storage: |
| 675 | enabled: true |
| 676 | mount: |
| 677 | samba1: |
Simon Pasquier | 376262a | 2016-11-16 15:21:51 +0100 | [diff] [blame] | 678 | - enabled: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 679 | - path: /media/myuser/public/ |
| 680 | - device: //192.168.0.1/storage |
| 681 | - file_system: cifs |
| 682 | - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm |
| 683 | |
| 684 | Linux with file swap |
| 685 | |
| 686 | .. code-block:: yaml |
| 687 | |
| 688 | linux: |
| 689 | storage: |
| 690 | enabled: true |
| 691 | swap: |
| 692 | file: |
| 693 | enabled: true |
| 694 | engine: file |
| 695 | device: /swapfile |
| 696 | size: 1024 |
| 697 | |
Lachlan Evenson | 3067651 | 2016-01-22 15:43:28 -0800 | [diff] [blame] | 698 | Linux with partition swap |
| 699 | |
| 700 | .. code-block:: yaml |
| 701 | |
| 702 | linux: |
| 703 | storage: |
| 704 | enabled: true |
| 705 | swap: |
| 706 | partition: |
| 707 | enabled: true |
| 708 | engine: partition |
| 709 | device: /dev/vg0/swap |
| 710 | |
Filip Pytloun | c8a001a | 2015-12-15 14:09:19 +0100 | [diff] [blame] | 711 | LVM group `vg1` with one device and `data` volume mounted into `/mnt/data` |
| 712 | |
| 713 | .. code-block:: yaml |
| 714 | |
| 715 | parameters: |
| 716 | linux: |
| 717 | storage: |
| 718 | mount: |
| 719 | data: |
Simon Pasquier | 376262a | 2016-11-16 15:21:51 +0100 | [diff] [blame] | 720 | enabled: true |
Filip Pytloun | c8a001a | 2015-12-15 14:09:19 +0100 | [diff] [blame] | 721 | device: /dev/vg1/data |
| 722 | file_system: ext4 |
| 723 | path: /mnt/data |
| 724 | lvm: |
| 725 | vg1: |
| 726 | enabled: true |
| 727 | devices: |
| 728 | - /dev/sdb |
| 729 | volume: |
| 730 | data: |
| 731 | size: 40G |
| 732 | mount: ${linux:storage:mount:data} |
| 733 | |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 734 | |
| 735 | Multipath with Fujitsu Eternus DXL |
| 736 | |
| 737 | .. code-block:: yaml |
| 738 | |
| 739 | parameters: |
| 740 | linux: |
| 741 | storage: |
| 742 | multipath: |
| 743 | enabled: true |
| 744 | blacklist_devices: |
| 745 | - /dev/sda |
| 746 | - /dev/sdb |
| 747 | backends: |
| 748 | - fujitsu_eternus_dxl |
| 749 | |
| 750 | Multipath with Hitachi VSP 1000 |
| 751 | |
| 752 | .. code-block:: yaml |
| 753 | |
| 754 | parameters: |
| 755 | linux: |
| 756 | storage: |
| 757 | multipath: |
| 758 | enabled: true |
| 759 | blacklist_devices: |
| 760 | - /dev/sda |
| 761 | - /dev/sdb |
| 762 | backends: |
| 763 | - hitachi_vsp1000 |
| 764 | |
| 765 | Multipath with IBM Storwize |
| 766 | |
| 767 | .. code-block:: yaml |
| 768 | |
| 769 | parameters: |
| 770 | linux: |
| 771 | storage: |
| 772 | multipath: |
| 773 | enabled: true |
| 774 | blacklist_devices: |
| 775 | - /dev/sda |
| 776 | - /dev/sdb |
| 777 | backends: |
| 778 | - ibm_storwize |
| 779 | |
| 780 | Multipath with multiple backends |
| 781 | |
| 782 | .. code-block:: yaml |
| 783 | |
| 784 | parameters: |
| 785 | linux: |
| 786 | storage: |
| 787 | multipath: |
| 788 | enabled: true |
| 789 | blacklist_devices: |
| 790 | - /dev/sda |
| 791 | - /dev/sdb |
| 792 | - /dev/sdc |
| 793 | - /dev/sdd |
| 794 | backends: |
| 795 | - ibm_storwize |
| 796 | - fujitsu_eternus_dxl |
| 797 | - hitachi_vsp1000 |
| 798 | |
| 799 | Disabled multipath (the default setup) |
| 800 | |
| 801 | .. code-block:: yaml |
| 802 | |
| 803 | parameters: |
| 804 | linux: |
| 805 | storage: |
| 806 | multipath: |
| 807 | enabled: false |
| 808 | |
Simon Pasquier | 375001e | 2017-01-26 13:22:33 +0100 | [diff] [blame] | 809 | Linux with local loopback device |
| 810 | |
| 811 | .. code-block:: yaml |
| 812 | |
| 813 | linux: |
| 814 | storage: |
| 815 | loopback: |
| 816 | disk1: |
| 817 | file: /srv/disk1 |
| 818 | size: 50G |
| 819 | |
Filip Pytloun | b2c8f85 | 2016-11-21 17:03:43 +0100 | [diff] [blame] | 820 | External config generation |
| 821 | -------------------------- |
| 822 | |
| 823 | You are able to use config support metadata between formulas and only generate |
| 824 | config files for external use, eg. docker, etc. |
| 825 | |
| 826 | .. code-block:: yaml |
| 827 | |
| 828 | parameters: |
| 829 | linux: |
| 830 | system: |
| 831 | config: |
| 832 | pillar: |
| 833 | jenkins: |
| 834 | master: |
| 835 | home: /srv/volumes/jenkins |
| 836 | approved_scripts: |
| 837 | - method java.net.URL openConnection |
| 838 | credentials: |
| 839 | - type: username_password |
| 840 | scope: global |
| 841 | id: test |
| 842 | desc: Testing credentials |
| 843 | username: test |
| 844 | password: test |
| 845 | |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 846 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 847 | Usage |
| 848 | ===== |
| 849 | |
| 850 | Set mtu of network interface eth0 to 1400 |
| 851 | |
| 852 | .. code-block:: bash |
| 853 | |
| 854 | ip link set dev eth0 mtu 1400 |
| 855 | |
| 856 | Read more |
| 857 | ========= |
| 858 | |
| 859 | * https://www.archlinux.org/ |
| 860 | * http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu |
Filip Pytloun | 018f871 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 861 | |
| 862 | Documentation and Bugs |
| 863 | ====================== |
| 864 | |
| 865 | To learn how to install and update salt-formulas, consult the documentation |
| 866 | available online at: |
| 867 | |
| 868 | http://salt-formulas.readthedocs.io/ |
| 869 | |
| 870 | In the unfortunate event that bugs are discovered, they should be reported to |
| 871 | the appropriate issue tracker. Use Github issue tracker for specific salt |
| 872 | formula: |
| 873 | |
| 874 | https://github.com/salt-formulas/salt-formula-linux/issues |
| 875 | |
| 876 | For feature requests, bug reports or blueprints affecting entire ecosystem, |
| 877 | use Launchpad salt-formulas project: |
| 878 | |
| 879 | https://launchpad.net/salt-formulas |
| 880 | |
| 881 | You can also join salt-formulas-users team and subscribe to mailing list: |
| 882 | |
| 883 | https://launchpad.net/~salt-formulas-users |
| 884 | |
| 885 | Developers wishing to work on the salt-formulas projects should always base |
| 886 | their work on master branch and submit pull request against specific formula. |
| 887 | |
| 888 | https://github.com/salt-formulas/salt-formula-linux |
| 889 | |
| 890 | Any questions or feedback is always welcome so feel free to join our IRC |
| 891 | channel: |
| 892 | |
| 893 | #salt-formulas @ irc.freenode.net |