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 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 5 | Linux Operating Systems: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 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 | Linux System |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 17 | ------------ |
| 18 | |
| 19 | Basic Linux box |
| 20 | |
| 21 | .. code-block:: yaml |
| 22 | |
| 23 | linux: |
| 24 | system: |
| 25 | enabled: true |
| 26 | name: 'node1' |
| 27 | domain: 'domain.com' |
| 28 | cluster: 'system' |
| 29 | environment: prod |
| 30 | timezone: 'Europe/Prague' |
| 31 | utc: true |
| 32 | |
azvyagintsev | 967af13 | 2017-06-12 12:25:24 +0300 | [diff] [blame] | 33 | Linux with system users, some with password set: |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 34 | |
| 35 | .. warning:: If no ``password`` variable is passed, |
| 36 | any predifined password will be removed. |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 37 | |
| 38 | .. code-block:: yaml |
| 39 | |
| 40 | linux: |
| 41 | system: |
| 42 | ... |
| 43 | user: |
| 44 | jdoe: |
| 45 | name: 'jdoe' |
| 46 | enabled: true |
| 47 | sudo: true |
| 48 | shell: /bin/bash |
| 49 | full_name: 'Jonh Doe' |
| 50 | home: '/home/jdoe' |
Martin Polreich | 4fcd5c0 | 2018-07-16 09:41:51 +0200 | [diff] [blame] | 51 | home_dir_mode: 755 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 52 | email: 'jonh@doe.com' |
Dzmitry Stremkouski | a0d8b2d | 2018-10-22 14:12:05 +0200 | [diff] [blame] | 53 | unique: false |
Dzmitry Stremkouski | fae59fb | 2018-11-21 10:10:10 +0100 | [diff] [blame] | 54 | groups: |
| 55 | - db-ops |
| 56 | - salt-ops |
| 57 | optional_groups: |
| 58 | - docker |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 59 | jsmith: |
| 60 | name: 'jsmith' |
| 61 | enabled: true |
azvyagintsev | 967af13 | 2017-06-12 12:25:24 +0300 | [diff] [blame] | 62 | full_name: 'With clear password' |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 63 | home: '/home/jsmith' |
azvyagintsev | 967af13 | 2017-06-12 12:25:24 +0300 | [diff] [blame] | 64 | hash_password: true |
| 65 | password: "userpassword" |
| 66 | mark: |
| 67 | name: 'mark' |
| 68 | enabled: true |
| 69 | full_name: "unchange password' |
| 70 | home: '/home/mark' |
| 71 | password: false |
| 72 | elizabeth: |
| 73 | name: 'elizabeth' |
| 74 | enabled: true |
| 75 | full_name: 'With hased password' |
| 76 | home: '/home/elizabeth' |
| 77 | password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10" |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 78 | |
Dmitry Teselkin | 47e41f4 | 2018-09-27 14:10:09 +0300 | [diff] [blame] | 79 | Configure password expiration parameters |
| 80 | ---------------------------------------- |
| 81 | The following login.defs parameters can be overridden per-user: |
| 82 | |
| 83 | * PASS_MAX_DAYS |
| 84 | * PASS_MIN_DAYS |
| 85 | * PASS_WARN_DAYS |
| 86 | * INACTIVE |
| 87 | |
| 88 | .. code-block:: yaml |
| 89 | |
| 90 | linux: |
| 91 | system: |
| 92 | ... |
| 93 | user: |
| 94 | jdoe: |
| 95 | name: 'jdoe' |
| 96 | enabled: true |
| 97 | ... |
| 98 | maxdays: <PASS_MAX_DAYS> |
| 99 | mindays: <PASS_MIN_DAYS> |
| 100 | warndays: <PASS_WARN_DAYS> |
| 101 | inactdays: <INACTIVE> |
| 102 | |
Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 103 | Configure sudo for users and groups under ``/etc/sudoers.d/``. |
| 104 | This ways ``linux.system.sudo`` pillar map to actual sudo attributes: |
| 105 | |
| 106 | .. code-block:: jinja |
Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 107 | |
Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 108 | # simplified template: |
| 109 | Cmds_Alias {{ alias }}={{ commands }} |
| 110 | {{ user }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }} |
| 111 | %{{ group }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }} |
| 112 | |
| 113 | # when rendered: |
| 114 | saltuser1 ALL=(ALL) NOPASSWD: ALL |
| 115 | |
Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 116 | .. code-block:: yaml |
Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 117 | |
Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 118 | linux: |
| 119 | system: |
| 120 | sudo: |
| 121 | enabled: true |
Tomas Kamm | d8eb300 | 2017-05-08 19:30:29 +0200 | [diff] [blame] | 122 | aliases: |
Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 123 | host: |
| 124 | LOCAL: |
| 125 | - localhost |
| 126 | PRODUCTION: |
| 127 | - db1 |
| 128 | - db2 |
| 129 | runas: |
| 130 | DBA: |
| 131 | - postgres |
| 132 | - mysql |
| 133 | SALT: |
| 134 | - root |
| 135 | command: |
| 136 | # Note: This is not 100% safe when ALL keyword is used, user still may modify configs and hide his actions. |
| 137 | # Best practice is to specify full list of commands user is allowed to run. |
| 138 | SUPPORT_RESTRICTED: |
| 139 | - /bin/vi /etc/sudoers* |
| 140 | - /bin/vim /etc/sudoers* |
| 141 | - /bin/nano /etc/sudoers* |
| 142 | - /bin/emacs /etc/sudoers* |
| 143 | - /bin/su - root |
| 144 | - /bin/su - |
| 145 | - /bin/su |
| 146 | - /usr/sbin/visudo |
| 147 | SUPPORT_SHELLS: |
| 148 | - /bin/sh |
| 149 | - /bin/ksh |
| 150 | - /bin/bash |
| 151 | - /bin/rbash |
| 152 | - /bin/dash |
| 153 | - /bin/zsh |
| 154 | - /bin/csh |
| 155 | - /bin/fish |
| 156 | - /bin/tcsh |
| 157 | - /usr/bin/login |
| 158 | - /usr/bin/su |
| 159 | - /usr/su |
| 160 | ALL_SALT_SAFE: |
| 161 | - /usr/bin/salt state* |
| 162 | - /usr/bin/salt service* |
| 163 | - /usr/bin/salt pillar* |
| 164 | - /usr/bin/salt grains* |
| 165 | - /usr/bin/salt saltutil* |
| 166 | - /usr/bin/salt-call state* |
| 167 | - /usr/bin/salt-call service* |
| 168 | - /usr/bin/salt-call pillar* |
| 169 | - /usr/bin/salt-call grains* |
| 170 | - /usr/bin/salt-call saltutil* |
| 171 | SALT_TRUSTED: |
| 172 | - /usr/bin/salt* |
| 173 | users: |
| 174 | # saltuser1 with default values: saltuser1 ALL=(ALL) NOPASSWD: ALL |
| 175 | saltuser1: {} |
| 176 | saltuser2: |
| 177 | hosts: |
| 178 | - LOCAL |
| 179 | # User Alias DBA |
| 180 | DBA: |
| 181 | hosts: |
| 182 | - ALL |
| 183 | commands: |
| 184 | - ALL_SALT_SAFE |
| 185 | groups: |
| 186 | db-ops: |
| 187 | hosts: |
| 188 | - ALL |
| 189 | - '!PRODUCTION' |
| 190 | runas: |
| 191 | - DBA |
| 192 | commands: |
| 193 | - /bin/cat * |
| 194 | - /bin/less * |
| 195 | - /bin/ls * |
| 196 | salt-ops: |
| 197 | hosts: |
| 198 | - 'ALL' |
| 199 | runas: |
| 200 | - SALT |
| 201 | commands: |
| 202 | - SUPPORT_SHELLS |
| 203 | salt-ops-2nd: |
| 204 | name: salt-ops |
| 205 | nopasswd: false |
Jakub Josef | 7a9d9b9 | 2017-05-16 11:39:01 +0200 | [diff] [blame] | 206 | setenv: true # Enable sudo -E option |
Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 207 | runas: |
| 208 | - DBA |
| 209 | commands: |
| 210 | - ALL |
| 211 | - '!SUPPORT_SHELLS' |
| 212 | - '!SUPPORT_RESTRICTED' |
| 213 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 214 | Linux with package, latest version: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 215 | |
| 216 | .. code-block:: yaml |
| 217 | |
| 218 | linux: |
| 219 | system: |
| 220 | ... |
| 221 | package: |
| 222 | package-name: |
| 223 | version: latest |
| 224 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 225 | Linux with package from certail repo, version with no upgrades: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 226 | |
| 227 | .. code-block:: yaml |
| 228 | |
| 229 | linux: |
| 230 | system: |
| 231 | ... |
| 232 | package: |
| 233 | package-name: |
| 234 | version: 2132.323 |
| 235 | repo: 'custom-repo' |
| 236 | hold: true |
| 237 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 238 | Linux with package from certail repo, version with no GPG |
| 239 | verification: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 240 | |
| 241 | .. code-block:: yaml |
| 242 | |
| 243 | linux: |
| 244 | system: |
| 245 | ... |
| 246 | package: |
| 247 | package-name: |
| 248 | version: 2132.323 |
| 249 | repo: 'custom-repo' |
| 250 | verify: false |
| 251 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 252 | Linux with autoupdates (automatically install security package |
| 253 | updates): |
Bruno Binet | 69a9d8d | 2017-02-16 22:34:32 +0100 | [diff] [blame] | 254 | |
| 255 | .. code-block:: yaml |
| 256 | |
| 257 | linux: |
| 258 | system: |
| 259 | ... |
| 260 | autoupdates: |
| 261 | enabled: true |
| 262 | mail: root@localhost |
| 263 | mail_only_on_error: true |
| 264 | remove_unused_dependencies: false |
| 265 | automatic_reboot: true |
| 266 | automatic_reboot_time: "02:00" |
| 267 | |
Dmitry Teselkin | 0f084a0 | 2018-08-29 14:46:38 +0300 | [diff] [blame] | 268 | Managing cron tasks |
| 269 | ------------------- |
| 270 | |
| 271 | There are two data structures that are related to managing cron itself and |
| 272 | cron tasks: |
| 273 | |
| 274 | .. code-block:: yaml |
| 275 | |
| 276 | linux: |
| 277 | system: |
| 278 | cron: |
| 279 | |
| 280 | and |
| 281 | |
| 282 | .. code-block:: yaml |
| 283 | |
| 284 | linux: |
| 285 | system: |
| 286 | job: |
| 287 | |
| 288 | `linux:system:cron` manages cron packages, services, and '/etc/cron.allow' file. |
| 289 | |
| 290 | 'deny' files are managed the only way - we're ensuring they are absent, that's |
| 291 | a requirement from CIS 5.1.8 |
| 292 | |
| 293 | 'cron' pillar structure is the following: |
| 294 | |
| 295 | .. code-block:: yaml |
| 296 | |
| 297 | linux: |
| 298 | system: |
| 299 | cron: |
| 300 | enabled: true |
| 301 | pkgs: [ <cron packages> ] |
| 302 | services: [ <cron services> ] |
| 303 | user: |
| 304 | <username>: |
| 305 | enabled: true |
| 306 | |
| 307 | To add user to '/etc/cron.allow' use 'enabled' key as shown above. |
| 308 | |
| 309 | '/etc/cron.deny' is not managed as CIS 5.1.8 requires it was removed. |
| 310 | |
| 311 | A user would be ignored if any of the following is true: |
| 312 | * user is disabled in `linux:system:user:<username>` |
| 313 | * user is disabled in `linux:system:cron:user:<username>` |
| 314 | |
| 315 | `linux:system:job` manages individual cron tasks. |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 316 | |
| 317 | By default, it will use name as an identifier, unless identifier key is |
Filip Pytloun | 9122222 | 2017-08-04 10:55:27 +0200 | [diff] [blame] | 318 | explicitly set or False (then it will use Salt's default behavior which is |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 319 | identifier same as command resulting in not being able to change it): |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 320 | |
| 321 | .. code-block:: yaml |
| 322 | |
| 323 | linux: |
| 324 | system: |
| 325 | ... |
| 326 | job: |
| 327 | cmd1: |
| 328 | command: '/cmd/to/run' |
Filip Pytloun | 9122222 | 2017-08-04 10:55:27 +0200 | [diff] [blame] | 329 | identifier: cmd1 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 330 | enabled: true |
| 331 | user: 'root' |
| 332 | hour: 2 |
| 333 | minute: 0 |
| 334 | |
Dmitry Teselkin | 0f084a0 | 2018-08-29 14:46:38 +0300 | [diff] [blame] | 335 | Managing 'at' tasks |
| 336 | ------------------- |
| 337 | |
| 338 | Pillar for managing `at` tasks is similar to one for `cron` tasks: |
| 339 | |
| 340 | .. code-block:: yaml |
| 341 | |
| 342 | linux: |
| 343 | system: |
| 344 | at: |
| 345 | enabled: true |
| 346 | pkgs: [ <at packages> ] |
| 347 | services: [ <at services> ] |
| 348 | user: |
| 349 | <username>: |
| 350 | enabled: true |
| 351 | |
| 352 | To add a user to '/etc/at.allow' use 'enabled' key as shown above. |
| 353 | |
| 354 | '/etc/at.deny' is not managed as CIS 5.1.8 requires it was removed. |
| 355 | |
| 356 | A user will be ignored if any of the following is true: |
| 357 | * user is disabled in `linux:system:user:<username>` |
| 358 | * user is disabled in `linux:system:at:user:<username>` |
| 359 | |
| 360 | |
Filip Pytloun | d0a29e7 | 2015-11-30 15:23:34 +0100 | [diff] [blame] | 361 | Linux security limits (limit sensu user memory usage to max 1GB): |
| 362 | |
| 363 | .. code-block:: yaml |
| 364 | |
| 365 | linux: |
| 366 | system: |
| 367 | ... |
| 368 | limit: |
| 369 | sensu: |
| 370 | enabled: true |
| 371 | domain: sensu |
| 372 | limits: |
| 373 | - type: hard |
| 374 | item: as |
| 375 | value: 1000000 |
| 376 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 377 | Enable autologin on ``tty1`` (may work only for Ubuntu 14.04): |
Filip Pytloun | 7fee054 | 2015-10-15 11:19:24 +0200 | [diff] [blame] | 378 | |
| 379 | .. code-block:: yaml |
| 380 | |
| 381 | linux: |
| 382 | system: |
| 383 | console: |
| 384 | tty1: |
| 385 | autologin: root |
Filip Pytloun | 281d020 | 2016-01-29 14:03:51 +0100 | [diff] [blame] | 386 | # Enable serial console |
| 387 | ttyS0: |
| 388 | autologin: root |
| 389 | rate: 115200 |
| 390 | term: xterm |
Filip Pytloun | 7fee054 | 2015-10-15 11:19:24 +0200 | [diff] [blame] | 391 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 392 | To disable set autologin to ``false``. |
Filip Pytloun | 7fee054 | 2015-10-15 11:19:24 +0200 | [diff] [blame] | 393 | |
Filip Pytloun | 7731b85 | 2016-02-01 11:13:47 +0100 | [diff] [blame] | 394 | Set ``policy-rc.d`` on Debian-based systems. Action can be any available |
| 395 | command in ``while true`` loop and ``case`` context. |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 396 | Following will disallow dpkg to stop/start services for the Cassandra |
| 397 | package automatically: |
Filip Pytloun | 7731b85 | 2016-02-01 11:13:47 +0100 | [diff] [blame] | 398 | |
| 399 | .. code-block:: yaml |
| 400 | |
| 401 | linux: |
| 402 | system: |
| 403 | policyrcd: |
| 404 | - package: cassandra |
| 405 | action: exit 101 |
| 406 | - package: '*' |
| 407 | action: switch |
| 408 | |
Filip Pytloun | c49445a | 2016-04-04 14:23:20 +0200 | [diff] [blame] | 409 | Set system locales: |
| 410 | |
| 411 | .. code-block:: yaml |
| 412 | |
| 413 | linux: |
| 414 | system: |
| 415 | locale: |
| 416 | en_US.UTF-8: |
| 417 | default: true |
Filip Pytloun | ee1745f | 2016-04-04 17:39:41 +0200 | [diff] [blame] | 418 | "cs_CZ.UTF-8 UTF-8": |
Filip Pytloun | c49445a | 2016-04-04 14:23:20 +0200 | [diff] [blame] | 419 | enabled: true |
| 420 | |
Andrey Shestakov | e7cca05 | 2017-05-24 23:06:24 +0300 | [diff] [blame] | 421 | Systemd settings: |
| 422 | |
| 423 | .. code-block:: yaml |
| 424 | |
| 425 | linux: |
| 426 | system: |
| 427 | ... |
| 428 | systemd: |
| 429 | system: |
| 430 | Manager: |
| 431 | DefaultLimitNOFILE: 307200 |
| 432 | DefaultLimitNPROC: 307200 |
| 433 | user: |
| 434 | Manager: |
| 435 | DefaultLimitCPU: 2 |
| 436 | DefaultLimitNPROC: 4 |
| 437 | |
Filip Pytloun | 8b2131e | 2017-11-08 13:29:03 +0100 | [diff] [blame] | 438 | Ensure presence of directory: |
| 439 | |
| 440 | .. code-block:: yaml |
| 441 | |
| 442 | linux: |
| 443 | system: |
| 444 | directory: |
| 445 | /tmp/test: |
| 446 | user: root |
| 447 | group: root |
| 448 | mode: 700 |
| 449 | makedirs: true |
| 450 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 451 | Ensure presence of file by specifying its source: |
Richard Felkl | 2e07d65 | 2018-01-19 10:19:06 +0100 | [diff] [blame] | 452 | |
| 453 | .. code-block:: yaml |
| 454 | |
| 455 | linux: |
| 456 | system: |
| 457 | file: |
| 458 | /tmp/test.txt: |
| 459 | source: http://example.com/test.txt |
Richard Felkl | f40599a | 2018-02-06 22:56:41 +0100 | [diff] [blame] | 460 | user: root #optional |
| 461 | group: root #optional |
| 462 | mode: 700 #optional |
| 463 | dir_mode: 700 #optional |
| 464 | encoding: utf-8 #optional |
| 465 | hash: <<hash>> or <<URI to hash>> #optional |
| 466 | makedirs: true #optional |
| 467 | |
| 468 | linux: |
| 469 | system: |
| 470 | file: |
| 471 | test.txt: |
| 472 | name: /tmp/test.txt |
| 473 | source: http://example.com/test.txt |
Richard Felkl | 2e07d65 | 2018-01-19 10:19:06 +0100 | [diff] [blame] | 474 | |
Gabor Orosz | 35815c0 | 2018-09-07 17:31:05 +0200 | [diff] [blame] | 475 | linux: |
| 476 | system: |
| 477 | file: |
| 478 | test2: |
| 479 | name: /tmp/test2.txt |
| 480 | source: http://example.com/test2.jinja |
| 481 | template: jinja |
| 482 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 483 | Ensure presence of file by specifying its contents: |
Richard Felkl | 2e07d65 | 2018-01-19 10:19:06 +0100 | [diff] [blame] | 484 | |
| 485 | .. code-block:: yaml |
| 486 | |
| 487 | linux: |
| 488 | system: |
| 489 | file: |
| 490 | /tmp/test.txt: |
| 491 | contents: | |
| 492 | line1 |
| 493 | line2 |
Richard Felkl | f40599a | 2018-02-06 22:56:41 +0100 | [diff] [blame] | 494 | |
| 495 | linux: |
| 496 | system: |
| 497 | file: |
| 498 | /tmp/test.txt: |
| 499 | contents_pillar: linux:network:hostname |
| 500 | |
| 501 | linux: |
| 502 | system: |
| 503 | file: |
| 504 | /tmp/test.txt: |
| 505 | contents_grains: motd |
| 506 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 507 | Ensure presence of file to be serialized through one of the |
| 508 | serializer modules (see: |
| 509 | https://docs.saltstack.com/en/latest/ref/serializers/all/index.html): |
Bruno Binet | 9c2fe22 | 2018-06-08 16:57:32 +0200 | [diff] [blame] | 510 | |
| 511 | .. code-block:: yaml |
| 512 | |
| 513 | linux: |
| 514 | system: |
| 515 | file: |
| 516 | /tmp/test.json: |
| 517 | serialize: json |
| 518 | contents: |
| 519 | foo: 1 |
| 520 | bar: 'bar' |
| 521 | |
Filip Pytloun | 281034a | 2016-01-04 18:06:22 +0100 | [diff] [blame] | 522 | Kernel |
| 523 | ~~~~~~ |
| 524 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 525 | Install always up to date LTS kernel and headers from Ubuntu Trusty: |
Filip Pytloun | 281034a | 2016-01-04 18:06:22 +0100 | [diff] [blame] | 526 | |
| 527 | .. code-block:: yaml |
| 528 | |
| 529 | linux: |
| 530 | system: |
| 531 | kernel: |
| 532 | type: generic |
| 533 | lts: trusty |
| 534 | headers: true |
| 535 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 536 | Load kernel modules and add them to ``/etc/modules``: |
Tomáš Kukrál | ba35b21 | 2017-02-15 17:59:46 +0100 | [diff] [blame] | 537 | |
| 538 | .. code-block:: yaml |
| 539 | |
| 540 | linux: |
| 541 | system: |
| 542 | kernel: |
| 543 | modules: |
| 544 | - nf_conntrack |
| 545 | - tp_smapi |
| 546 | - 8021q |
| 547 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 548 | Configure or blacklist kernel modules with additional options to |
| 549 | ``/etc/modprobe.d`` following example will add |
| 550 | ``/etc/modprobe.d/nf_conntrack.conf`` file with line |
| 551 | ``options nf_conntrack hashsize=262144``: |
teoyaomiqui | 32b1f7c | 2017-05-24 14:36:09 +0300 | [diff] [blame] | 552 | |
Dmitry Teselkin | 809834c | 2018-08-13 19:14:42 +0300 | [diff] [blame] | 553 | 'option' can be a mapping (with 'enabled' and 'value' keys) or a scalar. |
| 554 | |
| 555 | Example for 'scalar' option value: |
| 556 | |
teoyaomiqui | 32b1f7c | 2017-05-24 14:36:09 +0300 | [diff] [blame] | 557 | .. code-block:: yaml |
| 558 | |
| 559 | linux: |
| 560 | system: |
| 561 | kernel: |
| 562 | module: |
| 563 | nf_conntrack: |
| 564 | option: |
| 565 | hashsize: 262144 |
| 566 | |
Dmitry Teselkin | 809834c | 2018-08-13 19:14:42 +0300 | [diff] [blame] | 567 | Example for 'mapping' option value: |
| 568 | |
| 569 | .. code-block:: yaml |
| 570 | |
| 571 | linux: |
| 572 | system: |
| 573 | kernel: |
| 574 | module: |
| 575 | nf_conntrack: |
| 576 | option: |
| 577 | hashsize: |
| 578 | enabled: true |
| 579 | value: 262144 |
| 580 | |
| 581 | NOTE: 'enabled' key is optional and is True by default. |
| 582 | |
| 583 | Blacklist a module: |
| 584 | |
| 585 | .. code-block:: yaml |
| 586 | |
| 587 | linux: |
| 588 | system: |
| 589 | kernel: |
| 590 | module: |
| 591 | nf_conntrack: |
| 592 | blacklist: true |
| 593 | |
| 594 | A module can have a number of aliases, wildcards are allowed. |
| 595 | Define an alias for a module: |
| 596 | |
| 597 | .. code-block:: yaml |
| 598 | |
| 599 | linux: |
| 600 | system: |
| 601 | kernel: |
| 602 | module: |
| 603 | nf_conntrack: |
| 604 | alias: |
| 605 | nfct: |
| 606 | enabled: true |
| 607 | "nf_conn*": |
| 608 | enabled: true |
| 609 | |
| 610 | NOTE: 'enabled' key is mandatory as there are no other keys exist. |
| 611 | |
| 612 | Execute custom command instead of 'insmod' when inserting a module: |
| 613 | |
| 614 | .. code-block:: yaml |
| 615 | |
| 616 | linux: |
| 617 | system: |
| 618 | kernel: |
| 619 | module: |
| 620 | nf_conntrack: |
| 621 | install: |
| 622 | enabled: true |
| 623 | command: /bin/true |
| 624 | |
| 625 | NOTE: 'enabled' key is optional and is True by default. |
| 626 | |
| 627 | Execute custom command instead of 'rmmod' when removing a module: |
| 628 | |
| 629 | .. code-block:: yaml |
| 630 | |
| 631 | linux: |
| 632 | system: |
| 633 | kernel: |
| 634 | module: |
| 635 | nf_conntrack: |
| 636 | remove: |
| 637 | enabled: true |
| 638 | command: /bin/true |
| 639 | |
| 640 | NOTE: 'enabled' key is optional and is True by default. |
| 641 | |
| 642 | Define module dependencies: |
| 643 | |
| 644 | .. code-block:: yaml |
| 645 | |
| 646 | linux: |
| 647 | system: |
| 648 | kernel: |
| 649 | module: |
| 650 | nf_conntrack: |
| 651 | softdep: |
| 652 | pre: |
| 653 | 1: |
| 654 | enabled: true |
| 655 | value: a |
| 656 | 2: |
| 657 | enabled: true |
| 658 | value: b |
| 659 | 3: |
| 660 | enabled: true |
| 661 | value: c |
| 662 | post: |
| 663 | 1: |
| 664 | enabled: true |
| 665 | value: x |
| 666 | 2: |
| 667 | enabled: true |
| 668 | value: y |
| 669 | 3: |
| 670 | enabled: true |
| 671 | value: z |
| 672 | |
| 673 | NOTE: 'enabled' key is optional and is True by default. |
| 674 | |
| 675 | |
Filip Pytloun | 281034a | 2016-01-04 18:06:22 +0100 | [diff] [blame] | 676 | Install specific kernel version and ensure all other kernel packages are |
| 677 | not present. Also install extra modules and headers for this kernel: |
| 678 | |
| 679 | .. code-block:: yaml |
| 680 | |
| 681 | linux: |
| 682 | system: |
| 683 | kernel: |
| 684 | type: generic |
| 685 | extra: true |
| 686 | headers: true |
| 687 | version: 4.2.0-22 |
| 688 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 689 | Systcl kernel parameters: |
Jakub Pavlik | 32c2cb0 | 2016-01-29 12:45:29 +0100 | [diff] [blame] | 690 | |
| 691 | .. code-block:: yaml |
| 692 | |
| 693 | linux: |
| 694 | system: |
| 695 | kernel: |
| 696 | sysctl: |
| 697 | net.ipv4.tcp_keepalive_intvl: 3 |
| 698 | net.ipv4.tcp_keepalive_time: 30 |
| 699 | net.ipv4.tcp_keepalive_probes: 8 |
| 700 | |
Michael Polenchuk | ebf5552 | 2018-01-25 13:22:39 +0400 | [diff] [blame] | 701 | Configure kernel boot options: |
| 702 | |
| 703 | .. code-block:: yaml |
| 704 | |
| 705 | linux: |
| 706 | system: |
| 707 | kernel: |
| 708 | boot_options: |
| 709 | - elevator=deadline |
| 710 | - spectre_v2=off |
| 711 | - nopti |
| 712 | |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 713 | CPU |
| 714 | ~~~ |
| 715 | |
teoyaomiqui | 32b1f7c | 2017-05-24 14:36:09 +0300 | [diff] [blame] | 716 | Enable cpufreq governor for every cpu: |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 717 | |
| 718 | .. code-block:: yaml |
| 719 | |
| 720 | linux: |
| 721 | system: |
| 722 | cpu: |
| 723 | governor: performance |
| 724 | |
Nick Metz | f04f5f3 | 2018-01-08 15:25:04 +0100 | [diff] [blame] | 725 | |
Jiri Broulik | 303905d | 2018-01-11 14:12:48 +0100 | [diff] [blame] | 726 | CGROUPS |
| 727 | ~~~~~~~ |
| 728 | |
| 729 | Setup linux cgroups: |
| 730 | |
| 731 | .. code-block:: yaml |
| 732 | |
| 733 | linux: |
| 734 | system: |
| 735 | cgroup: |
| 736 | enabled: true |
| 737 | group: |
| 738 | ceph_group_1: |
| 739 | controller: |
| 740 | cpu: |
| 741 | shares: |
| 742 | value: 250 |
| 743 | cpuacct: |
| 744 | usage: |
| 745 | value: 0 |
| 746 | cpuset: |
| 747 | cpus: |
| 748 | value: 1,2,3 |
| 749 | memory: |
| 750 | limit_in_bytes: |
| 751 | value: 2G |
| 752 | memsw.limit_in_bytes: |
| 753 | value: 3G |
| 754 | mapping: |
| 755 | subjects: |
| 756 | - '@ceph' |
| 757 | generic_group_1: |
| 758 | controller: |
| 759 | cpu: |
| 760 | shares: |
| 761 | value: 250 |
| 762 | cpuacct: |
| 763 | usage: |
| 764 | value: 0 |
| 765 | mapping: |
| 766 | subjects: |
| 767 | - '*:firefox' |
| 768 | - 'student:cp' |
| 769 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 770 | Shared libraries |
Nick Metz | f04f5f3 | 2018-01-08 15:25:04 +0100 | [diff] [blame] | 771 | ~~~~~~~~~~~~~~~~ |
| 772 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 773 | Set additional shared library to Linux system library path: |
Nick Metz | f04f5f3 | 2018-01-08 15:25:04 +0100 | [diff] [blame] | 774 | |
| 775 | .. code-block:: yaml |
| 776 | |
| 777 | linux: |
| 778 | system: |
| 779 | ld: |
| 780 | library: |
| 781 | java: |
| 782 | - /usr/lib/jvm/jre-openjdk/lib/amd64/server |
| 783 | - /opt/java/jre/lib/amd64/server |
Ondrej Smola | ef9bd76 | 2018-07-11 14:26:02 +0200 | [diff] [blame] | 784 | |
Filip Pytloun | 2fde88b | 2017-10-05 10:30:29 +0200 | [diff] [blame] | 785 | Certificates |
| 786 | ~~~~~~~~~~~~ |
| 787 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 788 | Add certificate authority into system trusted CA bundle: |
Filip Pytloun | 2fde88b | 2017-10-05 10:30:29 +0200 | [diff] [blame] | 789 | |
| 790 | .. code-block:: yaml |
| 791 | |
| 792 | linux: |
| 793 | system: |
| 794 | ca_certificates: |
| 795 | mycert: | |
| 796 | -----BEGIN CERTIFICATE----- |
| 797 | MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG |
| 798 | A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz |
| 799 | cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 |
| 800 | MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV |
| 801 | BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt |
| 802 | YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN |
| 803 | ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE |
| 804 | BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is |
| 805 | I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G |
| 806 | CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do |
| 807 | lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc |
| 808 | AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k |
| 809 | -----END CERTIFICATE----- |
| 810 | |
Filip Pytloun | 361096c | 2017-08-23 10:57:20 +0200 | [diff] [blame] | 811 | Sysfs |
| 812 | ~~~~~ |
| 813 | |
| 814 | Install sysfsutils and set sysfs attributes: |
| 815 | |
| 816 | .. code-block:: yaml |
| 817 | |
| 818 | linux: |
| 819 | system: |
| 820 | sysfs: |
| 821 | scheduler: |
| 822 | block/sda/queue/scheduler: deadline |
| 823 | power: |
| 824 | mode: |
| 825 | power/state: 0660 |
| 826 | owner: |
| 827 | power/state: "root:power" |
| 828 | devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave |
| 829 | |
Ondrej Smola | ef9bd76 | 2018-07-11 14:26:02 +0200 | [diff] [blame] | 830 | Optional: You can also use list that will ensure order of items. |
| 831 | |
| 832 | .. code-block:: yaml |
| 833 | |
| 834 | linux: |
| 835 | system: |
| 836 | sysfs: |
| 837 | scheduler: |
| 838 | block/sda/queue/scheduler: deadline |
| 839 | power: |
| 840 | - mode: |
| 841 | power/state: 0660 |
| 842 | - owner: |
| 843 | power/state: "root:power" |
| 844 | - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave |
| 845 | |
Martin Polreich | 148e1b8 | 2018-09-13 15:54:25 +0200 | [diff] [blame] | 846 | Sysfs definition with disabled automatic write. Attributes are saved |
| 847 | to configuration, but are not applied during the run. |
| 848 | Thay will be applied automatically after the reboot. |
| 849 | |
| 850 | |
| 851 | .. code-block:: yaml |
| 852 | |
| 853 | linux: |
| 854 | system: |
| 855 | sysfs: |
| 856 | enable_apply: false |
| 857 | scheduler: |
| 858 | block/sda/queue/scheduler: deadline |
| 859 | |
| 860 | .. note:: The `enable_apply` parameter defaults to `True` if not defined. |
| 861 | |
Jakub Pavlik | b148c8c | 2017-02-12 21:30:48 +0100 | [diff] [blame] | 862 | Huge Pages |
| 863 | ~~~~~~~~~~~~ |
| 864 | |
| 865 | Huge Pages give a performance boost to applications that intensively deal |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 866 | with memory allocation/deallocation by decreasing memory fragmentation: |
Jakub Pavlik | b148c8c | 2017-02-12 21:30:48 +0100 | [diff] [blame] | 867 | |
| 868 | .. code-block:: yaml |
| 869 | |
| 870 | linux: |
| 871 | system: |
| 872 | kernel: |
| 873 | hugepages: |
| 874 | small: |
| 875 | size: 2M |
| 876 | count: 107520 |
| 877 | mount_point: /mnt/hugepages_2MB |
Michael Polenchuk | d9369fe | 2018-05-08 17:53:08 +0400 | [diff] [blame] | 878 | mount: false/true # default is true (mount immediately) / false (just save in the fstab) |
Jakub Pavlik | b148c8c | 2017-02-12 21:30:48 +0100 | [diff] [blame] | 879 | large: |
| 880 | default: true # default automatically mounted |
| 881 | size: 1G |
| 882 | count: 210 |
| 883 | mount_point: /mnt/hugepages_1GB |
| 884 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 885 | .. note:: Not recommended to use both pagesizes concurrently. |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 886 | |
Jakub Pavlik | 5398d87 | 2017-02-13 22:30:47 +0100 | [diff] [blame] | 887 | Intel SR-IOV |
| 888 | ~~~~~~~~~~~~ |
| 889 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 890 | PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV) |
| 891 | specification defines a standardized mechanism to virtualize |
| 892 | PCIe devices. The mechanism can virtualize a single PCIe |
| 893 | Ethernet controller to appear as multiple PCIe devices: |
Jakub Pavlik | 5398d87 | 2017-02-13 22:30:47 +0100 | [diff] [blame] | 894 | |
| 895 | .. code-block:: yaml |
| 896 | |
| 897 | linux: |
| 898 | system: |
| 899 | kernel: |
| 900 | sriov: True |
| 901 | unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround |
| 902 | rc: |
| 903 | local: | |
| 904 | #!/bin/sh -e |
| 905 | # Enable 7 VF on eth1 |
| 906 | echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a |
| 907 | exit 0 |
| 908 | |
Jakub Pavlik | 6c9ead1 | 2017-02-16 21:53:13 +0100 | [diff] [blame] | 909 | Isolate CPU options |
| 910 | ~~~~~~~~~~~~~~~~~~~ |
| 911 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 912 | Remove the specified CPUs, as defined by the cpu_number values, from |
| 913 | the general kernel SMP balancing and scheduler algroithms. The only |
| 914 | way to move a process onto or off an *isolated* CPU is via the CPU |
| 915 | affinity syscalls. ``cpu_number begins`` at ``0``, so the |
| 916 | maximum value is ``1`` less than the number of CPUs on the system.: |
Jakub Pavlik | 6c9ead1 | 2017-02-16 21:53:13 +0100 | [diff] [blame] | 917 | |
| 918 | .. code-block:: yaml |
| 919 | |
| 920 | linux: |
| 921 | system: |
| 922 | kernel: |
| 923 | isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0 |
Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 924 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 925 | Repositories |
| 926 | ~~~~~~~~~~~~ |
| 927 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 928 | RedHat-based Linux with additional OpenStack repo: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 929 | |
| 930 | .. code-block:: yaml |
| 931 | |
| 932 | linux: |
| 933 | system: |
| 934 | ... |
| 935 | repo: |
| 936 | rdo-icehouse: |
| 937 | enabled: true |
| 938 | source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/' |
| 939 | pgpcheck: 0 |
| 940 | |
| 941 | Ensure system repository to use czech Debian mirror (``default: true``) |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 942 | Also pin it's packages with priority ``900``: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 943 | |
| 944 | .. code-block:: yaml |
| 945 | |
| 946 | linux: |
| 947 | system: |
| 948 | repo: |
| 949 | debian: |
| 950 | default: true |
| 951 | source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free" |
| 952 | # Import signing key from URL if needed |
| 953 | key_url: "http://dummy.com/public.gpg" |
| 954 | pin: |
| 955 | - pin: 'origin "ftp.cz.debian.org"' |
| 956 | priority: 900 |
| 957 | package: '*' |
| 958 | |
azvyagintsev | a3a73d0 | 2018-12-06 14:49:58 +0200 | [diff] [blame] | 959 | Sometimes better to use one pining rule file, to decrease mistaken |
| 960 | ordering. You can use those option ``system:apt:preferences``, which would add opts into |
| 961 | ``/etc/apt/preferences`` file: |
| 962 | |
| 963 | .. code-block:: yaml |
| 964 | |
| 965 | parameters: |
| 966 | linux: |
| 967 | system: |
| 968 | apt: |
| 969 | preferences: |
| 970 | enabled: true |
| 971 | rules: |
| 972 | 100: |
| 973 | enabled: true |
| 974 | name: 'some origin pin' |
| 975 | pin: 'release o=Debian' |
| 976 | priority: 1100 |
| 977 | package: '*' |
| 978 | |
| 979 | |
azvyagintsev | 4494a47 | 2018-09-14 19:19:23 +0300 | [diff] [blame] | 980 | If you need to add multiple pin rules for one repo, please use new,ordered definition format |
| 981 | ('pinning' definition will be in priotity to use): |
| 982 | |
| 983 | .. code-block:: yaml |
| 984 | |
| 985 | linux: |
| 986 | system: |
| 987 | repo: |
| 988 | mcp_saltstack: |
| 989 | source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main" |
| 990 | architectures: amd64 |
| 991 | clean_file: true |
| 992 | pinning: |
| 993 | 10: |
| 994 | enabled: true |
| 995 | pin: 'release o=SaltStack' |
| 996 | priority: 50 |
| 997 | package: 'libsodium18' |
| 998 | 20: |
| 999 | enabled: true |
| 1000 | pin: 'release o=SaltStack' |
| 1001 | priority: 1100 |
| 1002 | package: '*' |
| 1003 | |
| 1004 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1005 | .. note:: For old Ubuntu releases (<xenial) |
azvyagintsev | ff089d2 | 2018-07-27 16:52:34 +0200 | [diff] [blame] | 1006 | extra packages for apt transport, like ``apt-transport-https`` |
| 1007 | may be required to be installed manually. |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1008 | (Chicken-eggs issue: we need to install packages to |
azvyagintsev | ff089d2 | 2018-07-27 16:52:34 +0200 | [diff] [blame] | 1009 | reach repo from where they should be installed) |
| 1010 | Otherwise, you still can try 'fortune' and install prereq.packages before |
| 1011 | any repo configuration, using list of requires in map.jinja. |
| 1012 | |
| 1013 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1014 | Disabling any prerequisite packages installation: |
| 1015 | |
azvyagintsev | ff089d2 | 2018-07-27 16:52:34 +0200 | [diff] [blame] | 1016 | You can simply drop any package pre-installation (before system.linux.repo |
| 1017 | will be processed) via cluster lvl: |
| 1018 | |
| 1019 | .. code-block:: yaml |
| 1020 | |
| 1021 | linux: |
| 1022 | system: |
| 1023 | pkgs: ~ |
| 1024 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1025 | Package manager proxy global setup: |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1026 | |
| 1027 | .. code-block:: yaml |
| 1028 | |
| 1029 | linux: |
| 1030 | system: |
| 1031 | ... |
| 1032 | repo: |
| 1033 | apt-mk: |
| 1034 | source: "deb http://apt-mk.mirantis.com/ stable main salt" |
| 1035 | ... |
| 1036 | proxy: |
| 1037 | pkg: |
| 1038 | enabled: true |
| 1039 | ftp: ftp://ftp-proxy-for-apt.host.local:2121 |
| 1040 | ... |
| 1041 | # NOTE: Global defaults for any other componet that configure proxy on the system. |
| 1042 | # If your environment has just one simple proxy, set it on linux:system:proxy. |
| 1043 | # |
| 1044 | # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries |
| 1045 | # as for https and http |
| 1046 | ftp: ftp://proxy.host.local:2121 |
| 1047 | http: http://proxy.host.local:3142 |
| 1048 | https: https://proxy.host.local:3143 |
| 1049 | |
| 1050 | Package manager proxy setup per repository: |
| 1051 | |
| 1052 | .. code-block:: yaml |
| 1053 | |
| 1054 | linux: |
| 1055 | system: |
| 1056 | ... |
| 1057 | repo: |
| 1058 | debian: |
| 1059 | source: "deb http://apt-mk.mirantis.com/ stable main salt" |
| 1060 | ... |
| 1061 | apt-mk: |
| 1062 | source: "deb http://apt-mk.mirantis.com/ stable main salt" |
| 1063 | # per repository proxy |
| 1064 | proxy: |
| 1065 | enabled: true |
| 1066 | http: http://maas-01:8080 |
| 1067 | https: http://maas-01:8080 |
| 1068 | ... |
| 1069 | proxy: |
Oleksandr Vlasov | 27a6c3a | 2017-04-11 16:01:19 -0600 | [diff] [blame] | 1070 | # package manager fallback defaults |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1071 | # used if linux:system:repo:apt-mk:proxy has no protocol specific entries |
| 1072 | pkg: |
| 1073 | enabled: true |
| 1074 | ftp: ftp://proxy.host.local:2121 |
| 1075 | #http: http://proxy.host.local:3142 |
| 1076 | #https: https://proxy.host.local:3143 |
Oleksandr Vlasov | 27a6c3a | 2017-04-11 16:01:19 -0600 | [diff] [blame] | 1077 | ... |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1078 | # global system fallback system defaults |
| 1079 | ftp: ftp://proxy.host.local:2121 |
| 1080 | http: http://proxy.host.local:3142 |
| 1081 | https: https://proxy.host.local:3143 |
| 1082 | |
Jiri Broulik | 34a29b4 | 2017-04-25 14:42:54 +0200 | [diff] [blame] | 1083 | Remove all repositories: |
| 1084 | |
| 1085 | .. code-block:: yaml |
| 1086 | |
| 1087 | linux: |
| 1088 | system: |
| 1089 | purge_repos: true |
| 1090 | |
azvyagintsev | ff089d2 | 2018-07-27 16:52:34 +0200 | [diff] [blame] | 1091 | Refresh repositories metada, after configuration: |
| 1092 | |
| 1093 | .. code-block:: yaml |
| 1094 | |
| 1095 | linux: |
| 1096 | system: |
| 1097 | refresh_repos_meta: true |
| 1098 | |
Filip Pytloun | c512e6c | 2017-11-22 14:28:10 +0100 | [diff] [blame] | 1099 | Setup custom apt config options: |
| 1100 | |
| 1101 | .. code-block:: yaml |
| 1102 | |
| 1103 | linux: |
| 1104 | system: |
| 1105 | apt: |
| 1106 | config: |
| 1107 | compression-workaround: |
| 1108 | "Acquire::CompressionTypes::Order": "gz" |
| 1109 | docker-clean: |
| 1110 | "DPkg::Post-Invoke": |
| 1111 | - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true" |
| 1112 | "APT::Update::Post-Invoke": |
| 1113 | - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true" |
Jiri Broulik | 34a29b4 | 2017-04-25 14:42:54 +0200 | [diff] [blame] | 1114 | |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1115 | RC |
| 1116 | ~~ |
| 1117 | |
Jakub Pavlik | 7885938 | 2016-01-21 11:26:39 +0100 | [diff] [blame] | 1118 | rc.local example |
| 1119 | |
| 1120 | .. code-block:: yaml |
| 1121 | |
| 1122 | linux: |
| 1123 | system: |
| 1124 | rc: |
| 1125 | local: | |
| 1126 | #!/bin/sh -e |
| 1127 | # |
| 1128 | # rc.local |
| 1129 | # |
| 1130 | # This script is executed at the end of each multiuser runlevel. |
| 1131 | # Make sure that the script will "exit 0" on success or any other |
| 1132 | # value on error. |
| 1133 | # |
| 1134 | # In order to enable or disable this script just change the execution |
| 1135 | # bits. |
| 1136 | # |
| 1137 | # By default this script does nothing. |
| 1138 | exit 0 |
| 1139 | |
Filip Pytloun | 1f40dac | 2016-01-22 15:52:57 +0100 | [diff] [blame] | 1140 | Prompt |
| 1141 | ~~~~~~ |
| 1142 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1143 | Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. |
| 1144 | Every user can have different prompt: |
Filip Pytloun | 1f40dac | 2016-01-22 15:52:57 +0100 | [diff] [blame] | 1145 | |
| 1146 | .. code-block:: yaml |
| 1147 | |
| 1148 | linux: |
| 1149 | system: |
| 1150 | prompt: |
| 1151 | 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\\] |
| 1152 | default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w] |
| 1153 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1154 | On Debian systems, to set prompt system-wide, it's necessary to |
| 1155 | remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``, |
| 1156 | which comes from ``/etc/skel/.bashrc``. This formula will do |
| 1157 | this automatically, but will not touch existing user's |
| 1158 | ``~/.bashrc`` files except root. |
Jakub Pavlik | 7885938 | 2016-01-21 11:26:39 +0100 | [diff] [blame] | 1159 | |
Filip Pytloun | eef11c1 | 2016-03-25 11:00:23 +0100 | [diff] [blame] | 1160 | Bash |
| 1161 | ~~~~ |
| 1162 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1163 | Fix bash configuration to preserve history across sessions |
| 1164 | like ZSH does by default: |
Filip Pytloun | eef11c1 | 2016-03-25 11:00:23 +0100 | [diff] [blame] | 1165 | |
| 1166 | .. code-block:: yaml |
| 1167 | |
| 1168 | linux: |
| 1169 | system: |
| 1170 | bash: |
| 1171 | preserve_history: true |
| 1172 | |
Dmitry Teselkin | 949398e | 2018-05-03 15:50:00 +0300 | [diff] [blame] | 1173 | Login banner message |
| 1174 | ~~~~~~~~~~~~~~~~~~~~ |
| 1175 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1176 | ``/etc/issue`` is a text file which contains a message or system |
| 1177 | identification to be printed before the login prompt. It may contain |
Dmitry Teselkin | 949398e | 2018-05-03 15:50:00 +0300 | [diff] [blame] | 1178 | various @char and \char sequences, if supported by the getty-type |
| 1179 | program employed on the system. |
| 1180 | |
| 1181 | Setting logon banner message is easy: |
| 1182 | |
| 1183 | .. code-block:: yaml |
| 1184 | |
| 1185 | liunx: |
| 1186 | system: |
| 1187 | banner: |
| 1188 | enabled: true |
| 1189 | contents: | |
| 1190 | UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED |
| 1191 | |
| 1192 | You must have explicit, authorized permission to access or configure this |
| 1193 | device. Unauthorized attempts and actions to access or use this system may |
| 1194 | result in civil and/or criminal penalties. |
| 1195 | All activities performed on this system are logged and monitored. |
| 1196 | |
Filip Pytloun | e874dfb | 2016-01-22 16:57:34 +0100 | [diff] [blame] | 1197 | Message of the day |
| 1198 | ~~~~~~~~~~~~~~~~~~ |
| 1199 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1200 | ``pam_motd`` from package ``libpam-modules`` is used for dynamic |
| 1201 | messages of the day. Setting custom ``motd`` will clean up existing ones. |
Filip Pytloun | e874dfb | 2016-01-22 16:57:34 +0100 | [diff] [blame] | 1202 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1203 | Setting static ``motd`` will replace existing ``/etc/motd`` and remove |
| 1204 | scripts from ``/etc/update-motd.d``. |
Dmitry Teselkin | 538c824 | 2018-04-02 16:13:37 +0300 | [diff] [blame] | 1205 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1206 | Setting static ``motd``: |
Dmitry Teselkin | 538c824 | 2018-04-02 16:13:37 +0300 | [diff] [blame] | 1207 | |
| 1208 | .. code-block:: yaml |
| 1209 | |
| 1210 | linux: |
| 1211 | system: |
| 1212 | motd: | |
| 1213 | UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED |
| 1214 | |
| 1215 | You must have explicit, authorized permission to access or configure this |
| 1216 | device. Unauthorized attempts and actions to access or use this system may |
| 1217 | result in civil and/or criminal penalties. |
| 1218 | All activities performed on this system are logged and monitored. |
| 1219 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1220 | Setting dynamic ``motd``: |
Dmitry Teselkin | 538c824 | 2018-04-02 16:13:37 +0300 | [diff] [blame] | 1221 | |
Filip Pytloun | e874dfb | 2016-01-22 16:57:34 +0100 | [diff] [blame] | 1222 | .. code-block:: yaml |
| 1223 | |
| 1224 | linux: |
| 1225 | system: |
| 1226 | motd: |
| 1227 | - release: | |
| 1228 | #!/bin/sh |
| 1229 | [ -r /etc/lsb-release ] && . /etc/lsb-release |
| 1230 | |
| 1231 | if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then |
| 1232 | # Fall back to using the very slow lsb_release utility |
| 1233 | DISTRIB_DESCRIPTION=$(lsb_release -s -d) |
| 1234 | fi |
| 1235 | |
| 1236 | printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)" |
| 1237 | - warning: | |
| 1238 | #!/bin/sh |
| 1239 | printf "This is [company name] network.\n" |
| 1240 | printf "Unauthorized access strictly prohibited.\n" |
| 1241 | |
Marek Celoud | 713e907 | 2017-05-18 15:20:25 +0200 | [diff] [blame] | 1242 | Services |
| 1243 | ~~~~~~~~ |
| 1244 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1245 | Stop and disable the ``linux`` service: |
Marek Celoud | 713e907 | 2017-05-18 15:20:25 +0200 | [diff] [blame] | 1246 | |
| 1247 | .. code-block:: yaml |
| 1248 | |
| 1249 | linux: |
| 1250 | system: |
| 1251 | service: |
| 1252 | apt-daily.timer: |
| 1253 | status: dead |
| 1254 | |
Dzmitry Stremkouski | 70d0978 | 2018-11-30 16:04:59 +0100 | [diff] [blame] | 1255 | Override systemd service unit: |
| 1256 | |
| 1257 | .. code-block:: yaml |
| 1258 | |
| 1259 | parameters: |
| 1260 | |
| 1261 | linux: |
| 1262 | system: |
| 1263 | service: |
| 1264 | tgt: |
| 1265 | name: tgt |
| 1266 | status: running |
| 1267 | enabled: True |
| 1268 | override: |
| 1269 | 50: |
| 1270 | target: tgt.service.d |
| 1271 | name: bind |
| 1272 | content: | |
| 1273 | [Service] |
| 1274 | ExecStart= |
| 1275 | ExecStart=/usr/sbin/tgtd -f --iscsi portal=${_param:single_address}:3260 |
| 1276 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1277 | Possible statuses are ``dead`` (disable service by default), ``running`` |
| 1278 | (enable service by default), ``enabled``, ``disabled``: |
Marek Celoud | 713e907 | 2017-05-18 15:20:25 +0200 | [diff] [blame] | 1279 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1280 | Linux with the ``atop`` service: |
Serhiy Ovsianikov | 67bd56a | 2017-08-11 15:56:01 +0300 | [diff] [blame] | 1281 | |
| 1282 | .. code-block:: yaml |
| 1283 | |
| 1284 | linux: |
| 1285 | system: |
| 1286 | atop: |
| 1287 | enabled: true |
| 1288 | interval: 20 |
| 1289 | logpath: "/var/log/atop" |
| 1290 | outfile: "/var/log/atop/daily.log" |
| 1291 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1292 | Linux with the ``mcelog`` service: |
Oleksii Chupryn | 144432b | 2018-05-22 10:34:48 +0300 | [diff] [blame] | 1293 | |
| 1294 | .. code-block:: yaml |
| 1295 | |
| 1296 | linux: |
| 1297 | system: |
| 1298 | mcelog: |
| 1299 | enabled: true |
| 1300 | logging: |
| 1301 | syslog: true |
| 1302 | syslog_error: true |
| 1303 | |
Filip Pytloun | 2f70b49 | 2016-02-19 15:55:25 +0100 | [diff] [blame] | 1304 | RHEL / CentOS |
Filip Pytloun | 8296bb9 | 2016-02-19 18:42:09 +0100 | [diff] [blame] | 1305 | ^^^^^^^^^^^^^ |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1306 | Currently, ``update-motd`` is not available |
| 1307 | for RHEL. So there is no native support for dynamic ``motd``. |
| 1308 | You can still set a static one, with a different pillar structure: |
Filip Pytloun | 2f70b49 | 2016-02-19 15:55:25 +0100 | [diff] [blame] | 1309 | |
| 1310 | .. code-block:: yaml |
| 1311 | |
| 1312 | linux: |
| 1313 | system: |
| 1314 | motd: | |
| 1315 | This is [company name] network. |
| 1316 | Unauthorized access strictly prohibited. |
| 1317 | |
Filip Pytloun | 8296bb9 | 2016-02-19 18:42:09 +0100 | [diff] [blame] | 1318 | Haveged |
| 1319 | ~~~~~~~ |
| 1320 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1321 | If you are running headless server and are low on entropy, |
| 1322 | you may set up Haveged: |
Filip Pytloun | 8296bb9 | 2016-02-19 18:42:09 +0100 | [diff] [blame] | 1323 | |
| 1324 | .. code-block:: yaml |
| 1325 | |
| 1326 | linux: |
| 1327 | system: |
| 1328 | haveged: |
| 1329 | enabled: true |
| 1330 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1331 | Linux network |
| 1332 | ------------- |
| 1333 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1334 | Linux with network manager: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1335 | |
| 1336 | .. code-block:: yaml |
| 1337 | |
| 1338 | linux: |
| 1339 | network: |
| 1340 | enabled: true |
| 1341 | network_manager: true |
| 1342 | |
Dzmitry Stremkouski | 00cdbe6 | 2018-10-31 16:41:54 +0100 | [diff] [blame] | 1343 | Execute linux.network.interface state without ifupdown activity: |
| 1344 | |
| 1345 | .. code-block:: bash |
| 1346 | |
| 1347 | salt-call linux.network.interface pillar='{"linux":{"network":{"noifupdown":True}}}' |
| 1348 | |
| 1349 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1350 | Linux with default static network interfaces, default gateway |
| 1351 | interface and DNS servers: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1352 | |
| 1353 | .. code-block:: yaml |
| 1354 | |
| 1355 | linux: |
| 1356 | network: |
| 1357 | enabled: true |
| 1358 | interface: |
| 1359 | eth0: |
| 1360 | enabled: true |
| 1361 | type: eth |
| 1362 | address: 192.168.0.102 |
| 1363 | netmask: 255.255.255.0 |
| 1364 | gateway: 192.168.0.1 |
| 1365 | name_servers: |
| 1366 | - 8.8.8.8 |
| 1367 | - 8.8.4.4 |
| 1368 | mtu: 1500 |
| 1369 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1370 | Linux with bonded interfaces and disabled ``NetworkManager``: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1371 | |
| 1372 | .. code-block:: yaml |
| 1373 | |
| 1374 | linux: |
| 1375 | network: |
| 1376 | enabled: true |
| 1377 | interface: |
| 1378 | eth0: |
| 1379 | type: eth |
| 1380 | ... |
| 1381 | eth1: |
| 1382 | type: eth |
| 1383 | ... |
| 1384 | bond0: |
| 1385 | enabled: true |
| 1386 | type: bond |
| 1387 | address: 192.168.0.102 |
| 1388 | netmask: 255.255.255.0 |
| 1389 | mtu: 1500 |
| 1390 | use_in: |
| 1391 | - interface: ${linux:interface:eth0} |
| 1392 | - interface: ${linux:interface:eth0} |
jan kaufman | 6d30adf | 2016-01-18 17:30:12 +0100 | [diff] [blame] | 1393 | network_manager: |
| 1394 | disable: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1395 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1396 | Linux with VLAN ``interface_params``: |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 1397 | |
| 1398 | .. code-block:: yaml |
| 1399 | |
| 1400 | linux: |
| 1401 | network: |
| 1402 | enabled: true |
| 1403 | interface: |
| 1404 | vlan69: |
| 1405 | type: vlan |
jan kaufman | c0bd76f | 2015-12-15 16:45:44 +0100 | [diff] [blame] | 1406 | use_interfaces: |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 1407 | - interface: ${linux:interface:bond0} |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 1408 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1409 | Linux with wireless interface parameters: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1410 | |
| 1411 | .. code-block:: yaml |
| 1412 | |
| 1413 | linux: |
| 1414 | network: |
| 1415 | enabled: true |
| 1416 | gateway: 10.0.0.1 |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 1417 | default_interface: eth0 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1418 | interface: |
| 1419 | wlan0: |
| 1420 | type: eth |
| 1421 | wireless: |
| 1422 | essid: example |
| 1423 | key: example_key |
| 1424 | security: wpa |
| 1425 | priority: 1 |
| 1426 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1427 | Linux networks with routes defined: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1428 | |
| 1429 | .. code-block:: yaml |
| 1430 | |
| 1431 | linux: |
| 1432 | network: |
| 1433 | enabled: true |
| 1434 | gateway: 10.0.0.1 |
Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 1435 | default_interface: eth0 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1436 | interface: |
| 1437 | eth0: |
| 1438 | type: eth |
| 1439 | route: |
| 1440 | default: |
| 1441 | address: 192.168.0.123 |
| 1442 | netmask: 255.255.255.0 |
| 1443 | gateway: 192.168.0.1 |
| 1444 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1445 | Native Linux Bridges: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1446 | |
| 1447 | .. code-block:: yaml |
| 1448 | |
| 1449 | linux: |
| 1450 | network: |
| 1451 | interface: |
| 1452 | eth1: |
| 1453 | enabled: true |
| 1454 | type: eth |
| 1455 | proto: manual |
| 1456 | up_cmds: |
| 1457 | - ip address add 0/0 dev $IFACE |
| 1458 | - ip link set $IFACE up |
| 1459 | down_cmds: |
| 1460 | - ip link set $IFACE down |
| 1461 | br-ex: |
| 1462 | enabled: true |
| 1463 | type: bridge |
| 1464 | address: ${linux:network:host:public_local:address} |
| 1465 | netmask: 255.255.255.0 |
| 1466 | use_interfaces: |
| 1467 | - eth1 |
| 1468 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1469 | Open vSwitch Bridges: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1470 | |
| 1471 | .. code-block:: yaml |
| 1472 | |
| 1473 | linux: |
| 1474 | network: |
| 1475 | bridge: openvswitch |
| 1476 | interface: |
| 1477 | eth1: |
| 1478 | enabled: true |
| 1479 | type: eth |
| 1480 | proto: manual |
| 1481 | up_cmds: |
| 1482 | - ip address add 0/0 dev $IFACE |
| 1483 | - ip link set $IFACE up |
| 1484 | down_cmds: |
| 1485 | - ip link set $IFACE down |
| 1486 | br-ex: |
| 1487 | enabled: true |
| 1488 | type: bridge |
| 1489 | address: ${linux:network:host:public_local:address} |
| 1490 | netmask: 255.255.255.0 |
| 1491 | use_interfaces: |
| 1492 | - eth1 |
Dmitry Stremkouski | a581ea7 | 2017-10-18 14:24:16 +0300 | [diff] [blame] | 1493 | br-prv: |
| 1494 | enabled: true |
| 1495 | type: ovs_bridge |
| 1496 | mtu: 65000 |
| 1497 | br-ens7: |
| 1498 | enabled: true |
| 1499 | name: br-ens7 |
| 1500 | type: ovs_bridge |
| 1501 | proto: manual |
| 1502 | mtu: 9000 |
| 1503 | use_interfaces: |
| 1504 | - ens7 |
| 1505 | patch-br-ens7-br-prv: |
| 1506 | enabled: true |
| 1507 | name: ens7-prv |
| 1508 | ovs_type: ovs_port |
| 1509 | type: ovs_port |
| 1510 | bridge: br-ens7 |
| 1511 | port_type: patch |
| 1512 | peer: prv-ens7 |
Oleksii Chupryn | 694ee72 | 2018-06-13 14:08:58 +0300 | [diff] [blame] | 1513 | tag: 109 # [] to unset a tag |
Dmitry Stremkouski | a581ea7 | 2017-10-18 14:24:16 +0300 | [diff] [blame] | 1514 | mtu: 65000 |
| 1515 | patch-br-prv-br-ens7: |
| 1516 | enabled: true |
| 1517 | name: prv-ens7 |
| 1518 | bridge: br-prv |
| 1519 | ovs_type: ovs_port |
| 1520 | type: ovs_port |
| 1521 | port_type: patch |
| 1522 | peer: ens7-prv |
Oleksii Chupryn | 694ee72 | 2018-06-13 14:08:58 +0300 | [diff] [blame] | 1523 | tag: 109 |
Dmitry Stremkouski | a581ea7 | 2017-10-18 14:24:16 +0300 | [diff] [blame] | 1524 | mtu: 65000 |
| 1525 | ens7: |
| 1526 | enabled: true |
| 1527 | name: ens7 |
| 1528 | proto: manual |
| 1529 | ovs_port_type: OVSPort |
| 1530 | type: ovs_port |
| 1531 | ovs_bridge: br-ens7 |
| 1532 | bridge: br-ens7 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1533 | |
Petr Jediný | 8f8ae54 | 2017-07-13 16:19:12 +0200 | [diff] [blame] | 1534 | Debian manual proto interfaces |
| 1535 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1536 | When you are changing interface proto from static in up state |
| 1537 | to manual, you may need to flush ip addresses. For example, |
| 1538 | if you want to use the interface and the ip on the bridge. |
| 1539 | This can be done by setting the ``ipflush_onchange`` to true. |
Petr Jediný | 8f8ae54 | 2017-07-13 16:19:12 +0200 | [diff] [blame] | 1540 | |
| 1541 | .. code-block:: yaml |
| 1542 | |
| 1543 | linux: |
| 1544 | network: |
| 1545 | interface: |
| 1546 | eth1: |
| 1547 | enabled: true |
| 1548 | type: eth |
| 1549 | proto: manual |
| 1550 | mtu: 9100 |
| 1551 | ipflush_onchange: true |
| 1552 | |
Jiri Broulik | 1a191e3 | 2018-01-15 15:54:21 +0100 | [diff] [blame] | 1553 | Debian static proto interfaces |
| 1554 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1555 | When you are changing interface proto from dhcp in up state to |
| 1556 | static, you may need to flush ip addresses and restart interface |
| 1557 | to assign ip address from a managed file. For example, if you wantto |
| 1558 | use the interface and the ip on the bridge. This can be done by |
| 1559 | setting the ``ipflush_onchange`` with combination ``restart_on_ipflush`` |
| 1560 | param set to true. |
Jiri Broulik | 1a191e3 | 2018-01-15 15:54:21 +0100 | [diff] [blame] | 1561 | |
| 1562 | .. code-block:: yaml |
| 1563 | |
| 1564 | linux: |
| 1565 | network: |
| 1566 | interface: |
| 1567 | eth1: |
| 1568 | enabled: true |
| 1569 | type: eth |
| 1570 | proto: static |
| 1571 | address: 10.1.0.22 |
| 1572 | netmask: 255.255.255.0 |
| 1573 | ipflush_onchange: true |
| 1574 | restart_on_ipflush: true |
Petr Jediný | 8f8ae54 | 2017-07-13 16:19:12 +0200 | [diff] [blame] | 1575 | |
Petr Jediný | d577cb5 | 2017-06-28 20:17:49 +0200 | [diff] [blame] | 1576 | Concatinating and removing interface files |
| 1577 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1578 | Debian based distributions have ``/etc/network/interfaces.d/`` |
| 1579 | directory, where you can store configuration of network |
| 1580 | interfaces in separate files. You can concatinate the files |
| 1581 | to the defined destination when needed, this operation removes |
| 1582 | the file from the ``/etc/network/interfaces.d/``. If you just need |
| 1583 | to remove iface files, you can use the ``remove_iface_files`` key. |
Petr Jediný | d577cb5 | 2017-06-28 20:17:49 +0200 | [diff] [blame] | 1584 | |
| 1585 | .. code-block:: yaml |
| 1586 | |
| 1587 | linux: |
| 1588 | network: |
| 1589 | concat_iface_files: |
| 1590 | - src: '/etc/network/interfaces.d/50-cloud-init.cfg' |
| 1591 | dst: '/etc/network/interfaces' |
| 1592 | remove_iface_files: |
| 1593 | - '/etc/network/interfaces.d/90-custom.cfg' |
| 1594 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1595 | Configure DHCP client |
Petr Jediný | d577cb5 | 2017-06-28 20:17:49 +0200 | [diff] [blame] | 1596 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1597 | None of the keys is mandatory, include only those you really need. |
| 1598 | For full list of available options under send, supersede, prepend, |
| 1599 | append refer to dhcp-options(5). |
Oleksandr Vlasov | 27a6c3a | 2017-04-11 16:01:19 -0600 | [diff] [blame] | 1600 | |
| 1601 | .. code-block:: yaml |
| 1602 | |
| 1603 | linux: |
| 1604 | network: |
| 1605 | dhclient: |
| 1606 | enabled: true |
| 1607 | backoff_cutoff: 15 |
| 1608 | initial_interval: 10 |
| 1609 | reboot: 10 |
| 1610 | retry: 60 |
| 1611 | select_timeout: 0 |
| 1612 | timeout: 120 |
| 1613 | send: |
| 1614 | - option: host-name |
| 1615 | declaration: "= gethostname()" |
| 1616 | supersede: |
| 1617 | - option: host-name |
| 1618 | declaration: "spaceship" |
| 1619 | - option: domain-name |
| 1620 | declaration: "domain.home" |
| 1621 | #- option: arp-cache-timeout |
| 1622 | # declaration: 20 |
| 1623 | prepend: |
| 1624 | - option: domain-name-servers |
| 1625 | declaration: |
| 1626 | - 8.8.8.8 |
| 1627 | - 8.8.4.4 |
| 1628 | - option: domain-search |
| 1629 | declaration: |
| 1630 | - example.com |
| 1631 | - eng.example.com |
| 1632 | #append: |
| 1633 | #- option: domain-name-servers |
| 1634 | # declaration: 127.0.0.1 |
| 1635 | # ip or subnet to reject dhcp offer from |
| 1636 | reject: |
| 1637 | - 192.33.137.209 |
| 1638 | - 10.0.2.0/24 |
| 1639 | request: |
| 1640 | - subnet-mask |
| 1641 | - broadcast-address |
| 1642 | - time-offset |
| 1643 | - routers |
| 1644 | - domain-name |
| 1645 | - domain-name-servers |
| 1646 | - domain-search |
| 1647 | - host-name |
| 1648 | - dhcp6.name-servers |
| 1649 | - dhcp6.domain-search |
| 1650 | - dhcp6.fqdn |
| 1651 | - dhcp6.sntp-servers |
| 1652 | - netbios-name-servers |
| 1653 | - netbios-scope |
| 1654 | - interface-mtu |
| 1655 | - rfc3442-classless-static-routes |
| 1656 | - ntp-servers |
| 1657 | require: |
| 1658 | - subnet-mask |
| 1659 | - domain-name-servers |
| 1660 | # if per interface configuration required add below |
| 1661 | interface: |
| 1662 | ens2: |
| 1663 | initial_interval: 11 |
| 1664 | reject: |
| 1665 | - 192.33.137.210 |
| 1666 | ens3: |
| 1667 | initial_interval: 12 |
| 1668 | reject: |
| 1669 | - 192.33.137.211 |
| 1670 | |
Petr Michalec | eb14b55 | 2017-06-01 10:27:05 +0200 | [diff] [blame] | 1671 | Linux network systemd settings: |
| 1672 | |
| 1673 | .. code-block:: yaml |
| 1674 | |
| 1675 | linux: |
| 1676 | network: |
| 1677 | ... |
| 1678 | systemd: |
| 1679 | link: |
| 1680 | 10-iface-dmz: |
| 1681 | Match: |
| 1682 | MACAddress: c8:5b:67:fa:1a:af |
| 1683 | OriginalName: eth0 |
| 1684 | Link: |
| 1685 | Name: dmz0 |
| 1686 | netdev: |
| 1687 | 20-bridge-dmz: |
| 1688 | match: |
| 1689 | name: dmz0 |
| 1690 | network: |
| 1691 | mescription: bridge |
| 1692 | bridge: br-dmz0 |
| 1693 | network: |
| 1694 | # works with lowercase, keys are by default capitalized |
| 1695 | 40-dhcp: |
| 1696 | match: |
| 1697 | name: '*' |
| 1698 | network: |
| 1699 | DHCP: yes |
| 1700 | |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1701 | Configure global environment variables |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1702 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1703 | Use ``/etc/environment`` for static system wide variable assignment |
| 1704 | after boot. Variable expansion is frequently not supported. |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1705 | |
| 1706 | .. code-block:: yaml |
| 1707 | |
| 1708 | linux: |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1709 | system: |
| 1710 | env: |
| 1711 | BOB_VARIABLE: Alice |
| 1712 | ... |
| 1713 | BOB_PATH: |
| 1714 | - /srv/alice/bin |
| 1715 | - /srv/bob/bin |
| 1716 | ... |
| 1717 | ftp_proxy: none |
| 1718 | http_proxy: http://global-http-proxy.host.local:8080 |
| 1719 | https_proxy: ${linux:system:proxy:https} |
| 1720 | no_proxy: |
| 1721 | - 192.168.0.80 |
| 1722 | - 192.168.1.80 |
| 1723 | - .domain.com |
| 1724 | - .local |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1725 | ... |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1726 | # NOTE: global defaults proxy configuration. |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1727 | proxy: |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1728 | ftp: ftp://proxy.host.local:2121 |
| 1729 | http: http://proxy.host.local:3142 |
| 1730 | https: https://proxy.host.local:3143 |
| 1731 | noproxy: |
| 1732 | - .domain.com |
| 1733 | - .local |
| 1734 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1735 | Configure the ``profile.d`` scripts |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1736 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1737 | The ``profile.d`` scripts are being sourced during ``.sh`` execution |
| 1738 | and support variable expansion in opposite to /etc/environment global |
| 1739 | settings in ``/etc/environment``. |
Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1740 | |
| 1741 | .. code-block:: yaml |
| 1742 | |
| 1743 | linux: |
| 1744 | system: |
| 1745 | profile: |
| 1746 | locales: | |
| 1747 | export LANG=C |
| 1748 | export LC_ALL=C |
| 1749 | ... |
| 1750 | vi_flavors.sh: | |
| 1751 | export PAGER=view |
| 1752 | export EDITOR=vim |
| 1753 | alias vi=vim |
| 1754 | shell_locales.sh: | |
| 1755 | export LANG=en_US |
| 1756 | export LC_ALL=en_US.UTF-8 |
| 1757 | shell_proxies.sh: | |
| 1758 | export FTP_PROXY=ftp://127.0.3.3:2121 |
| 1759 | export NO_PROXY='.local' |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1760 | |
Dmitry Teselkin | a0d31d1 | 2018-09-04 14:43:09 +0300 | [diff] [blame] | 1761 | |
| 1762 | Configure login.defs parameters |
| 1763 | ------------------------------- |
| 1764 | |
| 1765 | .. code-block:: yaml |
| 1766 | |
| 1767 | linux: |
| 1768 | system: |
| 1769 | login_defs: |
| 1770 | <opt_name>: |
| 1771 | enabled: true |
| 1772 | value: <opt_value> |
| 1773 | |
| 1774 | <opt_name> is a configurational option defined in 'man login.defs'. |
| 1775 | <opt_name> is case sensitive, should be UPPERCASE only! |
| 1776 | |
| 1777 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1778 | Linux with hosts |
| 1779 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1780 | Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``, |
| 1781 | removing entries that are not defined in model except defaults |
| 1782 | for both IPv4 and IPv6 localhost and hostname as well as FQDN. |
Ales Komarek | 417e8c5 | 2017-08-25 15:10:29 +0200 | [diff] [blame] | 1783 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1784 | We recommend using this option to verify that ``/etc/hosts`` |
| 1785 | is always in a clean state. However it is not enabled by default |
| 1786 | for security reasons. |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1787 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1788 | .. code-block:: yaml |
| 1789 | |
| 1790 | linux: |
| 1791 | network: |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1792 | purge_hosts: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1793 | host: |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1794 | # No need to define this one if purge_hosts is true |
| 1795 | hostname: |
| 1796 | address: 127.0.1.1 |
| 1797 | names: |
| 1798 | - ${linux:network:fqdn} |
| 1799 | - ${linux:network:hostname} |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1800 | node1: |
| 1801 | address: 192.168.10.200 |
| 1802 | names: |
| 1803 | - node2.domain.com |
| 1804 | - service2.domain.com |
| 1805 | node2: |
| 1806 | address: 192.168.10.201 |
| 1807 | names: |
| 1808 | - node2.domain.com |
| 1809 | - service2.domain.com |
| 1810 | |
Ales Komarek | 417e8c5 | 2017-08-25 15:10:29 +0200 | [diff] [blame] | 1811 | Linux with hosts collected from mine |
| 1812 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1813 | All DNS records defined within infrastrucuture |
| 1814 | are passed to the local hosts records or any DNS server. Only |
| 1815 | hosts with the ``grain`` parameter set to ``true`` will be propagated |
| 1816 | to the mine. |
Ales Komarek | 417e8c5 | 2017-08-25 15:10:29 +0200 | [diff] [blame] | 1817 | |
| 1818 | .. code-block:: yaml |
| 1819 | |
| 1820 | linux: |
| 1821 | network: |
| 1822 | purge_hosts: true |
| 1823 | mine_dns_records: true |
| 1824 | host: |
| 1825 | node1: |
| 1826 | address: 192.168.10.200 |
| 1827 | grain: true |
| 1828 | names: |
| 1829 | - node2.domain.com |
| 1830 | - service2.domain.com |
Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1831 | |
Michael Polenchuk | 95bc83a | 2019-01-15 18:47:48 +0400 | [diff] [blame^] | 1832 | Set up ``resolvconf's basic resolver info``, e.g. nameservers, search/domain and options: |
Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 1833 | |
| 1834 | .. code-block:: yaml |
| 1835 | |
| 1836 | linux: |
| 1837 | network: |
| 1838 | resolv: |
| 1839 | dns: |
Michael Polenchuk | 95bc83a | 2019-01-15 18:47:48 +0400 | [diff] [blame^] | 1840 | - 8.8.4.4 |
| 1841 | - 8.8.8.8 |
Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 1842 | domain: my.example.com |
| 1843 | search: |
Michael Polenchuk | 95bc83a | 2019-01-15 18:47:48 +0400 | [diff] [blame^] | 1844 | - my.example.com |
| 1845 | - example.com |
Marek Celoud | f6cd192 | 2016-12-05 13:39:49 +0100 | [diff] [blame] | 1846 | options: |
Michael Polenchuk | 95bc83a | 2019-01-15 18:47:48 +0400 | [diff] [blame^] | 1847 | - ndots:5 |
| 1848 | - timeout:2 |
| 1849 | - attempts:2 |
Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 1850 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1851 | Set up custom TX queue length for tap interfaces: |
Andrii Petrenko | 735761d | 2017-03-21 17:17:35 -0700 | [diff] [blame] | 1852 | |
| 1853 | .. code-block:: yaml |
| 1854 | |
| 1855 | linux: |
| 1856 | network: |
| 1857 | tap_custom_txqueuelen: 10000 |
| 1858 | |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1859 | DPDK OVS interfaces |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1860 | |
| 1861 | **DPDK OVS NIC** |
| 1862 | |
| 1863 | .. code-block:: yaml |
| 1864 | |
| 1865 | linux: |
| 1866 | network: |
| 1867 | bridge: openvswitch |
| 1868 | dpdk: |
| 1869 | enabled: true |
Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1870 | driver: uio/vfio |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1871 | openvswitch: |
| 1872 | pmd_cpu_mask: "0x6" |
| 1873 | dpdk_socket_mem: "1024,1024" |
| 1874 | dpdk_lcore_mask: "0x400" |
| 1875 | memory_channels: 2 |
| 1876 | interface: |
| 1877 | dpkd0: |
| 1878 | name: ${_param:dpdk_nic} |
| 1879 | pci: 0000:06:00.0 |
Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1880 | driver: igb_uio/vfio-pci |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1881 | enabled: true |
| 1882 | type: dpdk_ovs_port |
| 1883 | n_rxq: 2 |
Oleg Bondarev | 43dbbd3 | 2017-05-24 17:06:19 +0400 | [diff] [blame] | 1884 | pmd_rxq_affinity: "0:1,1:2" |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1885 | bridge: br-prv |
Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1886 | mtu: 9000 |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1887 | br-prv: |
| 1888 | enabled: true |
| 1889 | type: dpdk_ovs_bridge |
| 1890 | |
| 1891 | **DPDK OVS Bond** |
| 1892 | |
| 1893 | .. code-block:: yaml |
| 1894 | |
| 1895 | linux: |
| 1896 | network: |
| 1897 | bridge: openvswitch |
| 1898 | dpdk: |
| 1899 | enabled: true |
Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1900 | driver: uio/vfio |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1901 | openvswitch: |
| 1902 | pmd_cpu_mask: "0x6" |
| 1903 | dpdk_socket_mem: "1024,1024" |
| 1904 | dpdk_lcore_mask: "0x400" |
| 1905 | memory_channels: 2 |
| 1906 | interface: |
| 1907 | dpdk_second_nic: |
| 1908 | name: ${_param:primary_second_nic} |
| 1909 | pci: 0000:06:00.0 |
Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1910 | driver: igb_uio/vfio-pci |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1911 | bond: dpdkbond0 |
| 1912 | enabled: true |
| 1913 | type: dpdk_ovs_port |
| 1914 | n_rxq: 2 |
Oleg Bondarev | 43dbbd3 | 2017-05-24 17:06:19 +0400 | [diff] [blame] | 1915 | pmd_rxq_affinity: "0:1,1:2" |
Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1916 | mtu: 9000 |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1917 | dpdk_first_nic: |
| 1918 | name: ${_param:primary_first_nic} |
| 1919 | pci: 0000:05:00.0 |
Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1920 | driver: igb_uio/vfio-pci |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1921 | bond: dpdkbond0 |
| 1922 | enabled: true |
| 1923 | type: dpdk_ovs_port |
| 1924 | n_rxq: 2 |
Oleg Bondarev | 43dbbd3 | 2017-05-24 17:06:19 +0400 | [diff] [blame] | 1925 | pmd_rxq_affinity: "0:1,1:2" |
Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1926 | mtu: 9000 |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1927 | dpdkbond0: |
| 1928 | enabled: true |
| 1929 | bridge: br-prv |
| 1930 | type: dpdk_ovs_bond |
| 1931 | mode: active-backup |
| 1932 | br-prv: |
| 1933 | enabled: true |
| 1934 | type: dpdk_ovs_bridge |
| 1935 | |
Dzmitry Stremkouski | f619b07 | 2018-03-15 20:13:42 +0100 | [diff] [blame] | 1936 | **DPDK OVS LACP Bond with vlan tag** |
| 1937 | |
| 1938 | .. code-block:: yaml |
| 1939 | |
| 1940 | linux: |
| 1941 | network: |
| 1942 | bridge: openvswitch |
| 1943 | dpdk: |
| 1944 | enabled: true |
| 1945 | driver: uio |
| 1946 | openvswitch: |
| 1947 | pmd_cpu_mask: "0x6" |
| 1948 | dpdk_socket_mem: "1024,1024" |
| 1949 | dpdk_lcore_mask: "0x400" |
| 1950 | memory_channels: "2" |
| 1951 | interface: |
| 1952 | eth3: |
| 1953 | enabled: true |
| 1954 | type: eth |
| 1955 | proto: manual |
| 1956 | name: ${_param:tenant_first_nic} |
| 1957 | eth4: |
| 1958 | enabled: true |
| 1959 | type: eth |
| 1960 | proto: manual |
| 1961 | name: ${_param:tenant_second_nic} |
| 1962 | dpdk0: |
| 1963 | name: ${_param:tenant_first_nic} |
| 1964 | pci: "0000:81:00.0" |
| 1965 | driver: igb_uio |
| 1966 | bond: bond1 |
| 1967 | enabled: true |
| 1968 | type: dpdk_ovs_port |
| 1969 | n_rxq: 2 |
| 1970 | dpdk1: |
| 1971 | name: ${_param:tenant_second_nic} |
| 1972 | pci: "0000:81:00.1" |
| 1973 | driver: igb_uio |
| 1974 | bond: bond1 |
| 1975 | enabled: true |
| 1976 | type: dpdk_ovs_port |
| 1977 | n_rxq: 2 |
| 1978 | bond1: |
| 1979 | enabled: true |
| 1980 | bridge: br-prv |
| 1981 | type: dpdk_ovs_bond |
| 1982 | mode: balance-slb |
| 1983 | br-prv: |
| 1984 | enabled: true |
| 1985 | type: dpdk_ovs_bridge |
| 1986 | tag: ${_param:tenant_vlan} |
| 1987 | address: ${_param:tenant_address} |
| 1988 | netmask: ${_param:tenant_network_netmask} |
| 1989 | |
Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1990 | **DPDK OVS bridge for VXLAN** |
| 1991 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 1992 | If VXLAN is used as tenant segmentation, IP address must |
| 1993 | be set on ``br-prv``. |
Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1994 | |
| 1995 | .. code-block:: yaml |
| 1996 | |
| 1997 | linux: |
| 1998 | network: |
| 1999 | ... |
| 2000 | interface: |
| 2001 | br-prv: |
| 2002 | enabled: true |
| 2003 | type: dpdk_ovs_bridge |
| 2004 | address: 192.168.50.0 |
| 2005 | netmask: 255.255.255.0 |
Michael Polenchuk | d173d55 | 2018-01-22 15:22:47 +0400 | [diff] [blame] | 2006 | tag: 101 |
Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 2007 | mtu: 9000 |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 2008 | |
Oleksii Chupryn | e2151ff | 2018-03-13 16:01:12 +0200 | [diff] [blame] | 2009 | **DPDK OVS bridge with Linux network interface** |
| 2010 | |
| 2011 | .. code-block:: yaml |
| 2012 | |
| 2013 | linux: |
| 2014 | network: |
| 2015 | ... |
| 2016 | interface: |
| 2017 | eth0: |
| 2018 | type: eth |
| 2019 | ovs_bridge: br-prv |
| 2020 | ... |
| 2021 | br-prv: |
| 2022 | enabled: true |
| 2023 | type: dpdk_ovs_bridge |
| 2024 | ... |
| 2025 | |
Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 2026 | Linux storage |
| 2027 | ------------- |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 2028 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2029 | Linux with mounted Samba: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 2030 | |
| 2031 | .. code-block:: yaml |
| 2032 | |
| 2033 | linux: |
| 2034 | storage: |
| 2035 | enabled: true |
| 2036 | mount: |
| 2037 | samba1: |
Simon Pasquier | 376262a | 2016-11-16 15:21:51 +0100 | [diff] [blame] | 2038 | - enabled: true |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 2039 | - path: /media/myuser/public/ |
| 2040 | - device: //192.168.0.1/storage |
| 2041 | - file_system: cifs |
| 2042 | - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm |
| 2043 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2044 | NFS mount: |
Jiri Broulik | b017f93 | 2017-03-31 13:55:36 +0200 | [diff] [blame] | 2045 | |
| 2046 | .. code-block:: yaml |
| 2047 | |
| 2048 | linux: |
| 2049 | storage: |
| 2050 | enabled: true |
| 2051 | mount: |
| 2052 | nfs_glance: |
| 2053 | enabled: true |
| 2054 | path: /var/lib/glance/images |
| 2055 | device: 172.16.10.110:/var/nfs/glance |
| 2056 | file_system: nfs |
| 2057 | opts: rw,sync |
| 2058 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2059 | File swap configuration: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 2060 | |
| 2061 | .. code-block:: yaml |
| 2062 | |
| 2063 | linux: |
| 2064 | storage: |
| 2065 | enabled: true |
| 2066 | swap: |
| 2067 | file: |
| 2068 | enabled: true |
| 2069 | engine: file |
| 2070 | device: /swapfile |
| 2071 | size: 1024 |
| 2072 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2073 | Partition swap configuration: |
Lachlan Evenson | 3067651 | 2016-01-22 15:43:28 -0800 | [diff] [blame] | 2074 | |
| 2075 | .. code-block:: yaml |
| 2076 | |
| 2077 | linux: |
| 2078 | storage: |
| 2079 | enabled: true |
| 2080 | swap: |
| 2081 | partition: |
| 2082 | enabled: true |
| 2083 | engine: partition |
| 2084 | device: /dev/vg0/swap |
| 2085 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2086 | LVM group ``vg1`` with one device and ``data`` volume mounted |
| 2087 | into ``/mnt/data``. |
Filip Pytloun | c8a001a | 2015-12-15 14:09:19 +0100 | [diff] [blame] | 2088 | |
| 2089 | .. code-block:: yaml |
| 2090 | |
| 2091 | parameters: |
| 2092 | linux: |
| 2093 | storage: |
| 2094 | mount: |
| 2095 | data: |
Simon Pasquier | 376262a | 2016-11-16 15:21:51 +0100 | [diff] [blame] | 2096 | enabled: true |
Filip Pytloun | c8a001a | 2015-12-15 14:09:19 +0100 | [diff] [blame] | 2097 | device: /dev/vg1/data |
| 2098 | file_system: ext4 |
| 2099 | path: /mnt/data |
| 2100 | lvm: |
| 2101 | vg1: |
| 2102 | enabled: true |
| 2103 | devices: |
| 2104 | - /dev/sdb |
| 2105 | volume: |
| 2106 | data: |
| 2107 | size: 40G |
| 2108 | mount: ${linux:storage:mount:data} |
root | 40bb5e7 | 2019-01-11 08:55:32 +0000 | [diff] [blame] | 2109 | # When set they will take precedence over filters aget from volume groups. |
| 2110 | lvm_filters: |
| 2111 | 10: |
| 2112 | enabled: True |
| 2113 | value: "a|loop|" |
| 2114 | 20: |
| 2115 | enabled: True |
| 2116 | value: "r|/dev/hdc|" |
| 2117 | 30: |
| 2118 | enabled: True |
| 2119 | value: "a|/dev/ide|" |
| 2120 | 40: |
| 2121 | enabled: True |
| 2122 | value: "r|.*|" |
Filip Pytloun | c8a001a | 2015-12-15 14:09:19 +0100 | [diff] [blame] | 2123 | |
Jakub Pavlik | 4f74214 | 2017-08-08 15:05:50 +0200 | [diff] [blame] | 2124 | Create partitions on disk. Specify size in MB. It expects empty |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2125 | disk without any existing partitions. |
| 2126 | Set ``startsector=1`` if you want to start partitions from ``2048``. |
Jakub Pavlik | 4f74214 | 2017-08-08 15:05:50 +0200 | [diff] [blame] | 2127 | |
| 2128 | .. code-block:: yaml |
| 2129 | |
| 2130 | linux: |
| 2131 | storage: |
| 2132 | disk: |
| 2133 | first_drive: |
Piotr Kruk | d51911b | 2017-12-04 11:27:08 +0100 | [diff] [blame] | 2134 | startsector: 1 |
Jakub Pavlik | 4f74214 | 2017-08-08 15:05:50 +0200 | [diff] [blame] | 2135 | name: /dev/loop1 |
| 2136 | type: gpt |
| 2137 | partitions: |
| 2138 | - size: 200 #size in MB |
| 2139 | type: fat32 |
| 2140 | - size: 300 #size in MB |
Jakub Pavlik | 8e2140a | 2017-08-14 23:29:57 +0200 | [diff] [blame] | 2141 | mkfs: True |
| 2142 | type: xfs |
Jakub Pavlik | 4f74214 | 2017-08-08 15:05:50 +0200 | [diff] [blame] | 2143 | /dev/vda1: |
| 2144 | partitions: |
| 2145 | - size: 5 |
| 2146 | type: ext2 |
| 2147 | - size: 10 |
| 2148 | type: ext4 |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 2149 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2150 | Multipath with Fujitsu Eternus DXL: |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 2151 | |
| 2152 | .. code-block:: yaml |
| 2153 | |
| 2154 | parameters: |
| 2155 | linux: |
| 2156 | storage: |
| 2157 | multipath: |
| 2158 | enabled: true |
| 2159 | blacklist_devices: |
| 2160 | - /dev/sda |
| 2161 | - /dev/sdb |
| 2162 | backends: |
| 2163 | - fujitsu_eternus_dxl |
| 2164 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2165 | Multipath with Hitachi VSP 1000: |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 2166 | |
| 2167 | .. code-block:: yaml |
| 2168 | |
| 2169 | parameters: |
| 2170 | linux: |
| 2171 | storage: |
| 2172 | multipath: |
| 2173 | enabled: true |
| 2174 | blacklist_devices: |
| 2175 | - /dev/sda |
| 2176 | - /dev/sdb |
| 2177 | backends: |
| 2178 | - hitachi_vsp1000 |
| 2179 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2180 | Multipath with IBM Storwize: |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 2181 | |
| 2182 | .. code-block:: yaml |
| 2183 | |
| 2184 | parameters: |
| 2185 | linux: |
| 2186 | storage: |
| 2187 | multipath: |
| 2188 | enabled: true |
| 2189 | blacklist_devices: |
| 2190 | - /dev/sda |
| 2191 | - /dev/sdb |
| 2192 | backends: |
| 2193 | - ibm_storwize |
| 2194 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2195 | Multipath with multiple backends: |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 2196 | |
| 2197 | .. code-block:: yaml |
| 2198 | |
| 2199 | parameters: |
| 2200 | linux: |
| 2201 | storage: |
| 2202 | multipath: |
| 2203 | enabled: true |
| 2204 | blacklist_devices: |
| 2205 | - /dev/sda |
| 2206 | - /dev/sdb |
| 2207 | - /dev/sdc |
| 2208 | - /dev/sdd |
| 2209 | backends: |
| 2210 | - ibm_storwize |
| 2211 | - fujitsu_eternus_dxl |
| 2212 | - hitachi_vsp1000 |
| 2213 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2214 | PAM LDAP integration: |
Dmitry Stremkouski | 7d8d67a | 2017-11-15 13:08:19 +0300 | [diff] [blame] | 2215 | |
| 2216 | .. code-block:: yaml |
| 2217 | |
| 2218 | parameters: |
| 2219 | linux: |
| 2220 | system: |
| 2221 | auth: |
| 2222 | enabled: true |
Dzmitry Stremkouski | 602735d | 2018-05-09 22:31:39 +0200 | [diff] [blame] | 2223 | mkhomedir: |
| 2224 | enabled: true |
| 2225 | umask: 0027 |
Dmitry Stremkouski | 7d8d67a | 2017-11-15 13:08:19 +0300 | [diff] [blame] | 2226 | ldap: |
| 2227 | enabled: true |
| 2228 | binddn: cn=bind,ou=service_users,dc=example,dc=com |
| 2229 | bindpw: secret |
| 2230 | uri: ldap://127.0.0.1 |
| 2231 | base: ou=users,dc=example,dc=com |
| 2232 | ldap_version: 3 |
| 2233 | pagesize: 65536 |
| 2234 | referrals: off |
| 2235 | filter: |
| 2236 | passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*)) |
| 2237 | shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*)) |
| 2238 | group: (&(objectClass=group)(gidNumber=*)) |
| 2239 | |
Gleb Galkin | 93b9ae9 | 2018-10-18 13:57:30 +0300 | [diff] [blame] | 2240 | PAM duo 2FA integration |
| 2241 | |
| 2242 | .. code-block:: yaml |
| 2243 | |
| 2244 | parameters: |
| 2245 | linux: |
| 2246 | system: |
| 2247 | auth: |
| 2248 | enabled: true |
| 2249 | duo: |
| 2250 | enabled: true |
| 2251 | duo_host: localhost |
| 2252 | duo_ikey: DUO-INTEGRATION-KEY |
| 2253 | duo_skey: DUO-SECRET-KEY |
| 2254 | |
| 2255 | duo package version may be specified (optional) |
| 2256 | |
| 2257 | .. code-block:: yaml |
| 2258 | |
| 2259 | linux: |
| 2260 | system: |
| 2261 | package: |
| 2262 | duo-unix: |
| 2263 | version: 1.10.1-0 |
| 2264 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2265 | Disabled multipath (the default setup): |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 2266 | |
| 2267 | .. code-block:: yaml |
| 2268 | |
| 2269 | parameters: |
| 2270 | linux: |
| 2271 | storage: |
| 2272 | multipath: |
| 2273 | enabled: false |
| 2274 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2275 | Linux with local loopback device: |
Simon Pasquier | 375001e | 2017-01-26 13:22:33 +0100 | [diff] [blame] | 2276 | |
| 2277 | .. code-block:: yaml |
| 2278 | |
| 2279 | linux: |
| 2280 | storage: |
| 2281 | loopback: |
| 2282 | disk1: |
| 2283 | file: /srv/disk1 |
| 2284 | size: 50G |
| 2285 | |
Filip Pytloun | b2c8f85 | 2016-11-21 17:03:43 +0100 | [diff] [blame] | 2286 | External config generation |
| 2287 | -------------------------- |
| 2288 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2289 | You are able to use config support metadata between formulas |
| 2290 | and only generate configuration files for external use, for example, Docker, and so on. |
Filip Pytloun | b2c8f85 | 2016-11-21 17:03:43 +0100 | [diff] [blame] | 2291 | |
| 2292 | .. code-block:: yaml |
| 2293 | |
| 2294 | parameters: |
| 2295 | linux: |
| 2296 | system: |
| 2297 | config: |
| 2298 | pillar: |
| 2299 | jenkins: |
| 2300 | master: |
| 2301 | home: /srv/volumes/jenkins |
| 2302 | approved_scripts: |
| 2303 | - method java.net.URL openConnection |
| 2304 | credentials: |
| 2305 | - type: username_password |
| 2306 | scope: global |
| 2307 | id: test |
| 2308 | desc: Testing credentials |
| 2309 | username: test |
| 2310 | password: test |
| 2311 | |
Vladimir Eremin | ccf2884 | 2017-04-10 23:52:10 +0300 | [diff] [blame] | 2312 | Netconsole Remote Kernel Logging |
| 2313 | -------------------------------- |
| 2314 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2315 | Netconsole logger can be configured for the configfs-enabled kernels |
| 2316 | (``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration |
| 2317 | applies both in runtime (if network is already configured), |
| 2318 | and on-boot after an interface initialization. |
Vladimir Eremin | ccf2884 | 2017-04-10 23:52:10 +0300 | [diff] [blame] | 2319 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2320 | .. note:: |
| 2321 | |
| 2322 | * Receiver can be located only on the same L3 domain |
| 2323 | (or you need to configure gateway MAC manually). |
| 2324 | * The Receiver MAC is detected only on configuration time. |
| 2325 | * Using broadcast MAC is not recommended. |
Vladimir Eremin | ccf2884 | 2017-04-10 23:52:10 +0300 | [diff] [blame] | 2326 | |
| 2327 | .. code-block:: yaml |
| 2328 | |
| 2329 | parameters: |
| 2330 | linux: |
| 2331 | system: |
| 2332 | netconsole: |
| 2333 | enabled: true |
| 2334 | port: 514 (optional) |
| 2335 | loglevel: debug (optional) |
| 2336 | target: |
| 2337 | 192.168.0.1: |
| 2338 | interface: bond0 |
| 2339 | mac: "ff:ff:ff:ff:ff:ff" (optional) |
Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 2340 | |
Dzmitry Stremkouski | d1a268b | 2018-10-03 16:36:04 +0200 | [diff] [blame] | 2341 | Check network params on the environment |
| 2342 | --------------------------------------- |
| 2343 | |
| 2344 | Grab nics and nics states |
| 2345 | |
| 2346 | .. code-block:: bash |
| 2347 | |
| 2348 | salt osd001\* net_checks.get_nics |
| 2349 | |
| 2350 | **Example of system output:** |
| 2351 | |
| 2352 | .. code-block:: bash |
| 2353 | |
| 2354 | osd001.domain.com: |
| 2355 | |_ |
| 2356 | - bond0 |
| 2357 | - None |
| 2358 | - 1e:c8:64:42:23:b9 |
| 2359 | - 0 |
| 2360 | - 1500 |
| 2361 | |_ |
| 2362 | - bond1 |
| 2363 | - None |
| 2364 | - 3c:fd:fe:27:3b:00 |
| 2365 | - 1 |
| 2366 | - 9100 |
| 2367 | |_ |
| 2368 | - fourty1 |
| 2369 | - None |
| 2370 | - 3c:fd:fe:27:3b:00 |
| 2371 | - 1 |
| 2372 | - 9100 |
| 2373 | |_ |
| 2374 | - fourty2 |
| 2375 | - None |
| 2376 | - 3c:fd:fe:27:3b:02 |
| 2377 | - 1 |
| 2378 | - 9100 |
| 2379 | |
| 2380 | Grab 10G nics PCI addresses for hugepages setup |
| 2381 | |
| 2382 | .. code-block:: bash |
| 2383 | |
| 2384 | salt cmp001\* net_checks.get_ten_pci |
| 2385 | |
| 2386 | **Example of system output:** |
| 2387 | |
| 2388 | .. code-block:: bash |
| 2389 | |
| 2390 | cmp001.domain.com: |
| 2391 | |_ |
| 2392 | - ten1 |
| 2393 | - 0000:19:00.0 |
| 2394 | |_ |
| 2395 | - ten2 |
| 2396 | - 0000:19:00.1 |
| 2397 | |_ |
| 2398 | - ten3 |
| 2399 | - 0000:19:00.2 |
| 2400 | |_ |
| 2401 | - ten4 |
| 2402 | - 0000:19:00.3 |
| 2403 | |
| 2404 | Grab ip address for an interface |
| 2405 | |
| 2406 | .. code-block:: bash |
| 2407 | |
| 2408 | salt cmp001\* net_checks.get_ip iface=one4 |
| 2409 | |
| 2410 | **Example of system output:** |
| 2411 | |
| 2412 | .. code-block:: bash |
| 2413 | |
| 2414 | cmp001.domain.com: |
| 2415 | 10.200.177.101 |
| 2416 | |
| 2417 | Grab ip addresses map |
| 2418 | |
| 2419 | .. code-block:: bash |
| 2420 | |
| 2421 | salt-call net_checks.nodes_addresses |
| 2422 | |
| 2423 | **Example of system output:** |
| 2424 | |
| 2425 | .. code-block:: bash |
| 2426 | |
| 2427 | local: |
| 2428 | |_ |
| 2429 | - cid01.domain.com |
| 2430 | |_ |
| 2431 | |_ |
| 2432 | - pxe |
| 2433 | - 10.200.177.91 |
| 2434 | |_ |
| 2435 | - control |
| 2436 | - 10.200.178.91 |
| 2437 | |_ |
| 2438 | - cmn02.domain.com |
| 2439 | |_ |
| 2440 | |_ |
| 2441 | - storage_access |
| 2442 | - 10.200.181.67 |
| 2443 | |_ |
| 2444 | - pxe |
| 2445 | - 10.200.177.67 |
| 2446 | |_ |
| 2447 | - control |
| 2448 | - 10.200.178.67 |
| 2449 | |_ |
| 2450 | - cmp010.domain.com |
| 2451 | |_ |
| 2452 | |_ |
| 2453 | - pxe |
| 2454 | - 10.200.177.110 |
| 2455 | |_ |
| 2456 | - storage_access |
| 2457 | - 10.200.181.110 |
| 2458 | |_ |
| 2459 | - control |
| 2460 | - 10.200.178.110 |
| 2461 | |_ |
| 2462 | - vxlan |
| 2463 | - 10.200.179.110 |
| 2464 | |
| 2465 | Verify full mesh connectivity |
| 2466 | |
| 2467 | .. code-block:: bash |
| 2468 | |
| 2469 | salt-call net_checks.ping_check |
| 2470 | |
| 2471 | **Example of positive system output:** |
| 2472 | |
| 2473 | .. code-block:: bash |
| 2474 | |
| 2475 | ['PASSED'] |
| 2476 | [INFO ] ['PASSED'] |
| 2477 | local: |
| 2478 | True |
| 2479 | |
| 2480 | **Example of system output in case of failure:** |
| 2481 | |
| 2482 | .. code-block:: bash |
| 2483 | |
| 2484 | FAILED |
| 2485 | [ERROR ] FAILED |
| 2486 | ['control: 10.0.1.92 -> 10.0.1.224: Failed'] |
| 2487 | ['control: 10.0.1.93 -> 10.0.1.224: Failed'] |
| 2488 | ['control: 10.0.1.51 -> 10.0.1.224: Failed'] |
| 2489 | ['control: 10.0.1.102 -> 10.0.1.224: Failed'] |
| 2490 | ['control: 10.0.1.13 -> 10.0.1.224: Failed'] |
| 2491 | ['control: 10.0.1.81 -> 10.0.1.224: Failed'] |
| 2492 | local: |
| 2493 | False |
| 2494 | |
| 2495 | For this feature to work, please mark addresses with some role. |
| 2496 | Otherwise 'default' role is assumed and mesh would consist of all |
| 2497 | addresses on the environment. |
| 2498 | |
| 2499 | Mesh mark is needed only for interfaces which are enabled and have |
| 2500 | ip address assigned. |
| 2501 | |
| 2502 | Checking dhcp pxe network meaningless, as it is used for salt |
| 2503 | master vs minion communications, therefore treated as checked. |
| 2504 | |
| 2505 | .. code-block:: yaml |
| 2506 | |
| 2507 | parameters: |
| 2508 | linux: |
| 2509 | network: |
| 2510 | interface: |
| 2511 | ens3: |
| 2512 | enabled: true |
| 2513 | type: eth |
| 2514 | proto: static |
| 2515 | address: ${_param:deploy_address} |
| 2516 | netmask: ${_param:deploy_network_netmask} |
| 2517 | gateway: ${_param:deploy_network_gateway} |
| 2518 | mesh: pxe |
| 2519 | |
| 2520 | Check pillars for ip address duplicates |
| 2521 | |
| 2522 | .. code-block:: bash |
| 2523 | |
| 2524 | salt-call net_checks.verify_addresses |
| 2525 | |
| 2526 | **Example of positive system output:** |
| 2527 | |
| 2528 | .. code-block:: bash |
| 2529 | |
| 2530 | ['PASSED'] |
| 2531 | [INFO ] ['PASSED'] |
| 2532 | local: |
| 2533 | True |
| 2534 | |
| 2535 | **Example of system output in case of failure:** |
| 2536 | |
| 2537 | .. code-block:: bash |
| 2538 | |
| 2539 | FAILED. Duplicates found |
| 2540 | [ERROR ] FAILED. Duplicates found |
| 2541 | ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224'] |
| 2542 | [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224'] |
| 2543 | local: |
| 2544 | False |
| 2545 | |
| 2546 | Generate csv report for the env |
| 2547 | |
| 2548 | .. code-block:: bash |
| 2549 | |
| 2550 | salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \ |
| 2551 | | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \ |
| 2552 | | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr' |
| 2553 | |
| 2554 | **Example of system output:** |
| 2555 | |
| 2556 | .. code-block:: bash |
| 2557 | |
| 2558 | server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr |
| 2559 | cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,, |
| 2560 | cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,, |
| 2561 | cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,, |
| 2562 | cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,, |
| 2563 | cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,, |
| 2564 | cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,, |
| 2565 | cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,, |
| 2566 | cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,, |
| 2567 | cmp010.domain.com,one2,None,b4:96:91:10:5b:39,1,1500,f0:4b:3a:8f:75:40,exnfvaa18-20,548,ge-0/0/22 |
| 2568 | cmp010.domain.com,one3,None,b4:96:91:10:5b:3a,1,1500,f0:4b:3a:8f:75:40,exnfvaa18-20,547,ge-0/0/21 |
| 2569 | cmp010.domain.com,one4,10.200.177.110,b4:96:91:10:5b:3b,1,1500,f0:4b:3a:8f:75:40,exnfvaa18-20,546,ge-0/0/20 |
| 2570 | cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,, |
| 2571 | cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,, |
| 2572 | cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,, |
| 2573 | ... |
| 2574 | |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 2575 | Usage |
| 2576 | ===== |
| 2577 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2578 | Set MTU of the eth0 network interface to 1400: |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 2579 | |
| 2580 | .. code-block:: bash |
| 2581 | |
OlgaGusarenko | 2828f5f | 2018-07-30 19:37:05 +0300 | [diff] [blame] | 2582 | ip link set dev eth0 mtu 1400 |
Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 2583 | |
| 2584 | Read more |
| 2585 | ========= |
| 2586 | |
| 2587 | * https://www.archlinux.org/ |
| 2588 | * http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu |