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