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