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