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