Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 1 | ============ |
| 2 | Linux Fomula |
| 3 | ============ |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 4 | |
| 5 | Linux Operating Systems. |
| 6 | |
| 7 | * Ubuntu |
| 8 | * CentOS |
| 9 | * RedHat |
| 10 | * Fedora |
| 11 | * Arch |
| 12 | |
Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 13 | Sample Pillars |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 14 | ============== |
| 15 | |
Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 16 | |
| 17 | Linux System |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 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 | |
azvyagintsev | 967af13 | 2017-06-12 12:25:24 +0300 | [diff] [blame] | 34 | Linux with system users, some with password set: |
| 35 | .. WARNING:: |
| 36 | If no 'password' variable has been passed - any predifined password |
| 37 | will be removed. |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 38 | |
| 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 |
azvyagintsev | 967af13 | 2017-06-12 12:25:24 +0300 | [diff] [blame] | 56 | full_name: 'With clear password' |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 57 | home: '/home/jsmith' |
azvyagintsev | 967af13 | 2017-06-12 12:25:24 +0300 | [diff] [blame] | 58 | 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 Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 72 | |
Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 73 | Configure sudo for users and groups under ``/etc/sudoers.d/``. |
| 74 | This ways ``linux.system.sudo`` pillar map to actual sudo attributes: |
| 75 | |
| 76 | .. code-block:: jinja |
Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 77 | |
Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 78 | # 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 Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 86 | .. code-block:: yaml |
Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 87 | |
Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 88 | linux: |
| 89 | system: |
| 90 | sudo: |
| 91 | enabled: true |
Tomas Kamm | d8eb300 | 2017-05-08 19:30:29 +0200 | [diff] [blame] | 92 | aliases: |
Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 93 | 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 Josef | 7a9d9b9 | 2017-05-16 11:39:01 +0200 | [diff] [blame] | 176 | setenv: true # Enable sudo -E option |
Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 177 | runas: |
| 178 | - DBA |
| 179 | commands: |
| 180 | - ALL |
| 181 | - '!SUPPORT_SHELLS' |
| 182 | - '!SUPPORT_RESTRICTED' |
| 183 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 184 | Linux with package, latest version |
| 185 | |
| 186 | .. code-block:: yaml |
| 187 | |
| 188 | linux: |
| 189 | system: |
| 190 | ... |
| 191 | package: |
| 192 | package-name: |
| 193 | version: latest |
| 194 | |
| 195 | Linux 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 | |
| 208 | Linux 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 Binet | 69a9d8d | 2017-02-16 22:34:32 +0100 | [diff] [blame] | 221 | Linux 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 Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 236 | Linux with cron jobs |
Filip Pytloun | 9122222 | 2017-08-04 10:55:27 +0200 | [diff] [blame] | 237 | By default it will use name as an identifier, unless identifier key is |
| 238 | explicitly set or False (then it will use Salt's default behavior which is |
| 239 | identifier same as command resulting in not being able to change it) |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 240 | |
| 241 | .. code-block:: yaml |
| 242 | |
| 243 | linux: |
| 244 | system: |
| 245 | ... |
| 246 | job: |
| 247 | cmd1: |
| 248 | command: '/cmd/to/run' |
Filip Pytloun | 9122222 | 2017-08-04 10:55:27 +0200 | [diff] [blame] | 249 | identifier: cmd1 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 250 | enabled: true |
| 251 | user: 'root' |
| 252 | hour: 2 |
| 253 | minute: 0 |
| 254 | |
Filip Pytloun | d0a29e7 | 2015-11-30 15:23:34 +0100 | [diff] [blame] | 255 | Linux 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 Pytloun | 7fee054 | 2015-10-15 11:19:24 +0200 | [diff] [blame] | 271 | Enable 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 Pytloun | 281d020 | 2016-01-29 14:03:51 +0100 | [diff] [blame] | 280 | # Enable serial console |
| 281 | ttyS0: |
| 282 | autologin: root |
| 283 | rate: 115200 |
| 284 | term: xterm |
Filip Pytloun | 7fee054 | 2015-10-15 11:19:24 +0200 | [diff] [blame] | 285 | |
| 286 | To disable set autologin to `false`. |
| 287 | |
Filip Pytloun | 7731b85 | 2016-02-01 11:13:47 +0100 | [diff] [blame] | 288 | Set ``policy-rc.d`` on Debian-based systems. Action can be any available |
| 289 | command in ``while true`` loop and ``case`` context. |
| 290 | Following 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 Pytloun | c49445a | 2016-04-04 14:23:20 +0200 | [diff] [blame] | 302 | Set system locales: |
| 303 | |
| 304 | .. code-block:: yaml |
| 305 | |
| 306 | linux: |
| 307 | system: |
| 308 | locale: |
| 309 | en_US.UTF-8: |
| 310 | default: true |
Filip Pytloun | ee1745f | 2016-04-04 17:39:41 +0200 | [diff] [blame] | 311 | "cs_CZ.UTF-8 UTF-8": |
Filip Pytloun | c49445a | 2016-04-04 14:23:20 +0200 | [diff] [blame] | 312 | enabled: true |
| 313 | |
Andrey Shestakov | e7cca05 | 2017-05-24 23:06:24 +0300 | [diff] [blame] | 314 | Systemd 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 Pytloun | 281034a | 2016-01-04 18:06:22 +0100 | [diff] [blame] | 331 | Kernel |
| 332 | ~~~~~~ |
| 333 | |
| 334 | Install always up to date LTS kernel and headers from Ubuntu trusty: |
| 335 | |
| 336 | .. code-block:: yaml |
| 337 | |
| 338 | linux: |
| 339 | system: |
| 340 | kernel: |
| 341 | type: generic |
| 342 | lts: trusty |
| 343 | headers: true |
| 344 | |
Tomáš Kukrál | ba35b21 | 2017-02-15 17:59:46 +0100 | [diff] [blame] | 345 | Load kernel modules and add them to `/etc/modules`: |
| 346 | |
| 347 | .. code-block:: yaml |
| 348 | |
| 349 | linux: |
| 350 | system: |
| 351 | kernel: |
| 352 | modules: |
| 353 | - nf_conntrack |
| 354 | - tp_smapi |
| 355 | - 8021q |
| 356 | |
teoyaomiqui | 32b1f7c | 2017-05-24 14:36:09 +0300 | [diff] [blame] | 357 | Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example |
| 358 | will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`: |
| 359 | |
| 360 | .. code-block:: yaml |
| 361 | |
| 362 | linux: |
| 363 | system: |
| 364 | kernel: |
| 365 | module: |
| 366 | nf_conntrack: |
| 367 | option: |
| 368 | hashsize: 262144 |
| 369 | |
| 370 | |
| 371 | |
Filip Pytloun | 281034a | 2016-01-04 18:06:22 +0100 | [diff] [blame] | 372 | Install specific kernel version and ensure all other kernel packages are |
| 373 | not present. Also install extra modules and headers for this kernel: |
| 374 | |
| 375 | .. code-block:: yaml |
| 376 | |
| 377 | linux: |
| 378 | system: |
| 379 | kernel: |
| 380 | type: generic |
| 381 | extra: true |
| 382 | headers: true |
| 383 | version: 4.2.0-22 |
| 384 | |
Jakub Pavlik | 32c2cb0 | 2016-01-29 12:45:29 +0100 | [diff] [blame] | 385 | Systcl kernel parameters |
| 386 | |
| 387 | .. code-block:: yaml |
| 388 | |
| 389 | linux: |
| 390 | system: |
| 391 | kernel: |
| 392 | sysctl: |
| 393 | net.ipv4.tcp_keepalive_intvl: 3 |
| 394 | net.ipv4.tcp_keepalive_time: 30 |
| 395 | net.ipv4.tcp_keepalive_probes: 8 |
| 396 | |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 397 | |
| 398 | CPU |
| 399 | ~~~ |
| 400 | |
teoyaomiqui | 32b1f7c | 2017-05-24 14:36:09 +0300 | [diff] [blame] | 401 | Enable cpufreq governor for every cpu: |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 402 | |
| 403 | .. code-block:: yaml |
| 404 | |
| 405 | linux: |
| 406 | system: |
| 407 | cpu: |
| 408 | governor: performance |
| 409 | |
Jakub Pavlik | b148c8c | 2017-02-12 21:30:48 +0100 | [diff] [blame] | 410 | Huge Pages |
| 411 | ~~~~~~~~~~~~ |
| 412 | |
| 413 | Huge Pages give a performance boost to applications that intensively deal |
| 414 | with memory allocation/deallocation by decreasing memory fragmentation. |
| 415 | |
| 416 | .. code-block:: yaml |
| 417 | |
| 418 | linux: |
| 419 | system: |
| 420 | kernel: |
| 421 | hugepages: |
| 422 | small: |
| 423 | size: 2M |
| 424 | count: 107520 |
| 425 | mount_point: /mnt/hugepages_2MB |
| 426 | mount: false/true # default false |
| 427 | large: |
| 428 | default: true # default automatically mounted |
| 429 | size: 1G |
| 430 | count: 210 |
| 431 | mount_point: /mnt/hugepages_1GB |
| 432 | |
| 433 | Note: not recommended to use both pagesizes in concurrently. |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 434 | |
Jakub Pavlik | 5398d87 | 2017-02-13 22:30:47 +0100 | [diff] [blame] | 435 | Intel SR-IOV |
| 436 | ~~~~~~~~~~~~ |
| 437 | |
| 438 | 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. |
| 439 | |
| 440 | .. code-block:: yaml |
| 441 | |
| 442 | linux: |
| 443 | system: |
| 444 | kernel: |
| 445 | sriov: True |
| 446 | unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround |
| 447 | rc: |
| 448 | local: | |
| 449 | #!/bin/sh -e |
| 450 | # Enable 7 VF on eth1 |
| 451 | echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a |
| 452 | exit 0 |
| 453 | |
Jakub Pavlik | 6c9ead1 | 2017-02-16 21:53:13 +0100 | [diff] [blame] | 454 | Isolate CPU options |
| 455 | ~~~~~~~~~~~~~~~~~~~ |
| 456 | |
| 457 | Remove the specified CPUs, as defined by the cpu_number values, from the general kernel |
| 458 | SMP balancing and scheduler algroithms. The only way to move a process onto or off an |
| 459 | "isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the |
| 460 | maximum value is 1 less than the number of CPUs on the system. |
| 461 | |
| 462 | .. code-block:: yaml |
| 463 | |
| 464 | linux: |
| 465 | system: |
| 466 | kernel: |
| 467 | isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0 |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 468 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 469 | Repositories |
| 470 | ~~~~~~~~~~~~ |
| 471 | |
| 472 | RedHat based Linux with additional OpenStack repo |
| 473 | |
| 474 | .. code-block:: yaml |
| 475 | |
| 476 | linux: |
| 477 | system: |
| 478 | ... |
| 479 | repo: |
| 480 | rdo-icehouse: |
| 481 | enabled: true |
| 482 | source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/' |
| 483 | pgpcheck: 0 |
| 484 | |
| 485 | Ensure system repository to use czech Debian mirror (``default: true``) |
| 486 | Also pin it's packages with priority 900. |
| 487 | |
| 488 | .. code-block:: yaml |
| 489 | |
| 490 | linux: |
| 491 | system: |
| 492 | repo: |
| 493 | debian: |
| 494 | default: true |
| 495 | source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free" |
| 496 | # Import signing key from URL if needed |
| 497 | key_url: "http://dummy.com/public.gpg" |
| 498 | pin: |
| 499 | - pin: 'origin "ftp.cz.debian.org"' |
| 500 | priority: 900 |
| 501 | package: '*' |
| 502 | |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 503 | |
| 504 | Package manager proxy setup globally: |
| 505 | |
| 506 | .. code-block:: yaml |
| 507 | |
| 508 | linux: |
| 509 | system: |
| 510 | ... |
| 511 | repo: |
| 512 | apt-mk: |
| 513 | source: "deb http://apt-mk.mirantis.com/ stable main salt" |
| 514 | ... |
| 515 | proxy: |
| 516 | pkg: |
| 517 | enabled: true |
| 518 | ftp: ftp://ftp-proxy-for-apt.host.local:2121 |
| 519 | ... |
| 520 | # NOTE: Global defaults for any other componet that configure proxy on the system. |
| 521 | # If your environment has just one simple proxy, set it on linux:system:proxy. |
| 522 | # |
| 523 | # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries |
| 524 | # as for https and http |
| 525 | ftp: ftp://proxy.host.local:2121 |
| 526 | http: http://proxy.host.local:3142 |
| 527 | https: https://proxy.host.local:3143 |
| 528 | |
| 529 | Package manager proxy setup per repository: |
| 530 | |
| 531 | .. code-block:: yaml |
| 532 | |
| 533 | linux: |
| 534 | system: |
| 535 | ... |
| 536 | repo: |
| 537 | debian: |
| 538 | source: "deb http://apt-mk.mirantis.com/ stable main salt" |
| 539 | ... |
| 540 | apt-mk: |
| 541 | source: "deb http://apt-mk.mirantis.com/ stable main salt" |
| 542 | # per repository proxy |
| 543 | proxy: |
| 544 | enabled: true |
| 545 | http: http://maas-01:8080 |
| 546 | https: http://maas-01:8080 |
| 547 | ... |
| 548 | proxy: |
Oleksandr Vlasov | 27a6c3a | 2017-04-11 16:01:19 -0600 | [diff] [blame] | 549 | # package manager fallback defaults |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 550 | # used if linux:system:repo:apt-mk:proxy has no protocol specific entries |
| 551 | pkg: |
| 552 | enabled: true |
| 553 | ftp: ftp://proxy.host.local:2121 |
| 554 | #http: http://proxy.host.local:3142 |
| 555 | #https: https://proxy.host.local:3143 |
Oleksandr Vlasov | 27a6c3a | 2017-04-11 16:01:19 -0600 | [diff] [blame] | 556 | ... |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 557 | # global system fallback system defaults |
| 558 | ftp: ftp://proxy.host.local:2121 |
| 559 | http: http://proxy.host.local:3142 |
| 560 | https: https://proxy.host.local:3143 |
| 561 | |
| 562 | |
Jiri Broulik | 34a29b4 | 2017-04-25 14:42:54 +0200 | [diff] [blame] | 563 | Remove all repositories: |
| 564 | |
| 565 | .. code-block:: yaml |
| 566 | |
| 567 | linux: |
| 568 | system: |
| 569 | purge_repos: true |
| 570 | |
| 571 | |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 572 | RC |
| 573 | ~~ |
| 574 | |
Jakub Pavlik | 7885938 | 2016-01-21 11:26:39 +0100 | [diff] [blame] | 575 | rc.local example |
| 576 | |
| 577 | .. code-block:: yaml |
| 578 | |
| 579 | linux: |
| 580 | system: |
| 581 | rc: |
| 582 | local: | |
| 583 | #!/bin/sh -e |
| 584 | # |
| 585 | # rc.local |
| 586 | # |
| 587 | # This script is executed at the end of each multiuser runlevel. |
| 588 | # Make sure that the script will "exit 0" on success or any other |
| 589 | # value on error. |
| 590 | # |
| 591 | # In order to enable or disable this script just change the execution |
| 592 | # bits. |
| 593 | # |
| 594 | # By default this script does nothing. |
| 595 | exit 0 |
| 596 | |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 597 | |
Filip Pytloun | 1f40dac | 2016-01-22 15:52:57 +0100 | [diff] [blame] | 598 | Prompt |
| 599 | ~~~~~~ |
| 600 | |
| 601 | Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every |
| 602 | user can have different prompt. |
| 603 | |
| 604 | .. code-block:: yaml |
| 605 | |
| 606 | linux: |
| 607 | system: |
| 608 | prompt: |
| 609 | 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\\] |
| 610 | default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w] |
| 611 | |
| 612 | On Debian systems to set prompt system-wide it's necessary to remove setting |
| 613 | PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from |
| 614 | ``/etc/skel/.bashrc``). This formula will do this automatically, but will not |
Filip Pytloun | d9b68da | 2016-01-22 15:58:41 +0100 | [diff] [blame] | 615 | touch existing user's ``~/.bashrc`` files except root. |
Jakub Pavlik | 7885938 | 2016-01-21 11:26:39 +0100 | [diff] [blame] | 616 | |
Filip Pytloun | eef11c1 | 2016-03-25 11:00:23 +0100 | [diff] [blame] | 617 | Bash |
| 618 | ~~~~ |
| 619 | |
| 620 | Fix bash configuration to preserve history across sessions (like ZSH does by |
| 621 | default). |
| 622 | |
| 623 | .. code-block:: yaml |
| 624 | |
| 625 | linux: |
| 626 | system: |
| 627 | bash: |
| 628 | preserve_history: true |
| 629 | |
Filip Pytloun | e874dfb | 2016-01-22 16:57:34 +0100 | [diff] [blame] | 630 | Message of the day |
| 631 | ~~~~~~~~~~~~~~~~~~ |
| 632 | |
| 633 | ``pam_motd`` from package ``update-motd`` is used for dynamic messages of the |
| 634 | day. Setting custom motd will cleanup existing ones. |
| 635 | |
| 636 | .. code-block:: yaml |
| 637 | |
| 638 | linux: |
| 639 | system: |
| 640 | motd: |
| 641 | - release: | |
| 642 | #!/bin/sh |
| 643 | [ -r /etc/lsb-release ] && . /etc/lsb-release |
| 644 | |
| 645 | if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then |
| 646 | # Fall back to using the very slow lsb_release utility |
| 647 | DISTRIB_DESCRIPTION=$(lsb_release -s -d) |
| 648 | fi |
| 649 | |
| 650 | printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)" |
| 651 | - warning: | |
| 652 | #!/bin/sh |
| 653 | printf "This is [company name] network.\n" |
| 654 | printf "Unauthorized access strictly prohibited.\n" |
| 655 | |
Marek Celoud | 713e907 | 2017-05-18 15:20:25 +0200 | [diff] [blame] | 656 | Services |
| 657 | ~~~~~~~~ |
| 658 | |
| 659 | Stop and disable linux service: |
| 660 | |
| 661 | .. code-block:: yaml |
| 662 | |
| 663 | linux: |
| 664 | system: |
| 665 | service: |
| 666 | apt-daily.timer: |
| 667 | status: dead |
| 668 | |
| 669 | Possible status is dead (disable service by default), running (enable service by default), enabled, disabled. |
| 670 | |
Filip Pytloun | 2f70b49 | 2016-02-19 15:55:25 +0100 | [diff] [blame] | 671 | RHEL / CentOS |
Filip Pytloun | 8296bb9 | 2016-02-19 18:42:09 +0100 | [diff] [blame] | 672 | ^^^^^^^^^^^^^ |
Filip Pytloun | 2f70b49 | 2016-02-19 15:55:25 +0100 | [diff] [blame] | 673 | |
| 674 | Unfortunately ``update-motd`` is currently not available for RHEL so there's |
| 675 | no native support for dynamic motd. |
| 676 | You can still set static one, only pillar structure differs: |
| 677 | |
| 678 | .. code-block:: yaml |
| 679 | |
| 680 | linux: |
| 681 | system: |
| 682 | motd: | |
| 683 | This is [company name] network. |
| 684 | Unauthorized access strictly prohibited. |
| 685 | |
Filip Pytloun | 8296bb9 | 2016-02-19 18:42:09 +0100 | [diff] [blame] | 686 | Haveged |
| 687 | ~~~~~~~ |
| 688 | |
| 689 | If you are running headless server and are low on entropy, it may be a good |
| 690 | idea to setup Haveged. |
| 691 | |
| 692 | .. code-block:: yaml |
| 693 | |
| 694 | linux: |
| 695 | system: |
| 696 | haveged: |
| 697 | enabled: true |
| 698 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 699 | Linux network |
| 700 | ------------- |
| 701 | |
| 702 | Linux with network manager |
| 703 | |
| 704 | .. code-block:: yaml |
| 705 | |
| 706 | linux: |
| 707 | network: |
| 708 | enabled: true |
| 709 | network_manager: true |
| 710 | |
| 711 | Linux with default static network interfaces, default gateway interface and DNS servers |
| 712 | |
| 713 | .. code-block:: yaml |
| 714 | |
| 715 | linux: |
| 716 | network: |
| 717 | enabled: true |
| 718 | interface: |
| 719 | eth0: |
| 720 | enabled: true |
| 721 | type: eth |
| 722 | address: 192.168.0.102 |
| 723 | netmask: 255.255.255.0 |
| 724 | gateway: 192.168.0.1 |
| 725 | name_servers: |
| 726 | - 8.8.8.8 |
| 727 | - 8.8.4.4 |
| 728 | mtu: 1500 |
| 729 | |
jan kaufman | 6d30adf | 2016-01-18 17:30:12 +0100 | [diff] [blame] | 730 | Linux with bonded interfaces and disabled NetworkManager |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 731 | |
| 732 | .. code-block:: yaml |
| 733 | |
| 734 | linux: |
| 735 | network: |
| 736 | enabled: true |
| 737 | interface: |
| 738 | eth0: |
| 739 | type: eth |
| 740 | ... |
| 741 | eth1: |
| 742 | type: eth |
| 743 | ... |
| 744 | bond0: |
| 745 | enabled: true |
| 746 | type: bond |
| 747 | address: 192.168.0.102 |
| 748 | netmask: 255.255.255.0 |
| 749 | mtu: 1500 |
| 750 | use_in: |
| 751 | - interface: ${linux:interface:eth0} |
| 752 | - interface: ${linux:interface:eth0} |
jan kaufman | 6d30adf | 2016-01-18 17:30:12 +0100 | [diff] [blame] | 753 | network_manager: |
| 754 | disable: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 755 | |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 756 | Linux with vlan interface_params |
| 757 | |
| 758 | .. code-block:: yaml |
| 759 | |
| 760 | linux: |
| 761 | network: |
| 762 | enabled: true |
| 763 | interface: |
| 764 | vlan69: |
| 765 | type: vlan |
jan kaufman | c0bd76f | 2015-12-15 16:45:44 +0100 | [diff] [blame] | 766 | use_interfaces: |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 767 | - interface: ${linux:interface:bond0} |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 768 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 769 | Linux with wireless interface parameters |
| 770 | |
| 771 | .. code-block:: yaml |
| 772 | |
| 773 | linux: |
| 774 | network: |
| 775 | enabled: true |
| 776 | gateway: 10.0.0.1 |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 777 | default_interface: eth0 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 778 | interface: |
| 779 | wlan0: |
| 780 | type: eth |
| 781 | wireless: |
| 782 | essid: example |
| 783 | key: example_key |
| 784 | security: wpa |
| 785 | priority: 1 |
| 786 | |
| 787 | Linux networks with routes defined |
| 788 | |
| 789 | .. code-block:: yaml |
| 790 | |
| 791 | linux: |
| 792 | network: |
| 793 | enabled: true |
| 794 | gateway: 10.0.0.1 |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 795 | default_interface: eth0 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 796 | interface: |
| 797 | eth0: |
| 798 | type: eth |
| 799 | route: |
| 800 | default: |
| 801 | address: 192.168.0.123 |
| 802 | netmask: 255.255.255.0 |
| 803 | gateway: 192.168.0.1 |
| 804 | |
| 805 | Native Linux Bridges |
| 806 | |
| 807 | .. code-block:: yaml |
| 808 | |
| 809 | linux: |
| 810 | network: |
| 811 | interface: |
| 812 | eth1: |
| 813 | enabled: true |
| 814 | type: eth |
| 815 | proto: manual |
| 816 | up_cmds: |
| 817 | - ip address add 0/0 dev $IFACE |
| 818 | - ip link set $IFACE up |
| 819 | down_cmds: |
| 820 | - ip link set $IFACE down |
| 821 | br-ex: |
| 822 | enabled: true |
| 823 | type: bridge |
| 824 | address: ${linux:network:host:public_local:address} |
| 825 | netmask: 255.255.255.0 |
| 826 | use_interfaces: |
| 827 | - eth1 |
| 828 | |
| 829 | OpenVswitch Bridges |
| 830 | |
| 831 | .. code-block:: yaml |
| 832 | |
| 833 | linux: |
| 834 | network: |
| 835 | bridge: openvswitch |
| 836 | interface: |
| 837 | eth1: |
| 838 | enabled: true |
| 839 | type: eth |
| 840 | proto: manual |
| 841 | up_cmds: |
| 842 | - ip address add 0/0 dev $IFACE |
| 843 | - ip link set $IFACE up |
| 844 | down_cmds: |
| 845 | - ip link set $IFACE down |
| 846 | br-ex: |
| 847 | enabled: true |
| 848 | type: bridge |
| 849 | address: ${linux:network:host:public_local:address} |
| 850 | netmask: 255.255.255.0 |
| 851 | use_interfaces: |
| 852 | - eth1 |
| 853 | |
Petr Jediný | 8f8ae54 | 2017-07-13 16:19:12 +0200 | [diff] [blame] | 854 | Debian manual proto interfaces |
| 855 | |
| 856 | When you are changing interface proto from static in up state to manual, you |
| 857 | may need to flush ip addresses. For example, if you want to use the interface |
| 858 | and the ip on the bridge. This can be done by setting the ``ipflush_onchange`` |
| 859 | to true. |
| 860 | |
| 861 | .. code-block:: yaml |
| 862 | |
| 863 | linux: |
| 864 | network: |
| 865 | interface: |
| 866 | eth1: |
| 867 | enabled: true |
| 868 | type: eth |
| 869 | proto: manual |
| 870 | mtu: 9100 |
| 871 | ipflush_onchange: true |
| 872 | |
| 873 | |
Petr Jediný | d577cb5 | 2017-06-28 20:17:49 +0200 | [diff] [blame] | 874 | Concatinating and removing interface files |
| 875 | |
| 876 | Debian based distributions have `/etc/network/interfaces.d/` directory, where |
| 877 | you can store configuration of network interfaces in separate files. You can |
| 878 | concatinate the files to the defined destination when needed, this operation |
| 879 | removes the file from the `/etc/network/interfaces.d/`. If you just need to |
| 880 | remove iface files, you can use the `remove_iface_files` key. |
| 881 | |
| 882 | .. code-block:: yaml |
| 883 | |
| 884 | linux: |
| 885 | network: |
| 886 | concat_iface_files: |
| 887 | - src: '/etc/network/interfaces.d/50-cloud-init.cfg' |
| 888 | dst: '/etc/network/interfaces' |
| 889 | remove_iface_files: |
| 890 | - '/etc/network/interfaces.d/90-custom.cfg' |
| 891 | |
| 892 | |
Oleksandr Vlasov | 27a6c3a | 2017-04-11 16:01:19 -0600 | [diff] [blame] | 893 | DHCP client configuration |
| 894 | |
| 895 | None of the keys is mandatory, include only those you really need. For full list |
| 896 | of available options under send, supersede, prepend, append refer to dhcp-options(5) |
| 897 | |
| 898 | .. code-block:: yaml |
| 899 | |
| 900 | linux: |
| 901 | network: |
| 902 | dhclient: |
| 903 | enabled: true |
| 904 | backoff_cutoff: 15 |
| 905 | initial_interval: 10 |
| 906 | reboot: 10 |
| 907 | retry: 60 |
| 908 | select_timeout: 0 |
| 909 | timeout: 120 |
| 910 | send: |
| 911 | - option: host-name |
| 912 | declaration: "= gethostname()" |
| 913 | supersede: |
| 914 | - option: host-name |
| 915 | declaration: "spaceship" |
| 916 | - option: domain-name |
| 917 | declaration: "domain.home" |
| 918 | #- option: arp-cache-timeout |
| 919 | # declaration: 20 |
| 920 | prepend: |
| 921 | - option: domain-name-servers |
| 922 | declaration: |
| 923 | - 8.8.8.8 |
| 924 | - 8.8.4.4 |
| 925 | - option: domain-search |
| 926 | declaration: |
| 927 | - example.com |
| 928 | - eng.example.com |
| 929 | #append: |
| 930 | #- option: domain-name-servers |
| 931 | # declaration: 127.0.0.1 |
| 932 | # ip or subnet to reject dhcp offer from |
| 933 | reject: |
| 934 | - 192.33.137.209 |
| 935 | - 10.0.2.0/24 |
| 936 | request: |
| 937 | - subnet-mask |
| 938 | - broadcast-address |
| 939 | - time-offset |
| 940 | - routers |
| 941 | - domain-name |
| 942 | - domain-name-servers |
| 943 | - domain-search |
| 944 | - host-name |
| 945 | - dhcp6.name-servers |
| 946 | - dhcp6.domain-search |
| 947 | - dhcp6.fqdn |
| 948 | - dhcp6.sntp-servers |
| 949 | - netbios-name-servers |
| 950 | - netbios-scope |
| 951 | - interface-mtu |
| 952 | - rfc3442-classless-static-routes |
| 953 | - ntp-servers |
| 954 | require: |
| 955 | - subnet-mask |
| 956 | - domain-name-servers |
| 957 | # if per interface configuration required add below |
| 958 | interface: |
| 959 | ens2: |
| 960 | initial_interval: 11 |
| 961 | reject: |
| 962 | - 192.33.137.210 |
| 963 | ens3: |
| 964 | initial_interval: 12 |
| 965 | reject: |
| 966 | - 192.33.137.211 |
| 967 | |
| 968 | |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 969 | Configure global environment variables |
| 970 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 971 | |
| 972 | Linux /etc/environment: |
| 973 | ``/etc/environment`` is for static system wide variable assignment after boot. Variable expansion is frequently not supported. |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 974 | |
| 975 | .. code-block:: yaml |
| 976 | |
| 977 | linux: |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 978 | system: |
| 979 | env: |
| 980 | BOB_VARIABLE: Alice |
| 981 | ... |
| 982 | BOB_PATH: |
| 983 | - /srv/alice/bin |
| 984 | - /srv/bob/bin |
| 985 | ... |
| 986 | ftp_proxy: none |
| 987 | http_proxy: http://global-http-proxy.host.local:8080 |
| 988 | https_proxy: ${linux:system:proxy:https} |
| 989 | no_proxy: |
| 990 | - 192.168.0.80 |
| 991 | - 192.168.1.80 |
| 992 | - .domain.com |
| 993 | - .local |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 994 | ... |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 995 | # NOTE: global defaults proxy configuration. |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 996 | proxy: |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 997 | ftp: ftp://proxy.host.local:2121 |
| 998 | http: http://proxy.host.local:3142 |
| 999 | https: https://proxy.host.local:3143 |
| 1000 | noproxy: |
| 1001 | - .domain.com |
| 1002 | - .local |
| 1003 | |
| 1004 | Configure profile.d scripts |
| 1005 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1006 | |
| 1007 | Linux /etc/profile.d: |
| 1008 | The profile.d scripts are being sourced during .sh execution and support variable expansion in opposite to /etc/environment |
| 1009 | global settings in ``/etc/environment``. |
| 1010 | |
| 1011 | .. code-block:: yaml |
| 1012 | |
| 1013 | linux: |
| 1014 | system: |
| 1015 | profile: |
| 1016 | locales: | |
| 1017 | export LANG=C |
| 1018 | export LC_ALL=C |
| 1019 | ... |
| 1020 | vi_flavors.sh: | |
| 1021 | export PAGER=view |
| 1022 | export EDITOR=vim |
| 1023 | alias vi=vim |
| 1024 | shell_locales.sh: | |
| 1025 | export LANG=en_US |
| 1026 | export LC_ALL=en_US.UTF-8 |
| 1027 | shell_proxies.sh: | |
| 1028 | export FTP_PROXY=ftp://127.0.3.3:2121 |
| 1029 | export NO_PROXY='.local' |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1030 | |
| 1031 | Linux with hosts |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1032 | ~~~~~~~~~~~~~~~~ |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1033 | |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1034 | Parameter purge_hosts will enforce whole /etc/hosts file, removing entries |
| 1035 | that are not defined in model except defaults for both IPv4 and IPv6 localhost |
| 1036 | and hostname + fqdn. |
| 1037 | It's good to use this option if you want to ensure /etc/hosts is always in a |
| 1038 | clean state however it's not enabled by default for safety. |
| 1039 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1040 | .. code-block:: yaml |
| 1041 | |
| 1042 | linux: |
| 1043 | network: |
| 1044 | ... |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1045 | purge_hosts: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1046 | host: |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1047 | # No need to define this one if purge_hosts is true |
| 1048 | hostname: |
| 1049 | address: 127.0.1.1 |
| 1050 | names: |
| 1051 | - ${linux:network:fqdn} |
| 1052 | - ${linux:network:hostname} |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1053 | node1: |
| 1054 | address: 192.168.10.200 |
| 1055 | names: |
| 1056 | - node2.domain.com |
| 1057 | - service2.domain.com |
| 1058 | node2: |
| 1059 | address: 192.168.10.201 |
| 1060 | names: |
| 1061 | - node2.domain.com |
| 1062 | - service2.domain.com |
| 1063 | |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1064 | |
Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 1065 | Setup resolv.conf, nameservers, domain and search domains |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1066 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 1067 | |
| 1068 | .. code-block:: yaml |
| 1069 | |
| 1070 | linux: |
| 1071 | network: |
| 1072 | resolv: |
| 1073 | dns: |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1074 | - 8.8.4.4 |
| 1075 | - 8.8.8.8 |
Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 1076 | domain: my.example.com |
| 1077 | search: |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1078 | - my.example.com |
| 1079 | - example.com |
Marek Celoud | f6cd192 | 2016-12-05 13:39:49 +0100 | [diff] [blame] | 1080 | options: |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1081 | - ndots: 5 |
| 1082 | - timeout: 2 |
| 1083 | - attempts: 2 |
Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 1084 | |
Andrii Petrenko | 735761d | 2017-03-21 17:17:35 -0700 | [diff] [blame] | 1085 | **setting custom TX queue length for tap interfaces** |
| 1086 | |
| 1087 | .. code-block:: yaml |
| 1088 | |
| 1089 | linux: |
| 1090 | network: |
| 1091 | tap_custom_txqueuelen: 10000 |
| 1092 | |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1093 | DPDK OVS interfaces |
| 1094 | -------------------- |
| 1095 | |
| 1096 | **DPDK OVS NIC** |
| 1097 | |
| 1098 | .. code-block:: yaml |
| 1099 | |
| 1100 | linux: |
| 1101 | network: |
| 1102 | bridge: openvswitch |
| 1103 | dpdk: |
| 1104 | enabled: true |
Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1105 | driver: uio/vfio |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1106 | openvswitch: |
| 1107 | pmd_cpu_mask: "0x6" |
| 1108 | dpdk_socket_mem: "1024,1024" |
| 1109 | dpdk_lcore_mask: "0x400" |
| 1110 | memory_channels: 2 |
| 1111 | interface: |
| 1112 | dpkd0: |
| 1113 | name: ${_param:dpdk_nic} |
| 1114 | pci: 0000:06:00.0 |
Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1115 | driver: igb_uio/vfio-pci |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1116 | enabled: true |
| 1117 | type: dpdk_ovs_port |
| 1118 | n_rxq: 2 |
Oleg Bondarev | 43dbbd3 | 2017-05-24 17:06:19 +0400 | [diff] [blame] | 1119 | pmd_rxq_affinity: "0:1,1:2" |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1120 | bridge: br-prv |
Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1121 | mtu: 9000 |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1122 | br-prv: |
| 1123 | enabled: true |
| 1124 | type: dpdk_ovs_bridge |
| 1125 | |
| 1126 | **DPDK OVS Bond** |
| 1127 | |
| 1128 | .. code-block:: yaml |
| 1129 | |
| 1130 | linux: |
| 1131 | network: |
| 1132 | bridge: openvswitch |
| 1133 | dpdk: |
| 1134 | enabled: true |
Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1135 | driver: uio/vfio |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1136 | openvswitch: |
| 1137 | pmd_cpu_mask: "0x6" |
| 1138 | dpdk_socket_mem: "1024,1024" |
| 1139 | dpdk_lcore_mask: "0x400" |
| 1140 | memory_channels: 2 |
| 1141 | interface: |
| 1142 | dpdk_second_nic: |
| 1143 | name: ${_param:primary_second_nic} |
| 1144 | pci: 0000:06:00.0 |
Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1145 | driver: igb_uio/vfio-pci |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1146 | bond: dpdkbond0 |
| 1147 | enabled: true |
| 1148 | type: dpdk_ovs_port |
| 1149 | n_rxq: 2 |
Oleg Bondarev | 43dbbd3 | 2017-05-24 17:06:19 +0400 | [diff] [blame] | 1150 | pmd_rxq_affinity: "0:1,1:2" |
Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1151 | mtu: 9000 |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1152 | dpdk_first_nic: |
| 1153 | name: ${_param:primary_first_nic} |
| 1154 | pci: 0000:05:00.0 |
Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1155 | driver: igb_uio/vfio-pci |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1156 | bond: dpdkbond0 |
| 1157 | enabled: true |
| 1158 | type: dpdk_ovs_port |
| 1159 | n_rxq: 2 |
Oleg Bondarev | 43dbbd3 | 2017-05-24 17:06:19 +0400 | [diff] [blame] | 1160 | pmd_rxq_affinity: "0:1,1:2" |
Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1161 | mtu: 9000 |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1162 | dpdkbond0: |
| 1163 | enabled: true |
| 1164 | bridge: br-prv |
| 1165 | type: dpdk_ovs_bond |
| 1166 | mode: active-backup |
| 1167 | br-prv: |
| 1168 | enabled: true |
| 1169 | type: dpdk_ovs_bridge |
| 1170 | |
Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1171 | **DPDK OVS bridge for VXLAN** |
| 1172 | |
| 1173 | If VXLAN is used as tenant segmentation then ip address must be set on br-prv |
| 1174 | |
| 1175 | .. code-block:: yaml |
| 1176 | |
| 1177 | linux: |
| 1178 | network: |
| 1179 | ... |
| 1180 | interface: |
| 1181 | br-prv: |
| 1182 | enabled: true |
| 1183 | type: dpdk_ovs_bridge |
| 1184 | address: 192.168.50.0 |
| 1185 | netmask: 255.255.255.0 |
| 1186 | mtu: 9000 |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1187 | |
| 1188 | Linux storage |
| 1189 | ------------- |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1190 | |
| 1191 | Linux with mounted Samba |
| 1192 | |
| 1193 | .. code-block:: yaml |
| 1194 | |
| 1195 | linux: |
| 1196 | storage: |
| 1197 | enabled: true |
| 1198 | mount: |
| 1199 | samba1: |
Simon Pasquier | 376262a | 2016-11-16 15:21:51 +0100 | [diff] [blame] | 1200 | - enabled: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1201 | - path: /media/myuser/public/ |
| 1202 | - device: //192.168.0.1/storage |
| 1203 | - file_system: cifs |
| 1204 | - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm |
| 1205 | |
Jiri Broulik | b017f93 | 2017-03-31 13:55:36 +0200 | [diff] [blame] | 1206 | NFS mount |
| 1207 | |
| 1208 | .. code-block:: yaml |
| 1209 | |
| 1210 | linux: |
| 1211 | storage: |
| 1212 | enabled: true |
| 1213 | mount: |
| 1214 | nfs_glance: |
| 1215 | enabled: true |
| 1216 | path: /var/lib/glance/images |
| 1217 | device: 172.16.10.110:/var/nfs/glance |
| 1218 | file_system: nfs |
| 1219 | opts: rw,sync |
| 1220 | |
| 1221 | |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1222 | File swap configuration |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1223 | |
| 1224 | .. code-block:: yaml |
| 1225 | |
| 1226 | linux: |
| 1227 | storage: |
| 1228 | enabled: true |
| 1229 | swap: |
| 1230 | file: |
| 1231 | enabled: true |
| 1232 | engine: file |
| 1233 | device: /swapfile |
| 1234 | size: 1024 |
| 1235 | |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1236 | Partition swap configuration |
Lachlan Evenson | 3067651 | 2016-01-22 15:43:28 -0800 | [diff] [blame] | 1237 | |
| 1238 | .. code-block:: yaml |
| 1239 | |
| 1240 | linux: |
| 1241 | storage: |
| 1242 | enabled: true |
| 1243 | swap: |
| 1244 | partition: |
| 1245 | enabled: true |
| 1246 | engine: partition |
| 1247 | device: /dev/vg0/swap |
| 1248 | |
Filip Pytloun | c8a001a | 2015-12-15 14:09:19 +0100 | [diff] [blame] | 1249 | LVM group `vg1` with one device and `data` volume mounted into `/mnt/data` |
| 1250 | |
| 1251 | .. code-block:: yaml |
| 1252 | |
| 1253 | parameters: |
| 1254 | linux: |
| 1255 | storage: |
| 1256 | mount: |
| 1257 | data: |
Simon Pasquier | 376262a | 2016-11-16 15:21:51 +0100 | [diff] [blame] | 1258 | enabled: true |
Filip Pytloun | c8a001a | 2015-12-15 14:09:19 +0100 | [diff] [blame] | 1259 | device: /dev/vg1/data |
| 1260 | file_system: ext4 |
| 1261 | path: /mnt/data |
| 1262 | lvm: |
| 1263 | vg1: |
| 1264 | enabled: true |
| 1265 | devices: |
| 1266 | - /dev/sdb |
| 1267 | volume: |
| 1268 | data: |
| 1269 | size: 40G |
| 1270 | mount: ${linux:storage:mount:data} |
| 1271 | |
Jakub Pavlik | 4f74214 | 2017-08-08 15:05:50 +0200 | [diff] [blame] | 1272 | Create partitions on disk. Specify size in MB. It expects empty |
| 1273 | disk without any existing partitions. |
| 1274 | |
| 1275 | .. code-block:: yaml |
| 1276 | |
| 1277 | linux: |
| 1278 | storage: |
| 1279 | disk: |
| 1280 | first_drive: |
| 1281 | name: /dev/loop1 |
| 1282 | type: gpt |
| 1283 | partitions: |
| 1284 | - size: 200 #size in MB |
| 1285 | type: fat32 |
| 1286 | - size: 300 #size in MB |
Jakub Pavlik | 8e2140a | 2017-08-14 23:29:57 +0200 | [diff] [blame^] | 1287 | mkfs: True |
| 1288 | type: xfs |
Jakub Pavlik | 4f74214 | 2017-08-08 15:05:50 +0200 | [diff] [blame] | 1289 | /dev/vda1: |
| 1290 | partitions: |
| 1291 | - size: 5 |
| 1292 | type: ext2 |
| 1293 | - size: 10 |
| 1294 | type: ext4 |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 1295 | |
| 1296 | Multipath with Fujitsu Eternus DXL |
| 1297 | |
| 1298 | .. code-block:: yaml |
| 1299 | |
| 1300 | parameters: |
| 1301 | linux: |
| 1302 | storage: |
| 1303 | multipath: |
| 1304 | enabled: true |
| 1305 | blacklist_devices: |
| 1306 | - /dev/sda |
| 1307 | - /dev/sdb |
| 1308 | backends: |
| 1309 | - fujitsu_eternus_dxl |
| 1310 | |
| 1311 | Multipath with Hitachi VSP 1000 |
| 1312 | |
| 1313 | .. code-block:: yaml |
| 1314 | |
| 1315 | parameters: |
| 1316 | linux: |
| 1317 | storage: |
| 1318 | multipath: |
| 1319 | enabled: true |
| 1320 | blacklist_devices: |
| 1321 | - /dev/sda |
| 1322 | - /dev/sdb |
| 1323 | backends: |
| 1324 | - hitachi_vsp1000 |
| 1325 | |
| 1326 | Multipath with IBM Storwize |
| 1327 | |
| 1328 | .. code-block:: yaml |
| 1329 | |
| 1330 | parameters: |
| 1331 | linux: |
| 1332 | storage: |
| 1333 | multipath: |
| 1334 | enabled: true |
| 1335 | blacklist_devices: |
| 1336 | - /dev/sda |
| 1337 | - /dev/sdb |
| 1338 | backends: |
| 1339 | - ibm_storwize |
| 1340 | |
| 1341 | Multipath with multiple backends |
| 1342 | |
| 1343 | .. code-block:: yaml |
| 1344 | |
| 1345 | parameters: |
| 1346 | linux: |
| 1347 | storage: |
| 1348 | multipath: |
| 1349 | enabled: true |
| 1350 | blacklist_devices: |
| 1351 | - /dev/sda |
| 1352 | - /dev/sdb |
| 1353 | - /dev/sdc |
| 1354 | - /dev/sdd |
| 1355 | backends: |
| 1356 | - ibm_storwize |
| 1357 | - fujitsu_eternus_dxl |
| 1358 | - hitachi_vsp1000 |
| 1359 | |
| 1360 | Disabled multipath (the default setup) |
| 1361 | |
| 1362 | .. code-block:: yaml |
| 1363 | |
| 1364 | parameters: |
| 1365 | linux: |
| 1366 | storage: |
| 1367 | multipath: |
| 1368 | enabled: false |
| 1369 | |
Simon Pasquier | 375001e | 2017-01-26 13:22:33 +0100 | [diff] [blame] | 1370 | Linux with local loopback device |
| 1371 | |
| 1372 | .. code-block:: yaml |
| 1373 | |
| 1374 | linux: |
| 1375 | storage: |
| 1376 | loopback: |
| 1377 | disk1: |
| 1378 | file: /srv/disk1 |
| 1379 | size: 50G |
| 1380 | |
Filip Pytloun | b2c8f85 | 2016-11-21 17:03:43 +0100 | [diff] [blame] | 1381 | External config generation |
| 1382 | -------------------------- |
| 1383 | |
| 1384 | You are able to use config support metadata between formulas and only generate |
| 1385 | config files for external use, eg. docker, etc. |
| 1386 | |
| 1387 | .. code-block:: yaml |
| 1388 | |
| 1389 | parameters: |
| 1390 | linux: |
| 1391 | system: |
| 1392 | config: |
| 1393 | pillar: |
| 1394 | jenkins: |
| 1395 | master: |
| 1396 | home: /srv/volumes/jenkins |
| 1397 | approved_scripts: |
| 1398 | - method java.net.URL openConnection |
| 1399 | credentials: |
| 1400 | - type: username_password |
| 1401 | scope: global |
| 1402 | id: test |
| 1403 | desc: Testing credentials |
| 1404 | username: test |
| 1405 | password: test |
| 1406 | |
Vladimir Eremin | ccf2884 | 2017-04-10 23:52:10 +0300 | [diff] [blame] | 1407 | Netconsole Remote Kernel Logging |
| 1408 | -------------------------------- |
| 1409 | |
| 1410 | Netconsole logger could be configured for configfs-enabled kernels |
| 1411 | (`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in |
| 1412 | runtime (if network is already configured), and on-boot after interface |
| 1413 | initialization. Notes: |
| 1414 | |
| 1415 | * receiver could be located only in same L3 domain |
| 1416 | (or you need to configure gateway MAC manually) |
| 1417 | * receiver's MAC is detected only on configuration time |
| 1418 | * using broadcast MAC is not recommended |
| 1419 | |
| 1420 | .. code-block:: yaml |
| 1421 | |
| 1422 | parameters: |
| 1423 | linux: |
| 1424 | system: |
| 1425 | netconsole: |
| 1426 | enabled: true |
| 1427 | port: 514 (optional) |
| 1428 | loglevel: debug (optional) |
| 1429 | target: |
| 1430 | 192.168.0.1: |
| 1431 | interface: bond0 |
| 1432 | mac: "ff:ff:ff:ff:ff:ff" (optional) |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 1433 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1434 | Usage |
| 1435 | ===== |
| 1436 | |
| 1437 | Set mtu of network interface eth0 to 1400 |
| 1438 | |
| 1439 | .. code-block:: bash |
| 1440 | |
| 1441 | ip link set dev eth0 mtu 1400 |
| 1442 | |
| 1443 | Read more |
| 1444 | ========= |
| 1445 | |
| 1446 | * https://www.archlinux.org/ |
| 1447 | * 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] | 1448 | |
| 1449 | Documentation and Bugs |
| 1450 | ====================== |
| 1451 | |
| 1452 | To learn how to install and update salt-formulas, consult the documentation |
| 1453 | available online at: |
| 1454 | |
| 1455 | http://salt-formulas.readthedocs.io/ |
| 1456 | |
| 1457 | In the unfortunate event that bugs are discovered, they should be reported to |
| 1458 | the appropriate issue tracker. Use Github issue tracker for specific salt |
| 1459 | formula: |
| 1460 | |
| 1461 | https://github.com/salt-formulas/salt-formula-linux/issues |
| 1462 | |
| 1463 | For feature requests, bug reports or blueprints affecting entire ecosystem, |
| 1464 | use Launchpad salt-formulas project: |
| 1465 | |
| 1466 | https://launchpad.net/salt-formulas |
| 1467 | |
| 1468 | You can also join salt-formulas-users team and subscribe to mailing list: |
| 1469 | |
| 1470 | https://launchpad.net/~salt-formulas-users |
| 1471 | |
| 1472 | Developers wishing to work on the salt-formulas projects should always base |
| 1473 | their work on master branch and submit pull request against specific formula. |
| 1474 | |
| 1475 | https://github.com/salt-formulas/salt-formula-linux |
| 1476 | |
| 1477 | Any questions or feedback is always welcome so feel free to join our IRC |
| 1478 | channel: |
| 1479 | |
| 1480 | #salt-formulas @ irc.freenode.net |