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 | |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 291 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 292 | Repositories |
| 293 | ~~~~~~~~~~~~ |
| 294 | |
| 295 | RedHat based Linux with additional OpenStack repo |
| 296 | |
| 297 | .. code-block:: yaml |
| 298 | |
| 299 | linux: |
| 300 | system: |
| 301 | ... |
| 302 | repo: |
| 303 | rdo-icehouse: |
| 304 | enabled: true |
| 305 | source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/' |
| 306 | pgpcheck: 0 |
| 307 | |
| 308 | Ensure system repository to use czech Debian mirror (``default: true``) |
| 309 | Also pin it's packages with priority 900. |
| 310 | |
| 311 | .. code-block:: yaml |
| 312 | |
| 313 | linux: |
| 314 | system: |
| 315 | repo: |
| 316 | debian: |
| 317 | default: true |
| 318 | source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free" |
| 319 | # Import signing key from URL if needed |
| 320 | key_url: "http://dummy.com/public.gpg" |
| 321 | pin: |
| 322 | - pin: 'origin "ftp.cz.debian.org"' |
| 323 | priority: 900 |
| 324 | package: '*' |
| 325 | |
Jakub Pavlik | 7885938 | 2016-01-21 11:26:39 +0100 | [diff] [blame] | 326 | rc.local example |
| 327 | |
| 328 | .. code-block:: yaml |
| 329 | |
| 330 | linux: |
| 331 | system: |
| 332 | rc: |
| 333 | local: | |
| 334 | #!/bin/sh -e |
| 335 | # |
| 336 | # rc.local |
| 337 | # |
| 338 | # This script is executed at the end of each multiuser runlevel. |
| 339 | # Make sure that the script will "exit 0" on success or any other |
| 340 | # value on error. |
| 341 | # |
| 342 | # In order to enable or disable this script just change the execution |
| 343 | # bits. |
| 344 | # |
| 345 | # By default this script does nothing. |
| 346 | exit 0 |
| 347 | |
Filip Pytloun | 1f40dac | 2016-01-22 15:52:57 +0100 | [diff] [blame] | 348 | Prompt |
| 349 | ~~~~~~ |
| 350 | |
| 351 | Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every |
| 352 | user can have different prompt. |
| 353 | |
| 354 | .. code-block:: yaml |
| 355 | |
| 356 | linux: |
| 357 | system: |
| 358 | prompt: |
| 359 | 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\\] |
| 360 | default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w] |
| 361 | |
| 362 | On Debian systems to set prompt system-wide it's necessary to remove setting |
| 363 | PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from |
| 364 | ``/etc/skel/.bashrc``). This formula will do this automatically, but will not |
Filip Pytloun | d9b68da | 2016-01-22 15:58:41 +0100 | [diff] [blame] | 365 | touch existing user's ``~/.bashrc`` files except root. |
Jakub Pavlik | 7885938 | 2016-01-21 11:26:39 +0100 | [diff] [blame] | 366 | |
Filip Pytloun | eef11c1 | 2016-03-25 11:00:23 +0100 | [diff] [blame] | 367 | Bash |
| 368 | ~~~~ |
| 369 | |
| 370 | Fix bash configuration to preserve history across sessions (like ZSH does by |
| 371 | default). |
| 372 | |
| 373 | .. code-block:: yaml |
| 374 | |
| 375 | linux: |
| 376 | system: |
| 377 | bash: |
| 378 | preserve_history: true |
| 379 | |
Filip Pytloun | e874dfb | 2016-01-22 16:57:34 +0100 | [diff] [blame] | 380 | Message of the day |
| 381 | ~~~~~~~~~~~~~~~~~~ |
| 382 | |
| 383 | ``pam_motd`` from package ``update-motd`` is used for dynamic messages of the |
| 384 | day. Setting custom motd will cleanup existing ones. |
| 385 | |
| 386 | .. code-block:: yaml |
| 387 | |
| 388 | linux: |
| 389 | system: |
| 390 | motd: |
| 391 | - release: | |
| 392 | #!/bin/sh |
| 393 | [ -r /etc/lsb-release ] && . /etc/lsb-release |
| 394 | |
| 395 | if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then |
| 396 | # Fall back to using the very slow lsb_release utility |
| 397 | DISTRIB_DESCRIPTION=$(lsb_release -s -d) |
| 398 | fi |
| 399 | |
| 400 | printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)" |
| 401 | - warning: | |
| 402 | #!/bin/sh |
| 403 | printf "This is [company name] network.\n" |
| 404 | printf "Unauthorized access strictly prohibited.\n" |
| 405 | |
Filip Pytloun | 2f70b49 | 2016-02-19 15:55:25 +0100 | [diff] [blame] | 406 | RHEL / CentOS |
Filip Pytloun | 8296bb9 | 2016-02-19 18:42:09 +0100 | [diff] [blame] | 407 | ^^^^^^^^^^^^^ |
Filip Pytloun | 2f70b49 | 2016-02-19 15:55:25 +0100 | [diff] [blame] | 408 | |
| 409 | Unfortunately ``update-motd`` is currently not available for RHEL so there's |
| 410 | no native support for dynamic motd. |
| 411 | You can still set static one, only pillar structure differs: |
| 412 | |
| 413 | .. code-block:: yaml |
| 414 | |
| 415 | linux: |
| 416 | system: |
| 417 | motd: | |
| 418 | This is [company name] network. |
| 419 | Unauthorized access strictly prohibited. |
| 420 | |
Filip Pytloun | 8296bb9 | 2016-02-19 18:42:09 +0100 | [diff] [blame] | 421 | Haveged |
| 422 | ~~~~~~~ |
| 423 | |
| 424 | If you are running headless server and are low on entropy, it may be a good |
| 425 | idea to setup Haveged. |
| 426 | |
| 427 | .. code-block:: yaml |
| 428 | |
| 429 | linux: |
| 430 | system: |
| 431 | haveged: |
| 432 | enabled: true |
| 433 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 434 | Linux network |
| 435 | ------------- |
| 436 | |
| 437 | Linux with network manager |
| 438 | |
| 439 | .. code-block:: yaml |
| 440 | |
| 441 | linux: |
| 442 | network: |
| 443 | enabled: true |
| 444 | network_manager: true |
| 445 | |
| 446 | Linux with default static network interfaces, default gateway interface and DNS servers |
| 447 | |
| 448 | .. code-block:: yaml |
| 449 | |
| 450 | linux: |
| 451 | network: |
| 452 | enabled: true |
| 453 | interface: |
| 454 | eth0: |
| 455 | enabled: true |
| 456 | type: eth |
| 457 | address: 192.168.0.102 |
| 458 | netmask: 255.255.255.0 |
| 459 | gateway: 192.168.0.1 |
| 460 | name_servers: |
| 461 | - 8.8.8.8 |
| 462 | - 8.8.4.4 |
| 463 | mtu: 1500 |
| 464 | |
jan kaufman | 6d30adf | 2016-01-18 17:30:12 +0100 | [diff] [blame] | 465 | Linux with bonded interfaces and disabled NetworkManager |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 466 | |
| 467 | .. code-block:: yaml |
| 468 | |
| 469 | linux: |
| 470 | network: |
| 471 | enabled: true |
| 472 | interface: |
| 473 | eth0: |
| 474 | type: eth |
| 475 | ... |
| 476 | eth1: |
| 477 | type: eth |
| 478 | ... |
| 479 | bond0: |
| 480 | enabled: true |
| 481 | type: bond |
| 482 | address: 192.168.0.102 |
| 483 | netmask: 255.255.255.0 |
| 484 | mtu: 1500 |
| 485 | use_in: |
| 486 | - interface: ${linux:interface:eth0} |
| 487 | - interface: ${linux:interface:eth0} |
jan kaufman | 6d30adf | 2016-01-18 17:30:12 +0100 | [diff] [blame] | 488 | network_manager: |
| 489 | disable: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 490 | |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 491 | Linux with vlan interface_params |
| 492 | |
| 493 | .. code-block:: yaml |
| 494 | |
| 495 | linux: |
| 496 | network: |
| 497 | enabled: true |
| 498 | interface: |
| 499 | vlan69: |
| 500 | type: vlan |
jan kaufman | c0bd76f | 2015-12-15 16:45:44 +0100 | [diff] [blame] | 501 | use_interfaces: |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 502 | - interface: ${linux:interface:bond0} |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 503 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 504 | Linux with wireless interface parameters |
| 505 | |
| 506 | .. code-block:: yaml |
| 507 | |
| 508 | linux: |
| 509 | network: |
| 510 | enabled: true |
| 511 | gateway: 10.0.0.1 |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 512 | default_interface: eth0 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 513 | interface: |
| 514 | wlan0: |
| 515 | type: eth |
| 516 | wireless: |
| 517 | essid: example |
| 518 | key: example_key |
| 519 | security: wpa |
| 520 | priority: 1 |
| 521 | |
| 522 | Linux networks with routes defined |
| 523 | |
| 524 | .. code-block:: yaml |
| 525 | |
| 526 | linux: |
| 527 | network: |
| 528 | enabled: true |
| 529 | gateway: 10.0.0.1 |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 530 | default_interface: eth0 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 531 | interface: |
| 532 | eth0: |
| 533 | type: eth |
| 534 | route: |
| 535 | default: |
| 536 | address: 192.168.0.123 |
| 537 | netmask: 255.255.255.0 |
| 538 | gateway: 192.168.0.1 |
| 539 | |
| 540 | Native Linux Bridges |
| 541 | |
| 542 | .. code-block:: yaml |
| 543 | |
| 544 | linux: |
| 545 | network: |
| 546 | interface: |
| 547 | eth1: |
| 548 | enabled: true |
| 549 | type: eth |
| 550 | proto: manual |
| 551 | up_cmds: |
| 552 | - ip address add 0/0 dev $IFACE |
| 553 | - ip link set $IFACE up |
| 554 | down_cmds: |
| 555 | - ip link set $IFACE down |
| 556 | br-ex: |
| 557 | enabled: true |
| 558 | type: bridge |
| 559 | address: ${linux:network:host:public_local:address} |
| 560 | netmask: 255.255.255.0 |
| 561 | use_interfaces: |
| 562 | - eth1 |
| 563 | |
| 564 | OpenVswitch Bridges |
| 565 | |
| 566 | .. code-block:: yaml |
| 567 | |
| 568 | linux: |
| 569 | network: |
| 570 | bridge: openvswitch |
| 571 | interface: |
| 572 | eth1: |
| 573 | enabled: true |
| 574 | type: eth |
| 575 | proto: manual |
| 576 | up_cmds: |
| 577 | - ip address add 0/0 dev $IFACE |
| 578 | - ip link set $IFACE up |
| 579 | down_cmds: |
| 580 | - ip link set $IFACE down |
| 581 | br-ex: |
| 582 | enabled: true |
| 583 | type: bridge |
| 584 | address: ${linux:network:host:public_local:address} |
| 585 | netmask: 255.255.255.0 |
| 586 | use_interfaces: |
| 587 | - eth1 |
| 588 | |
| 589 | Linux with proxy |
| 590 | |
| 591 | .. code-block:: yaml |
| 592 | |
| 593 | linux: |
| 594 | network: |
| 595 | ... |
| 596 | proxy: |
| 597 | host: proxy.domain.com |
| 598 | port: 3128 |
| 599 | |
| 600 | Linux with hosts |
| 601 | |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 602 | Parameter purge_hosts will enforce whole /etc/hosts file, removing entries |
| 603 | that are not defined in model except defaults for both IPv4 and IPv6 localhost |
| 604 | and hostname + fqdn. |
| 605 | It's good to use this option if you want to ensure /etc/hosts is always in a |
| 606 | clean state however it's not enabled by default for safety. |
| 607 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 608 | .. code-block:: yaml |
| 609 | |
| 610 | linux: |
| 611 | network: |
| 612 | ... |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 613 | purge_hosts: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 614 | host: |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 615 | # No need to define this one if purge_hosts is true |
| 616 | hostname: |
| 617 | address: 127.0.1.1 |
| 618 | names: |
| 619 | - ${linux:network:fqdn} |
| 620 | - ${linux:network:hostname} |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 621 | node1: |
| 622 | address: 192.168.10.200 |
| 623 | names: |
| 624 | - node2.domain.com |
| 625 | - service2.domain.com |
| 626 | node2: |
| 627 | address: 192.168.10.201 |
| 628 | names: |
| 629 | - node2.domain.com |
| 630 | - service2.domain.com |
| 631 | |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 632 | |
Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 633 | Setup resolv.conf, nameservers, domain and search domains |
| 634 | |
| 635 | .. code-block:: yaml |
| 636 | |
| 637 | linux: |
| 638 | network: |
| 639 | resolv: |
| 640 | dns: |
| 641 | - 8.8.4.4 |
| 642 | - 8.8.8.8 |
| 643 | domain: my.example.com |
| 644 | search: |
| 645 | - my.example.com |
| 646 | - example.com |
Marek Celoud | f6cd192 | 2016-12-05 13:39:49 +0100 | [diff] [blame] | 647 | options: |
| 648 | - ndots:5 |
| 649 | - timeout:2 |
| 650 | - attempts:2 |
Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 651 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 652 | Linux storage pillars |
| 653 | --------------------- |
| 654 | |
| 655 | Linux with mounted Samba |
| 656 | |
| 657 | .. code-block:: yaml |
| 658 | |
| 659 | linux: |
| 660 | storage: |
| 661 | enabled: true |
| 662 | mount: |
| 663 | samba1: |
Simon Pasquier | 376262a | 2016-11-16 15:21:51 +0100 | [diff] [blame] | 664 | - enabled: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 665 | - path: /media/myuser/public/ |
| 666 | - device: //192.168.0.1/storage |
| 667 | - file_system: cifs |
| 668 | - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm |
| 669 | |
| 670 | Linux with file swap |
| 671 | |
| 672 | .. code-block:: yaml |
| 673 | |
| 674 | linux: |
| 675 | storage: |
| 676 | enabled: true |
| 677 | swap: |
| 678 | file: |
| 679 | enabled: true |
| 680 | engine: file |
| 681 | device: /swapfile |
| 682 | size: 1024 |
| 683 | |
Lachlan Evenson | 3067651 | 2016-01-22 15:43:28 -0800 | [diff] [blame] | 684 | Linux with partition swap |
| 685 | |
| 686 | .. code-block:: yaml |
| 687 | |
| 688 | linux: |
| 689 | storage: |
| 690 | enabled: true |
| 691 | swap: |
| 692 | partition: |
| 693 | enabled: true |
| 694 | engine: partition |
| 695 | device: /dev/vg0/swap |
| 696 | |
Filip Pytloun | c8a001a | 2015-12-15 14:09:19 +0100 | [diff] [blame] | 697 | LVM group `vg1` with one device and `data` volume mounted into `/mnt/data` |
| 698 | |
| 699 | .. code-block:: yaml |
| 700 | |
| 701 | parameters: |
| 702 | linux: |
| 703 | storage: |
| 704 | mount: |
| 705 | data: |
Simon Pasquier | 376262a | 2016-11-16 15:21:51 +0100 | [diff] [blame] | 706 | enabled: true |
Filip Pytloun | c8a001a | 2015-12-15 14:09:19 +0100 | [diff] [blame] | 707 | device: /dev/vg1/data |
| 708 | file_system: ext4 |
| 709 | path: /mnt/data |
| 710 | lvm: |
| 711 | vg1: |
| 712 | enabled: true |
| 713 | devices: |
| 714 | - /dev/sdb |
| 715 | volume: |
| 716 | data: |
| 717 | size: 40G |
| 718 | mount: ${linux:storage:mount:data} |
| 719 | |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 720 | |
| 721 | Multipath with Fujitsu Eternus DXL |
| 722 | |
| 723 | .. code-block:: yaml |
| 724 | |
| 725 | parameters: |
| 726 | linux: |
| 727 | storage: |
| 728 | multipath: |
| 729 | enabled: true |
| 730 | blacklist_devices: |
| 731 | - /dev/sda |
| 732 | - /dev/sdb |
| 733 | backends: |
| 734 | - fujitsu_eternus_dxl |
| 735 | |
| 736 | Multipath with Hitachi VSP 1000 |
| 737 | |
| 738 | .. code-block:: yaml |
| 739 | |
| 740 | parameters: |
| 741 | linux: |
| 742 | storage: |
| 743 | multipath: |
| 744 | enabled: true |
| 745 | blacklist_devices: |
| 746 | - /dev/sda |
| 747 | - /dev/sdb |
| 748 | backends: |
| 749 | - hitachi_vsp1000 |
| 750 | |
| 751 | Multipath with IBM Storwize |
| 752 | |
| 753 | .. code-block:: yaml |
| 754 | |
| 755 | parameters: |
| 756 | linux: |
| 757 | storage: |
| 758 | multipath: |
| 759 | enabled: true |
| 760 | blacklist_devices: |
| 761 | - /dev/sda |
| 762 | - /dev/sdb |
| 763 | backends: |
| 764 | - ibm_storwize |
| 765 | |
| 766 | Multipath with multiple backends |
| 767 | |
| 768 | .. code-block:: yaml |
| 769 | |
| 770 | parameters: |
| 771 | linux: |
| 772 | storage: |
| 773 | multipath: |
| 774 | enabled: true |
| 775 | blacklist_devices: |
| 776 | - /dev/sda |
| 777 | - /dev/sdb |
| 778 | - /dev/sdc |
| 779 | - /dev/sdd |
| 780 | backends: |
| 781 | - ibm_storwize |
| 782 | - fujitsu_eternus_dxl |
| 783 | - hitachi_vsp1000 |
| 784 | |
| 785 | Disabled multipath (the default setup) |
| 786 | |
| 787 | .. code-block:: yaml |
| 788 | |
| 789 | parameters: |
| 790 | linux: |
| 791 | storage: |
| 792 | multipath: |
| 793 | enabled: false |
| 794 | |
Simon Pasquier | 375001e | 2017-01-26 13:22:33 +0100 | [diff] [blame] | 795 | Linux with local loopback device |
| 796 | |
| 797 | .. code-block:: yaml |
| 798 | |
| 799 | linux: |
| 800 | storage: |
| 801 | loopback: |
| 802 | disk1: |
| 803 | file: /srv/disk1 |
| 804 | size: 50G |
| 805 | |
Filip Pytloun | b2c8f85 | 2016-11-21 17:03:43 +0100 | [diff] [blame] | 806 | External config generation |
| 807 | -------------------------- |
| 808 | |
| 809 | You are able to use config support metadata between formulas and only generate |
| 810 | config files for external use, eg. docker, etc. |
| 811 | |
| 812 | .. code-block:: yaml |
| 813 | |
| 814 | parameters: |
| 815 | linux: |
| 816 | system: |
| 817 | config: |
| 818 | pillar: |
| 819 | jenkins: |
| 820 | master: |
| 821 | home: /srv/volumes/jenkins |
| 822 | approved_scripts: |
| 823 | - method java.net.URL openConnection |
| 824 | credentials: |
| 825 | - type: username_password |
| 826 | scope: global |
| 827 | id: test |
| 828 | desc: Testing credentials |
| 829 | username: test |
| 830 | password: test |
| 831 | |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 832 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 833 | Usage |
| 834 | ===== |
| 835 | |
| 836 | Set mtu of network interface eth0 to 1400 |
| 837 | |
| 838 | .. code-block:: bash |
| 839 | |
| 840 | ip link set dev eth0 mtu 1400 |
| 841 | |
| 842 | Read more |
| 843 | ========= |
| 844 | |
| 845 | * https://www.archlinux.org/ |
| 846 | * 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] | 847 | |
| 848 | Documentation and Bugs |
| 849 | ====================== |
| 850 | |
| 851 | To learn how to install and update salt-formulas, consult the documentation |
| 852 | available online at: |
| 853 | |
| 854 | http://salt-formulas.readthedocs.io/ |
| 855 | |
| 856 | In the unfortunate event that bugs are discovered, they should be reported to |
| 857 | the appropriate issue tracker. Use Github issue tracker for specific salt |
| 858 | formula: |
| 859 | |
| 860 | https://github.com/salt-formulas/salt-formula-linux/issues |
| 861 | |
| 862 | For feature requests, bug reports or blueprints affecting entire ecosystem, |
| 863 | use Launchpad salt-formulas project: |
| 864 | |
| 865 | https://launchpad.net/salt-formulas |
| 866 | |
| 867 | You can also join salt-formulas-users team and subscribe to mailing list: |
| 868 | |
| 869 | https://launchpad.net/~salt-formulas-users |
| 870 | |
| 871 | Developers wishing to work on the salt-formulas projects should always base |
| 872 | their work on master branch and submit pull request against specific formula. |
| 873 | |
| 874 | https://github.com/salt-formulas/salt-formula-linux |
| 875 | |
| 876 | Any questions or feedback is always welcome so feel free to join our IRC |
| 877 | channel: |
| 878 | |
| 879 | #salt-formulas @ irc.freenode.net |