| Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 1 | ============ | 
|  | 2 | Linux Fomula | 
|  | 3 | ============ | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 4 |  | 
|  | 5 | Linux Operating Systems. | 
|  | 6 |  | 
|  | 7 | * Ubuntu | 
|  | 8 | * CentOS | 
|  | 9 | * RedHat | 
|  | 10 | * Fedora | 
|  | 11 | * Arch | 
|  | 12 |  | 
| Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 13 | Sample Pillars | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 14 | ============== | 
|  | 15 |  | 
| Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 16 |  | 
|  | 17 | Linux System | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 18 | ------------ | 
|  | 19 |  | 
|  | 20 | Basic Linux box | 
|  | 21 |  | 
|  | 22 | .. code-block:: yaml | 
|  | 23 |  | 
|  | 24 | linux: | 
|  | 25 | system: | 
|  | 26 | enabled: true | 
|  | 27 | name: 'node1' | 
|  | 28 | domain: 'domain.com' | 
|  | 29 | cluster: 'system' | 
|  | 30 | environment: prod | 
|  | 31 | timezone: 'Europe/Prague' | 
|  | 32 | utc: true | 
|  | 33 |  | 
| azvyagintsev | 967af13 | 2017-06-12 12:25:24 +0300 | [diff] [blame] | 34 | Linux with system users, some with password set: | 
|  | 35 | .. WARNING:: | 
|  | 36 | If no 'password' variable has been passed - any predifined password | 
|  | 37 | will be removed. | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 38 |  | 
|  | 39 | .. code-block:: yaml | 
|  | 40 |  | 
|  | 41 | linux: | 
|  | 42 | system: | 
|  | 43 | ... | 
|  | 44 | user: | 
|  | 45 | jdoe: | 
|  | 46 | name: 'jdoe' | 
|  | 47 | enabled: true | 
|  | 48 | sudo: true | 
|  | 49 | shell: /bin/bash | 
|  | 50 | full_name: 'Jonh Doe' | 
|  | 51 | home: '/home/jdoe' | 
|  | 52 | email: 'jonh@doe.com' | 
|  | 53 | jsmith: | 
|  | 54 | name: 'jsmith' | 
|  | 55 | enabled: true | 
| azvyagintsev | 967af13 | 2017-06-12 12:25:24 +0300 | [diff] [blame] | 56 | full_name: 'With clear password' | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 57 | home: '/home/jsmith' | 
| azvyagintsev | 967af13 | 2017-06-12 12:25:24 +0300 | [diff] [blame] | 58 | hash_password: true | 
|  | 59 | password: "userpassword" | 
|  | 60 | mark: | 
|  | 61 | name: 'mark' | 
|  | 62 | enabled: true | 
|  | 63 | full_name: "unchange password' | 
|  | 64 | home: '/home/mark' | 
|  | 65 | password: false | 
|  | 66 | elizabeth: | 
|  | 67 | name: 'elizabeth' | 
|  | 68 | enabled: true | 
|  | 69 | full_name: 'With hased password' | 
|  | 70 | home: '/home/elizabeth' | 
|  | 71 | password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10" | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 72 |  | 
| Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 73 | Configure sudo for users and groups under ``/etc/sudoers.d/``. | 
|  | 74 | This ways ``linux.system.sudo`` pillar map to actual sudo attributes: | 
|  | 75 |  | 
|  | 76 | .. code-block:: jinja | 
| Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 77 |  | 
| Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 78 | # simplified template: | 
|  | 79 | Cmds_Alias {{ alias }}={{ commands }} | 
|  | 80 | {{ user }}   {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }} | 
|  | 81 | %{{ group }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }} | 
|  | 82 |  | 
|  | 83 | # when rendered: | 
|  | 84 | saltuser1 ALL=(ALL) NOPASSWD: ALL | 
|  | 85 |  | 
| Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 86 | .. code-block:: yaml | 
| Aleš Komárek | 6357299 | 2017-04-11 13:16:44 +0200 | [diff] [blame] | 87 |  | 
| Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 88 | linux: | 
|  | 89 | system: | 
|  | 90 | sudo: | 
|  | 91 | enabled: true | 
| Tomas Kamm | d8eb300 | 2017-05-08 19:30:29 +0200 | [diff] [blame] | 92 | aliases: | 
| Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 93 | host: | 
|  | 94 | LOCAL: | 
|  | 95 | - localhost | 
|  | 96 | PRODUCTION: | 
|  | 97 | - db1 | 
|  | 98 | - db2 | 
|  | 99 | runas: | 
|  | 100 | DBA: | 
|  | 101 | - postgres | 
|  | 102 | - mysql | 
|  | 103 | SALT: | 
|  | 104 | - root | 
|  | 105 | command: | 
|  | 106 | # Note: This is not 100% safe when ALL keyword is used, user still may modify configs and hide his actions. | 
|  | 107 | #       Best practice is to specify full list of commands user is allowed to run. | 
|  | 108 | SUPPORT_RESTRICTED: | 
|  | 109 | - /bin/vi /etc/sudoers* | 
|  | 110 | - /bin/vim /etc/sudoers* | 
|  | 111 | - /bin/nano /etc/sudoers* | 
|  | 112 | - /bin/emacs /etc/sudoers* | 
|  | 113 | - /bin/su - root | 
|  | 114 | - /bin/su - | 
|  | 115 | - /bin/su | 
|  | 116 | - /usr/sbin/visudo | 
|  | 117 | SUPPORT_SHELLS: | 
|  | 118 | - /bin/sh | 
|  | 119 | - /bin/ksh | 
|  | 120 | - /bin/bash | 
|  | 121 | - /bin/rbash | 
|  | 122 | - /bin/dash | 
|  | 123 | - /bin/zsh | 
|  | 124 | - /bin/csh | 
|  | 125 | - /bin/fish | 
|  | 126 | - /bin/tcsh | 
|  | 127 | - /usr/bin/login | 
|  | 128 | - /usr/bin/su | 
|  | 129 | - /usr/su | 
|  | 130 | ALL_SALT_SAFE: | 
|  | 131 | - /usr/bin/salt state* | 
|  | 132 | - /usr/bin/salt service* | 
|  | 133 | - /usr/bin/salt pillar* | 
|  | 134 | - /usr/bin/salt grains* | 
|  | 135 | - /usr/bin/salt saltutil* | 
|  | 136 | - /usr/bin/salt-call state* | 
|  | 137 | - /usr/bin/salt-call service* | 
|  | 138 | - /usr/bin/salt-call pillar* | 
|  | 139 | - /usr/bin/salt-call grains* | 
|  | 140 | - /usr/bin/salt-call saltutil* | 
|  | 141 | SALT_TRUSTED: | 
|  | 142 | - /usr/bin/salt* | 
|  | 143 | users: | 
|  | 144 | # saltuser1 with default values: saltuser1 ALL=(ALL) NOPASSWD: ALL | 
|  | 145 | saltuser1: {} | 
|  | 146 | saltuser2: | 
|  | 147 | hosts: | 
|  | 148 | - LOCAL | 
|  | 149 | # User Alias DBA | 
|  | 150 | DBA: | 
|  | 151 | hosts: | 
|  | 152 | - ALL | 
|  | 153 | commands: | 
|  | 154 | - ALL_SALT_SAFE | 
|  | 155 | groups: | 
|  | 156 | db-ops: | 
|  | 157 | hosts: | 
|  | 158 | - ALL | 
|  | 159 | - '!PRODUCTION' | 
|  | 160 | runas: | 
|  | 161 | - DBA | 
|  | 162 | commands: | 
|  | 163 | - /bin/cat * | 
|  | 164 | - /bin/less * | 
|  | 165 | - /bin/ls * | 
|  | 166 | salt-ops: | 
|  | 167 | hosts: | 
|  | 168 | - 'ALL' | 
|  | 169 | runas: | 
|  | 170 | - SALT | 
|  | 171 | commands: | 
|  | 172 | - SUPPORT_SHELLS | 
|  | 173 | salt-ops-2nd: | 
|  | 174 | name: salt-ops | 
|  | 175 | nopasswd: false | 
| Jakub Josef | 7a9d9b9 | 2017-05-16 11:39:01 +0200 | [diff] [blame] | 176 | setenv: true # Enable sudo -E option | 
| Petr Michalec | 1c4c8d8 | 2017-02-28 19:09:21 +0100 | [diff] [blame] | 177 | runas: | 
|  | 178 | - DBA | 
|  | 179 | commands: | 
|  | 180 | - ALL | 
|  | 181 | - '!SUPPORT_SHELLS' | 
|  | 182 | - '!SUPPORT_RESTRICTED' | 
|  | 183 |  | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 184 | Linux with package, latest version | 
|  | 185 |  | 
|  | 186 | .. code-block:: yaml | 
|  | 187 |  | 
|  | 188 | linux: | 
|  | 189 | system: | 
|  | 190 | ... | 
|  | 191 | package: | 
|  | 192 | package-name: | 
|  | 193 | version: latest | 
|  | 194 |  | 
|  | 195 | Linux with package from certail repo, version with no upgrades | 
|  | 196 |  | 
|  | 197 | .. code-block:: yaml | 
|  | 198 |  | 
|  | 199 | linux: | 
|  | 200 | system: | 
|  | 201 | ... | 
|  | 202 | package: | 
|  | 203 | package-name: | 
|  | 204 | version: 2132.323 | 
|  | 205 | repo: 'custom-repo' | 
|  | 206 | hold: true | 
|  | 207 |  | 
|  | 208 | Linux with package from certail repo, version with no GPG verification | 
|  | 209 |  | 
|  | 210 | .. code-block:: yaml | 
|  | 211 |  | 
|  | 212 | linux: | 
|  | 213 | system: | 
|  | 214 | ... | 
|  | 215 | package: | 
|  | 216 | package-name: | 
|  | 217 | version: 2132.323 | 
|  | 218 | repo: 'custom-repo' | 
|  | 219 | verify: false | 
|  | 220 |  | 
| Bruno Binet | 69a9d8d | 2017-02-16 22:34:32 +0100 | [diff] [blame] | 221 | Linux with autoupdates (automatically install security package updates) | 
|  | 222 |  | 
|  | 223 | .. code-block:: yaml | 
|  | 224 |  | 
|  | 225 | linux: | 
|  | 226 | system: | 
|  | 227 | ... | 
|  | 228 | autoupdates: | 
|  | 229 | enabled: true | 
|  | 230 | mail: root@localhost | 
|  | 231 | mail_only_on_error: true | 
|  | 232 | remove_unused_dependencies: false | 
|  | 233 | automatic_reboot: true | 
|  | 234 | automatic_reboot_time: "02:00" | 
|  | 235 |  | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 236 | Linux with cron jobs | 
| Filip Pytloun | 9122222 | 2017-08-04 10:55:27 +0200 | [diff] [blame] | 237 | By default it will use name as an identifier, unless identifier key is | 
|  | 238 | explicitly set or False (then it will use Salt's default behavior which is | 
|  | 239 | identifier same as command resulting in not being able to change it) | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 240 |  | 
|  | 241 | .. code-block:: yaml | 
|  | 242 |  | 
|  | 243 | linux: | 
|  | 244 | system: | 
|  | 245 | ... | 
|  | 246 | job: | 
|  | 247 | cmd1: | 
|  | 248 | command: '/cmd/to/run' | 
| Filip Pytloun | 9122222 | 2017-08-04 10:55:27 +0200 | [diff] [blame] | 249 | identifier: cmd1 | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 250 | enabled: true | 
|  | 251 | user: 'root' | 
|  | 252 | hour: 2 | 
|  | 253 | minute: 0 | 
|  | 254 |  | 
| Filip Pytloun | d0a29e7 | 2015-11-30 15:23:34 +0100 | [diff] [blame] | 255 | Linux security limits (limit sensu user memory usage to max 1GB): | 
|  | 256 |  | 
|  | 257 | .. code-block:: yaml | 
|  | 258 |  | 
|  | 259 | linux: | 
|  | 260 | system: | 
|  | 261 | ... | 
|  | 262 | limit: | 
|  | 263 | sensu: | 
|  | 264 | enabled: true | 
|  | 265 | domain: sensu | 
|  | 266 | limits: | 
|  | 267 | - type: hard | 
|  | 268 | item: as | 
|  | 269 | value: 1000000 | 
|  | 270 |  | 
| Filip Pytloun | 7fee054 | 2015-10-15 11:19:24 +0200 | [diff] [blame] | 271 | Enable autologin on tty1 (may work only for Ubuntu 14.04): | 
|  | 272 |  | 
|  | 273 | .. code-block:: yaml | 
|  | 274 |  | 
|  | 275 | linux: | 
|  | 276 | system: | 
|  | 277 | console: | 
|  | 278 | tty1: | 
|  | 279 | autologin: root | 
| Filip Pytloun | 281d020 | 2016-01-29 14:03:51 +0100 | [diff] [blame] | 280 | # Enable serial console | 
|  | 281 | ttyS0: | 
|  | 282 | autologin: root | 
|  | 283 | rate: 115200 | 
|  | 284 | term: xterm | 
| Filip Pytloun | 7fee054 | 2015-10-15 11:19:24 +0200 | [diff] [blame] | 285 |  | 
|  | 286 | To disable set autologin to `false`. | 
|  | 287 |  | 
| Filip Pytloun | 7731b85 | 2016-02-01 11:13:47 +0100 | [diff] [blame] | 288 | Set ``policy-rc.d`` on Debian-based systems. Action can be any available | 
|  | 289 | command in ``while true`` loop and ``case`` context. | 
|  | 290 | Following will disallow dpkg to stop/start services for cassandra package automatically: | 
|  | 291 |  | 
|  | 292 | .. code-block:: yaml | 
|  | 293 |  | 
|  | 294 | linux: | 
|  | 295 | system: | 
|  | 296 | policyrcd: | 
|  | 297 | - package: cassandra | 
|  | 298 | action: exit 101 | 
|  | 299 | - package: '*' | 
|  | 300 | action: switch | 
|  | 301 |  | 
| Filip Pytloun | c49445a | 2016-04-04 14:23:20 +0200 | [diff] [blame] | 302 | Set system locales: | 
|  | 303 |  | 
|  | 304 | .. code-block:: yaml | 
|  | 305 |  | 
|  | 306 | linux: | 
|  | 307 | system: | 
|  | 308 | locale: | 
|  | 309 | en_US.UTF-8: | 
|  | 310 | default: true | 
| Filip Pytloun | ee1745f | 2016-04-04 17:39:41 +0200 | [diff] [blame] | 311 | "cs_CZ.UTF-8 UTF-8": | 
| Filip Pytloun | c49445a | 2016-04-04 14:23:20 +0200 | [diff] [blame] | 312 | enabled: true | 
|  | 313 |  | 
| Andrey Shestakov | e7cca05 | 2017-05-24 23:06:24 +0300 | [diff] [blame] | 314 | Systemd settings: | 
|  | 315 |  | 
|  | 316 | .. code-block:: yaml | 
|  | 317 |  | 
|  | 318 | linux: | 
|  | 319 | system: | 
|  | 320 | ... | 
|  | 321 | systemd: | 
|  | 322 | system: | 
|  | 323 | Manager: | 
|  | 324 | DefaultLimitNOFILE: 307200 | 
|  | 325 | DefaultLimitNPROC: 307200 | 
|  | 326 | user: | 
|  | 327 | Manager: | 
|  | 328 | DefaultLimitCPU: 2 | 
|  | 329 | DefaultLimitNPROC: 4 | 
|  | 330 |  | 
| Filip Pytloun | 8b2131e | 2017-11-08 13:29:03 +0100 | [diff] [blame] | 331 | Ensure presence of directory: | 
|  | 332 |  | 
|  | 333 | .. code-block:: yaml | 
|  | 334 |  | 
|  | 335 | linux: | 
|  | 336 | system: | 
|  | 337 | directory: | 
|  | 338 | /tmp/test: | 
|  | 339 | user: root | 
|  | 340 | group: root | 
|  | 341 | mode: 700 | 
|  | 342 | makedirs: true | 
|  | 343 |  | 
| Filip Pytloun | 281034a | 2016-01-04 18:06:22 +0100 | [diff] [blame] | 344 | Kernel | 
|  | 345 | ~~~~~~ | 
|  | 346 |  | 
|  | 347 | Install always up to date LTS kernel and headers from Ubuntu trusty: | 
|  | 348 |  | 
|  | 349 | .. code-block:: yaml | 
|  | 350 |  | 
|  | 351 | linux: | 
|  | 352 | system: | 
|  | 353 | kernel: | 
|  | 354 | type: generic | 
|  | 355 | lts: trusty | 
|  | 356 | headers: true | 
|  | 357 |  | 
| Tomáš Kukrál | ba35b21 | 2017-02-15 17:59:46 +0100 | [diff] [blame] | 358 | Load kernel modules and add them to `/etc/modules`: | 
|  | 359 |  | 
|  | 360 | .. code-block:: yaml | 
|  | 361 |  | 
|  | 362 | linux: | 
|  | 363 | system: | 
|  | 364 | kernel: | 
|  | 365 | modules: | 
|  | 366 | - nf_conntrack | 
|  | 367 | - tp_smapi | 
|  | 368 | - 8021q | 
|  | 369 |  | 
| teoyaomiqui | 32b1f7c | 2017-05-24 14:36:09 +0300 | [diff] [blame] | 370 | Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example | 
|  | 371 | will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`: | 
|  | 372 |  | 
|  | 373 | .. code-block:: yaml | 
|  | 374 |  | 
|  | 375 | linux: | 
|  | 376 | system: | 
|  | 377 | kernel: | 
|  | 378 | module: | 
|  | 379 | nf_conntrack: | 
|  | 380 | option: | 
|  | 381 | hashsize: 262144 | 
|  | 382 |  | 
|  | 383 |  | 
|  | 384 |  | 
| Filip Pytloun | 281034a | 2016-01-04 18:06:22 +0100 | [diff] [blame] | 385 | Install specific kernel version and ensure all other kernel packages are | 
|  | 386 | not present. Also install extra modules and headers for this kernel: | 
|  | 387 |  | 
|  | 388 | .. code-block:: yaml | 
|  | 389 |  | 
|  | 390 | linux: | 
|  | 391 | system: | 
|  | 392 | kernel: | 
|  | 393 | type: generic | 
|  | 394 | extra: true | 
|  | 395 | headers: true | 
|  | 396 | version: 4.2.0-22 | 
|  | 397 |  | 
| Jakub Pavlik | 32c2cb0 | 2016-01-29 12:45:29 +0100 | [diff] [blame] | 398 | Systcl kernel parameters | 
|  | 399 |  | 
|  | 400 | .. code-block:: yaml | 
|  | 401 |  | 
|  | 402 | linux: | 
|  | 403 | system: | 
|  | 404 | kernel: | 
|  | 405 | sysctl: | 
|  | 406 | net.ipv4.tcp_keepalive_intvl: 3 | 
|  | 407 | net.ipv4.tcp_keepalive_time: 30 | 
|  | 408 | net.ipv4.tcp_keepalive_probes: 8 | 
|  | 409 |  | 
| Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 410 |  | 
|  | 411 | CPU | 
|  | 412 | ~~~ | 
|  | 413 |  | 
| teoyaomiqui | 32b1f7c | 2017-05-24 14:36:09 +0300 | [diff] [blame] | 414 | Enable cpufreq governor for every cpu: | 
| Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 415 |  | 
|  | 416 | .. code-block:: yaml | 
|  | 417 |  | 
|  | 418 | linux: | 
|  | 419 | system: | 
|  | 420 | cpu: | 
|  | 421 | governor: performance | 
|  | 422 |  | 
| Filip Pytloun | 2fde88b | 2017-10-05 10:30:29 +0200 | [diff] [blame] | 423 | Certificates | 
|  | 424 | ~~~~~~~~~~~~ | 
|  | 425 |  | 
|  | 426 | Add certificate authority into system trusted CA bundle | 
|  | 427 |  | 
|  | 428 | .. code-block:: yaml | 
|  | 429 |  | 
|  | 430 | linux: | 
|  | 431 | system: | 
|  | 432 | ca_certificates: | 
|  | 433 | mycert: | | 
|  | 434 | -----BEGIN CERTIFICATE----- | 
|  | 435 | MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG | 
|  | 436 | A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz | 
|  | 437 | cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 | 
|  | 438 | MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV | 
|  | 439 | BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt | 
|  | 440 | YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN | 
|  | 441 | ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE | 
|  | 442 | BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is | 
|  | 443 | I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G | 
|  | 444 | CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do | 
|  | 445 | lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc | 
|  | 446 | AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k | 
|  | 447 | -----END CERTIFICATE----- | 
|  | 448 |  | 
| Filip Pytloun | 361096c | 2017-08-23 10:57:20 +0200 | [diff] [blame] | 449 | Sysfs | 
|  | 450 | ~~~~~ | 
|  | 451 |  | 
|  | 452 | Install sysfsutils and set sysfs attributes: | 
|  | 453 |  | 
|  | 454 | .. code-block:: yaml | 
|  | 455 |  | 
|  | 456 | linux: | 
|  | 457 | system: | 
|  | 458 | sysfs: | 
|  | 459 | scheduler: | 
|  | 460 | block/sda/queue/scheduler: deadline | 
|  | 461 | power: | 
|  | 462 | mode: | 
|  | 463 | power/state: 0660 | 
|  | 464 | owner: | 
|  | 465 | power/state: "root:power" | 
|  | 466 | devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave | 
|  | 467 |  | 
| Jakub Pavlik | b148c8c | 2017-02-12 21:30:48 +0100 | [diff] [blame] | 468 | Huge Pages | 
|  | 469 | ~~~~~~~~~~~~ | 
|  | 470 |  | 
|  | 471 | Huge Pages give a performance boost to applications that intensively deal | 
|  | 472 | with memory allocation/deallocation by decreasing memory fragmentation. | 
|  | 473 |  | 
|  | 474 | .. code-block:: yaml | 
|  | 475 |  | 
|  | 476 | linux: | 
|  | 477 | system: | 
|  | 478 | kernel: | 
|  | 479 | hugepages: | 
|  | 480 | small: | 
|  | 481 | size: 2M | 
|  | 482 | count: 107520 | 
|  | 483 | mount_point: /mnt/hugepages_2MB | 
|  | 484 | mount: false/true # default false | 
|  | 485 | large: | 
|  | 486 | default: true # default automatically mounted | 
|  | 487 | size: 1G | 
|  | 488 | count: 210 | 
|  | 489 | mount_point: /mnt/hugepages_1GB | 
|  | 490 |  | 
|  | 491 | Note: not recommended to use both pagesizes in concurrently. | 
| Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 492 |  | 
| Jakub Pavlik | 5398d87 | 2017-02-13 22:30:47 +0100 | [diff] [blame] | 493 | Intel SR-IOV | 
|  | 494 | ~~~~~~~~~~~~ | 
|  | 495 |  | 
|  | 496 | PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV) specification defines a standardized mechanism to virtualize PCIe devices. The mechanism can virtualize a single PCIe Ethernet controller to appear as multiple PCIe devices. | 
|  | 497 |  | 
|  | 498 | .. code-block:: yaml | 
|  | 499 |  | 
|  | 500 | linux: | 
|  | 501 | system: | 
|  | 502 | kernel: | 
|  | 503 | sriov: True | 
|  | 504 | unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround | 
|  | 505 | rc: | 
|  | 506 | local: | | 
|  | 507 | #!/bin/sh -e | 
|  | 508 | # Enable 7 VF on eth1 | 
|  | 509 | echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a | 
|  | 510 | exit 0 | 
|  | 511 |  | 
| Jakub Pavlik | 6c9ead1 | 2017-02-16 21:53:13 +0100 | [diff] [blame] | 512 | Isolate CPU options | 
|  | 513 | ~~~~~~~~~~~~~~~~~~~ | 
|  | 514 |  | 
|  | 515 | Remove the specified CPUs, as defined by the cpu_number values, from the general kernel | 
|  | 516 | SMP balancing and scheduler algroithms. The only way to move a process onto or off an | 
|  | 517 | "isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the | 
|  | 518 | maximum value is 1 less than the number of CPUs on the system. | 
|  | 519 |  | 
|  | 520 | .. code-block:: yaml | 
|  | 521 |  | 
|  | 522 | linux: | 
|  | 523 | system: | 
|  | 524 | kernel: | 
|  | 525 | isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0 | 
| Jiri Broulik | f8f55a2 | 2017-01-26 14:36:46 +0100 | [diff] [blame] | 526 |  | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 527 | Repositories | 
|  | 528 | ~~~~~~~~~~~~ | 
|  | 529 |  | 
|  | 530 | RedHat based Linux with additional OpenStack repo | 
|  | 531 |  | 
|  | 532 | .. code-block:: yaml | 
|  | 533 |  | 
|  | 534 | linux: | 
|  | 535 | system: | 
|  | 536 | ... | 
|  | 537 | repo: | 
|  | 538 | rdo-icehouse: | 
|  | 539 | enabled: true | 
|  | 540 | source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/' | 
|  | 541 | pgpcheck: 0 | 
|  | 542 |  | 
|  | 543 | Ensure system repository to use czech Debian mirror (``default: true``) | 
|  | 544 | Also pin it's packages with priority 900. | 
|  | 545 |  | 
|  | 546 | .. code-block:: yaml | 
|  | 547 |  | 
|  | 548 | linux: | 
|  | 549 | system: | 
|  | 550 | repo: | 
|  | 551 | debian: | 
|  | 552 | default: true | 
|  | 553 | source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free" | 
|  | 554 | # Import signing key from URL if needed | 
|  | 555 | key_url: "http://dummy.com/public.gpg" | 
|  | 556 | pin: | 
|  | 557 | - pin: 'origin "ftp.cz.debian.org"' | 
|  | 558 | priority: 900 | 
|  | 559 | package: '*' | 
|  | 560 |  | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 561 |  | 
|  | 562 | Package manager proxy setup globally: | 
|  | 563 |  | 
|  | 564 | .. code-block:: yaml | 
|  | 565 |  | 
|  | 566 | linux: | 
|  | 567 | system: | 
|  | 568 | ... | 
|  | 569 | repo: | 
|  | 570 | apt-mk: | 
|  | 571 | source: "deb http://apt-mk.mirantis.com/ stable main salt" | 
|  | 572 | ... | 
|  | 573 | proxy: | 
|  | 574 | pkg: | 
|  | 575 | enabled: true | 
|  | 576 | ftp:   ftp://ftp-proxy-for-apt.host.local:2121 | 
|  | 577 | ... | 
|  | 578 | # NOTE: Global defaults for any other componet that configure proxy on the system. | 
|  | 579 | #       If your environment has just one simple proxy, set it on linux:system:proxy. | 
|  | 580 | # | 
|  | 581 | # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries | 
|  | 582 | # as for https and http | 
|  | 583 | ftp:   ftp://proxy.host.local:2121 | 
|  | 584 | http:  http://proxy.host.local:3142 | 
|  | 585 | https: https://proxy.host.local:3143 | 
|  | 586 |  | 
|  | 587 | Package manager proxy setup per repository: | 
|  | 588 |  | 
|  | 589 | .. code-block:: yaml | 
|  | 590 |  | 
|  | 591 | linux: | 
|  | 592 | system: | 
|  | 593 | ... | 
|  | 594 | repo: | 
|  | 595 | debian: | 
|  | 596 | source: "deb http://apt-mk.mirantis.com/ stable main salt" | 
|  | 597 | ... | 
|  | 598 | apt-mk: | 
|  | 599 | source: "deb http://apt-mk.mirantis.com/ stable main salt" | 
|  | 600 | # per repository proxy | 
|  | 601 | proxy: | 
|  | 602 | enabled: true | 
|  | 603 | http:  http://maas-01:8080 | 
|  | 604 | https: http://maas-01:8080 | 
|  | 605 | ... | 
|  | 606 | proxy: | 
| Oleksandr Vlasov | 27a6c3a | 2017-04-11 16:01:19 -0600 | [diff] [blame] | 607 | # package manager fallback defaults | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 608 | # used if linux:system:repo:apt-mk:proxy has no protocol specific entries | 
|  | 609 | pkg: | 
|  | 610 | enabled: true | 
|  | 611 | ftp:   ftp://proxy.host.local:2121 | 
|  | 612 | #http:  http://proxy.host.local:3142 | 
|  | 613 | #https: https://proxy.host.local:3143 | 
| Oleksandr Vlasov | 27a6c3a | 2017-04-11 16:01:19 -0600 | [diff] [blame] | 614 | ... | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 615 | # global system fallback system defaults | 
|  | 616 | ftp:   ftp://proxy.host.local:2121 | 
|  | 617 | http:  http://proxy.host.local:3142 | 
|  | 618 | https: https://proxy.host.local:3143 | 
|  | 619 |  | 
|  | 620 |  | 
| Jiri Broulik | 34a29b4 | 2017-04-25 14:42:54 +0200 | [diff] [blame] | 621 | Remove all repositories: | 
|  | 622 |  | 
|  | 623 | .. code-block:: yaml | 
|  | 624 |  | 
|  | 625 | linux: | 
|  | 626 | system: | 
|  | 627 | purge_repos: true | 
|  | 628 |  | 
| Filip Pytloun | c512e6c | 2017-11-22 14:28:10 +0100 | [diff] [blame] | 629 | Setup custom apt config options: | 
|  | 630 |  | 
|  | 631 | .. code-block:: yaml | 
|  | 632 |  | 
|  | 633 | linux: | 
|  | 634 | system: | 
|  | 635 | apt: | 
|  | 636 | config: | 
|  | 637 | compression-workaround: | 
|  | 638 | "Acquire::CompressionTypes::Order": "gz" | 
|  | 639 | docker-clean: | 
|  | 640 | "DPkg::Post-Invoke": | 
|  | 641 | - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true" | 
|  | 642 | "APT::Update::Post-Invoke": | 
|  | 643 | - "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] | 644 |  | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 645 | RC | 
|  | 646 | ~~ | 
|  | 647 |  | 
| Jakub Pavlik | 7885938 | 2016-01-21 11:26:39 +0100 | [diff] [blame] | 648 | rc.local example | 
|  | 649 |  | 
|  | 650 | .. code-block:: yaml | 
|  | 651 |  | 
|  | 652 | linux: | 
|  | 653 | system: | 
|  | 654 | rc: | 
|  | 655 | local: | | 
|  | 656 | #!/bin/sh -e | 
|  | 657 | # | 
|  | 658 | # rc.local | 
|  | 659 | # | 
|  | 660 | # This script is executed at the end of each multiuser runlevel. | 
|  | 661 | # Make sure that the script will "exit 0" on success or any other | 
|  | 662 | # value on error. | 
|  | 663 | # | 
|  | 664 | # In order to enable or disable this script just change the execution | 
|  | 665 | # bits. | 
|  | 666 | # | 
|  | 667 | # By default this script does nothing. | 
|  | 668 | exit 0 | 
|  | 669 |  | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 670 |  | 
| Filip Pytloun | 1f40dac | 2016-01-22 15:52:57 +0100 | [diff] [blame] | 671 | Prompt | 
|  | 672 | ~~~~~~ | 
|  | 673 |  | 
|  | 674 | Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every | 
|  | 675 | user can have different prompt. | 
|  | 676 |  | 
|  | 677 | .. code-block:: yaml | 
|  | 678 |  | 
|  | 679 | linux: | 
|  | 680 | system: | 
|  | 681 | prompt: | 
|  | 682 | 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\\] | 
|  | 683 | default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w] | 
|  | 684 |  | 
|  | 685 | On Debian systems to set prompt system-wide it's necessary to remove setting | 
|  | 686 | PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from | 
|  | 687 | ``/etc/skel/.bashrc``). This formula will do this automatically, but will not | 
| Filip Pytloun | d9b68da | 2016-01-22 15:58:41 +0100 | [diff] [blame] | 688 | touch existing user's ``~/.bashrc`` files except root. | 
| Jakub Pavlik | 7885938 | 2016-01-21 11:26:39 +0100 | [diff] [blame] | 689 |  | 
| Filip Pytloun | eef11c1 | 2016-03-25 11:00:23 +0100 | [diff] [blame] | 690 | Bash | 
|  | 691 | ~~~~ | 
|  | 692 |  | 
|  | 693 | Fix bash configuration to preserve history across sessions (like ZSH does by | 
|  | 694 | default). | 
|  | 695 |  | 
|  | 696 | .. code-block:: yaml | 
|  | 697 |  | 
|  | 698 | linux: | 
|  | 699 | system: | 
|  | 700 | bash: | 
|  | 701 | preserve_history: true | 
|  | 702 |  | 
| Filip Pytloun | e874dfb | 2016-01-22 16:57:34 +0100 | [diff] [blame] | 703 | Message of the day | 
|  | 704 | ~~~~~~~~~~~~~~~~~~ | 
|  | 705 |  | 
|  | 706 | ``pam_motd`` from package ``update-motd`` is used for dynamic messages of the | 
|  | 707 | day. Setting custom motd will cleanup existing ones. | 
|  | 708 |  | 
|  | 709 | .. code-block:: yaml | 
|  | 710 |  | 
|  | 711 | linux: | 
|  | 712 | system: | 
|  | 713 | motd: | 
|  | 714 | - release: | | 
|  | 715 | #!/bin/sh | 
|  | 716 | [ -r /etc/lsb-release ] && . /etc/lsb-release | 
|  | 717 |  | 
|  | 718 | if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then | 
|  | 719 | # Fall back to using the very slow lsb_release utility | 
|  | 720 | DISTRIB_DESCRIPTION=$(lsb_release -s -d) | 
|  | 721 | fi | 
|  | 722 |  | 
|  | 723 | printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)" | 
|  | 724 | - warning: | | 
|  | 725 | #!/bin/sh | 
|  | 726 | printf "This is [company name] network.\n" | 
|  | 727 | printf "Unauthorized access strictly prohibited.\n" | 
|  | 728 |  | 
| Marek Celoud | 713e907 | 2017-05-18 15:20:25 +0200 | [diff] [blame] | 729 | Services | 
|  | 730 | ~~~~~~~~ | 
|  | 731 |  | 
|  | 732 | Stop and disable linux service: | 
|  | 733 |  | 
|  | 734 | .. code-block:: yaml | 
|  | 735 |  | 
|  | 736 | linux: | 
|  | 737 | system: | 
|  | 738 | service: | 
|  | 739 | apt-daily.timer: | 
|  | 740 | status: dead | 
|  | 741 |  | 
|  | 742 | Possible status is dead (disable service by default), running (enable service by default), enabled, disabled. | 
|  | 743 |  | 
| Serhiy Ovsianikov | 67bd56a | 2017-08-11 15:56:01 +0300 | [diff] [blame] | 744 | Linux with atop service: | 
|  | 745 |  | 
|  | 746 | .. code-block:: yaml | 
|  | 747 |  | 
|  | 748 | linux: | 
|  | 749 | system: | 
|  | 750 | atop: | 
|  | 751 | enabled: true | 
|  | 752 | interval: 20 | 
|  | 753 | logpath: "/var/log/atop" | 
|  | 754 | outfile: "/var/log/atop/daily.log" | 
|  | 755 |  | 
| Filip Pytloun | 2f70b49 | 2016-02-19 15:55:25 +0100 | [diff] [blame] | 756 | RHEL / CentOS | 
| Filip Pytloun | 8296bb9 | 2016-02-19 18:42:09 +0100 | [diff] [blame] | 757 | ^^^^^^^^^^^^^ | 
| Filip Pytloun | 2f70b49 | 2016-02-19 15:55:25 +0100 | [diff] [blame] | 758 |  | 
|  | 759 | Unfortunately ``update-motd`` is currently not available for RHEL so there's | 
|  | 760 | no native support for dynamic motd. | 
|  | 761 | You can still set static one, only pillar structure differs: | 
|  | 762 |  | 
|  | 763 | .. code-block:: yaml | 
|  | 764 |  | 
|  | 765 | linux: | 
|  | 766 | system: | 
|  | 767 | motd: | | 
|  | 768 | This is [company name] network. | 
|  | 769 | Unauthorized access strictly prohibited. | 
|  | 770 |  | 
| Filip Pytloun | 8296bb9 | 2016-02-19 18:42:09 +0100 | [diff] [blame] | 771 | Haveged | 
|  | 772 | ~~~~~~~ | 
|  | 773 |  | 
|  | 774 | If you are running headless server and are low on entropy, it may be a good | 
|  | 775 | idea to setup Haveged. | 
|  | 776 |  | 
|  | 777 | .. code-block:: yaml | 
|  | 778 |  | 
|  | 779 | linux: | 
|  | 780 | system: | 
|  | 781 | haveged: | 
|  | 782 | enabled: true | 
|  | 783 |  | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 784 | Linux network | 
|  | 785 | ------------- | 
|  | 786 |  | 
|  | 787 | Linux with network manager | 
|  | 788 |  | 
|  | 789 | .. code-block:: yaml | 
|  | 790 |  | 
|  | 791 | linux: | 
|  | 792 | network: | 
|  | 793 | enabled: true | 
|  | 794 | network_manager: true | 
|  | 795 |  | 
|  | 796 | Linux with default static network interfaces, default gateway interface and DNS servers | 
|  | 797 |  | 
|  | 798 | .. code-block:: yaml | 
|  | 799 |  | 
|  | 800 | linux: | 
|  | 801 | network: | 
|  | 802 | enabled: true | 
|  | 803 | interface: | 
|  | 804 | eth0: | 
|  | 805 | enabled: true | 
|  | 806 | type: eth | 
|  | 807 | address: 192.168.0.102 | 
|  | 808 | netmask: 255.255.255.0 | 
|  | 809 | gateway: 192.168.0.1 | 
|  | 810 | name_servers: | 
|  | 811 | - 8.8.8.8 | 
|  | 812 | - 8.8.4.4 | 
|  | 813 | mtu: 1500 | 
|  | 814 |  | 
| jan kaufman | 6d30adf | 2016-01-18 17:30:12 +0100 | [diff] [blame] | 815 | Linux with bonded interfaces and disabled NetworkManager | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 816 |  | 
|  | 817 | .. code-block:: yaml | 
|  | 818 |  | 
|  | 819 | linux: | 
|  | 820 | network: | 
|  | 821 | enabled: true | 
|  | 822 | interface: | 
|  | 823 | eth0: | 
|  | 824 | type: eth | 
|  | 825 | ... | 
|  | 826 | eth1: | 
|  | 827 | type: eth | 
|  | 828 | ... | 
|  | 829 | bond0: | 
|  | 830 | enabled: true | 
|  | 831 | type: bond | 
|  | 832 | address: 192.168.0.102 | 
|  | 833 | netmask: 255.255.255.0 | 
|  | 834 | mtu: 1500 | 
|  | 835 | use_in: | 
|  | 836 | - interface: ${linux:interface:eth0} | 
|  | 837 | - interface: ${linux:interface:eth0} | 
| jan kaufman | 6d30adf | 2016-01-18 17:30:12 +0100 | [diff] [blame] | 838 | network_manager: | 
|  | 839 | disable: true | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 840 |  | 
| Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 841 | Linux with vlan interface_params | 
|  | 842 |  | 
|  | 843 | .. code-block:: yaml | 
|  | 844 |  | 
|  | 845 | linux: | 
|  | 846 | network: | 
|  | 847 | enabled: true | 
|  | 848 | interface: | 
|  | 849 | vlan69: | 
|  | 850 | type: vlan | 
| jan kaufman | c0bd76f | 2015-12-15 16:45:44 +0100 | [diff] [blame] | 851 | use_interfaces: | 
| Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 852 | - interface: ${linux:interface:bond0} | 
| Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 853 |  | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 854 | Linux with wireless interface parameters | 
|  | 855 |  | 
|  | 856 | .. code-block:: yaml | 
|  | 857 |  | 
|  | 858 | linux: | 
|  | 859 | network: | 
|  | 860 | enabled: true | 
|  | 861 | gateway: 10.0.0.1 | 
| Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 862 | default_interface: eth0 | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 863 | interface: | 
|  | 864 | wlan0: | 
|  | 865 | type: eth | 
|  | 866 | wireless: | 
|  | 867 | essid: example | 
|  | 868 | key: example_key | 
|  | 869 | security: wpa | 
|  | 870 | priority: 1 | 
|  | 871 |  | 
|  | 872 | Linux networks with routes defined | 
|  | 873 |  | 
|  | 874 | .. code-block:: yaml | 
|  | 875 |  | 
|  | 876 | linux: | 
|  | 877 | network: | 
|  | 878 | enabled: true | 
|  | 879 | gateway: 10.0.0.1 | 
| Jan Kaufman | 6a1ad71 | 2015-12-11 14:44:19 +0100 | [diff] [blame] | 880 | default_interface: eth0 | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 881 | interface: | 
|  | 882 | eth0: | 
|  | 883 | type: eth | 
|  | 884 | route: | 
|  | 885 | default: | 
|  | 886 | address: 192.168.0.123 | 
|  | 887 | netmask: 255.255.255.0 | 
|  | 888 | gateway: 192.168.0.1 | 
|  | 889 |  | 
|  | 890 | Native Linux Bridges | 
|  | 891 |  | 
|  | 892 | .. code-block:: yaml | 
|  | 893 |  | 
|  | 894 | linux: | 
|  | 895 | network: | 
|  | 896 | interface: | 
|  | 897 | eth1: | 
|  | 898 | enabled: true | 
|  | 899 | type: eth | 
|  | 900 | proto: manual | 
|  | 901 | up_cmds: | 
|  | 902 | - ip address add 0/0 dev $IFACE | 
|  | 903 | - ip link set $IFACE up | 
|  | 904 | down_cmds: | 
|  | 905 | - ip link set $IFACE down | 
|  | 906 | br-ex: | 
|  | 907 | enabled: true | 
|  | 908 | type: bridge | 
|  | 909 | address: ${linux:network:host:public_local:address} | 
|  | 910 | netmask: 255.255.255.0 | 
|  | 911 | use_interfaces: | 
|  | 912 | - eth1 | 
|  | 913 |  | 
|  | 914 | OpenVswitch Bridges | 
|  | 915 |  | 
|  | 916 | .. code-block:: yaml | 
|  | 917 |  | 
|  | 918 | linux: | 
|  | 919 | network: | 
|  | 920 | bridge: openvswitch | 
|  | 921 | interface: | 
|  | 922 | eth1: | 
|  | 923 | enabled: true | 
|  | 924 | type: eth | 
|  | 925 | proto: manual | 
|  | 926 | up_cmds: | 
|  | 927 | - ip address add 0/0 dev $IFACE | 
|  | 928 | - ip link set $IFACE up | 
|  | 929 | down_cmds: | 
|  | 930 | - ip link set $IFACE down | 
|  | 931 | br-ex: | 
|  | 932 | enabled: true | 
|  | 933 | type: bridge | 
|  | 934 | address: ${linux:network:host:public_local:address} | 
|  | 935 | netmask: 255.255.255.0 | 
|  | 936 | use_interfaces: | 
|  | 937 | - eth1 | 
| Dmitry Stremkouski | a581ea7 | 2017-10-18 14:24:16 +0300 | [diff] [blame] | 938 | br-prv: | 
|  | 939 | enabled: true | 
|  | 940 | type: ovs_bridge | 
|  | 941 | mtu: 65000 | 
|  | 942 | br-ens7: | 
|  | 943 | enabled: true | 
|  | 944 | name: br-ens7 | 
|  | 945 | type: ovs_bridge | 
|  | 946 | proto: manual | 
|  | 947 | mtu: 9000 | 
|  | 948 | use_interfaces: | 
|  | 949 | - ens7 | 
|  | 950 | patch-br-ens7-br-prv: | 
|  | 951 | enabled: true | 
|  | 952 | name: ens7-prv | 
|  | 953 | ovs_type: ovs_port | 
|  | 954 | type: ovs_port | 
|  | 955 | bridge: br-ens7 | 
|  | 956 | port_type: patch | 
|  | 957 | peer: prv-ens7 | 
|  | 958 | mtu: 65000 | 
|  | 959 | patch-br-prv-br-ens7: | 
|  | 960 | enabled: true | 
|  | 961 | name: prv-ens7 | 
|  | 962 | bridge: br-prv | 
|  | 963 | ovs_type: ovs_port | 
|  | 964 | type: ovs_port | 
|  | 965 | port_type: patch | 
|  | 966 | peer: ens7-prv | 
|  | 967 | mtu: 65000 | 
|  | 968 | ens7: | 
|  | 969 | enabled: true | 
|  | 970 | name: ens7 | 
|  | 971 | proto: manual | 
|  | 972 | ovs_port_type: OVSPort | 
|  | 973 | type: ovs_port | 
|  | 974 | ovs_bridge: br-ens7 | 
|  | 975 | bridge: br-ens7 | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 976 |  | 
| Petr Jediný | 8f8ae54 | 2017-07-13 16:19:12 +0200 | [diff] [blame] | 977 | Debian manual proto interfaces | 
|  | 978 |  | 
|  | 979 | When you are changing interface proto from static in up state to manual, you | 
|  | 980 | may need to flush ip addresses. For example, if you want to use the interface | 
|  | 981 | and the ip on the bridge. This can be done by setting the ``ipflush_onchange`` | 
|  | 982 | to true. | 
|  | 983 |  | 
|  | 984 | .. code-block:: yaml | 
|  | 985 |  | 
|  | 986 | linux: | 
|  | 987 | network: | 
|  | 988 | interface: | 
|  | 989 | eth1: | 
|  | 990 | enabled: true | 
|  | 991 | type: eth | 
|  | 992 | proto: manual | 
|  | 993 | mtu: 9100 | 
|  | 994 | ipflush_onchange: true | 
|  | 995 |  | 
|  | 996 |  | 
| Petr Jediný | d577cb5 | 2017-06-28 20:17:49 +0200 | [diff] [blame] | 997 | Concatinating and removing interface files | 
|  | 998 |  | 
|  | 999 | Debian based distributions have `/etc/network/interfaces.d/` directory, where | 
|  | 1000 | you can store configuration of network interfaces in separate files. You can | 
|  | 1001 | concatinate the files to the defined destination when needed, this operation | 
|  | 1002 | removes the file from the `/etc/network/interfaces.d/`. If you just need to | 
|  | 1003 | remove iface files, you can use the `remove_iface_files` key. | 
|  | 1004 |  | 
|  | 1005 | .. code-block:: yaml | 
|  | 1006 |  | 
|  | 1007 | linux: | 
|  | 1008 | network: | 
|  | 1009 | concat_iface_files: | 
|  | 1010 | - src: '/etc/network/interfaces.d/50-cloud-init.cfg' | 
|  | 1011 | dst: '/etc/network/interfaces' | 
|  | 1012 | remove_iface_files: | 
|  | 1013 | - '/etc/network/interfaces.d/90-custom.cfg' | 
|  | 1014 |  | 
|  | 1015 |  | 
| Oleksandr Vlasov | 27a6c3a | 2017-04-11 16:01:19 -0600 | [diff] [blame] | 1016 | DHCP client configuration | 
|  | 1017 |  | 
|  | 1018 | None of the keys is mandatory, include only those you really need. For full list | 
|  | 1019 | of available options under send, supersede, prepend, append refer to dhcp-options(5) | 
|  | 1020 |  | 
|  | 1021 | .. code-block:: yaml | 
|  | 1022 |  | 
|  | 1023 | linux: | 
|  | 1024 | network: | 
|  | 1025 | dhclient: | 
|  | 1026 | enabled: true | 
|  | 1027 | backoff_cutoff: 15 | 
|  | 1028 | initial_interval: 10 | 
|  | 1029 | reboot: 10 | 
|  | 1030 | retry: 60 | 
|  | 1031 | select_timeout: 0 | 
|  | 1032 | timeout: 120 | 
|  | 1033 | send: | 
|  | 1034 | - option: host-name | 
|  | 1035 | declaration: "= gethostname()" | 
|  | 1036 | supersede: | 
|  | 1037 | - option: host-name | 
|  | 1038 | declaration: "spaceship" | 
|  | 1039 | - option: domain-name | 
|  | 1040 | declaration: "domain.home" | 
|  | 1041 | #- option: arp-cache-timeout | 
|  | 1042 | #  declaration: 20 | 
|  | 1043 | prepend: | 
|  | 1044 | - option: domain-name-servers | 
|  | 1045 | declaration: | 
|  | 1046 | - 8.8.8.8 | 
|  | 1047 | - 8.8.4.4 | 
|  | 1048 | - option: domain-search | 
|  | 1049 | declaration: | 
|  | 1050 | - example.com | 
|  | 1051 | - eng.example.com | 
|  | 1052 | #append: | 
|  | 1053 | #- option: domain-name-servers | 
|  | 1054 | #  declaration: 127.0.0.1 | 
|  | 1055 | # ip or subnet to reject dhcp offer from | 
|  | 1056 | reject: | 
|  | 1057 | - 192.33.137.209 | 
|  | 1058 | - 10.0.2.0/24 | 
|  | 1059 | request: | 
|  | 1060 | - subnet-mask | 
|  | 1061 | - broadcast-address | 
|  | 1062 | - time-offset | 
|  | 1063 | - routers | 
|  | 1064 | - domain-name | 
|  | 1065 | - domain-name-servers | 
|  | 1066 | - domain-search | 
|  | 1067 | - host-name | 
|  | 1068 | - dhcp6.name-servers | 
|  | 1069 | - dhcp6.domain-search | 
|  | 1070 | - dhcp6.fqdn | 
|  | 1071 | - dhcp6.sntp-servers | 
|  | 1072 | - netbios-name-servers | 
|  | 1073 | - netbios-scope | 
|  | 1074 | - interface-mtu | 
|  | 1075 | - rfc3442-classless-static-routes | 
|  | 1076 | - ntp-servers | 
|  | 1077 | require: | 
|  | 1078 | - subnet-mask | 
|  | 1079 | - domain-name-servers | 
|  | 1080 | # if per interface configuration required add below | 
|  | 1081 | interface: | 
|  | 1082 | ens2: | 
|  | 1083 | initial_interval: 11 | 
|  | 1084 | reject: | 
|  | 1085 | - 192.33.137.210 | 
|  | 1086 | ens3: | 
|  | 1087 | initial_interval: 12 | 
|  | 1088 | reject: | 
|  | 1089 | - 192.33.137.211 | 
|  | 1090 |  | 
| Petr Michalec | eb14b55 | 2017-06-01 10:27:05 +0200 | [diff] [blame] | 1091 | Linux network systemd settings: | 
|  | 1092 |  | 
|  | 1093 | .. code-block:: yaml | 
|  | 1094 |  | 
|  | 1095 | linux: | 
|  | 1096 | network: | 
|  | 1097 | ... | 
|  | 1098 | systemd: | 
|  | 1099 | link: | 
|  | 1100 | 10-iface-dmz: | 
|  | 1101 | Match: | 
|  | 1102 | MACAddress: c8:5b:67:fa:1a:af | 
|  | 1103 | OriginalName: eth0 | 
|  | 1104 | Link: | 
|  | 1105 | Name: dmz0 | 
|  | 1106 | netdev: | 
|  | 1107 | 20-bridge-dmz: | 
|  | 1108 | match: | 
|  | 1109 | name: dmz0 | 
|  | 1110 | network: | 
|  | 1111 | mescription: bridge | 
|  | 1112 | bridge: br-dmz0 | 
|  | 1113 | network: | 
|  | 1114 | # works with lowercase, keys are by default capitalized | 
|  | 1115 | 40-dhcp: | 
|  | 1116 | match: | 
|  | 1117 | name: '*' | 
|  | 1118 | network: | 
|  | 1119 | DHCP: yes | 
|  | 1120 |  | 
| Oleksandr Vlasov | 27a6c3a | 2017-04-11 16:01:19 -0600 | [diff] [blame] | 1121 |  | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1122 | Configure global environment variables | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1123 |  | 
| Ales Komarek | 417e8c5 | 2017-08-25 15:10:29 +0200 | [diff] [blame] | 1124 | Use ``/etc/environment`` for static system wide variable assignment after | 
|  | 1125 | boot. Variable expansion is frequently not supported. | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1126 |  | 
|  | 1127 | .. code-block:: yaml | 
|  | 1128 |  | 
|  | 1129 | linux: | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1130 | system: | 
|  | 1131 | env: | 
|  | 1132 | BOB_VARIABLE: Alice | 
|  | 1133 | ... | 
|  | 1134 | BOB_PATH: | 
|  | 1135 | - /srv/alice/bin | 
|  | 1136 | - /srv/bob/bin | 
|  | 1137 | ... | 
|  | 1138 | ftp_proxy:   none | 
|  | 1139 | http_proxy:  http://global-http-proxy.host.local:8080 | 
|  | 1140 | https_proxy: ${linux:system:proxy:https} | 
|  | 1141 | no_proxy: | 
|  | 1142 | - 192.168.0.80 | 
|  | 1143 | - 192.168.1.80 | 
|  | 1144 | - .domain.com | 
|  | 1145 | - .local | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1146 | ... | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1147 | # NOTE: global defaults proxy configuration. | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1148 | proxy: | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1149 | ftp:   ftp://proxy.host.local:2121 | 
|  | 1150 | http:  http://proxy.host.local:3142 | 
|  | 1151 | https: https://proxy.host.local:3143 | 
|  | 1152 | noproxy: | 
|  | 1153 | - .domain.com | 
|  | 1154 | - .local | 
|  | 1155 |  | 
|  | 1156 | Configure profile.d scripts | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1157 |  | 
| Ales Komarek | 417e8c5 | 2017-08-25 15:10:29 +0200 | [diff] [blame] | 1158 | The profile.d scripts are being sourced during .sh execution and support | 
|  | 1159 | variable expansion in opposite to /etc/environment global settings in | 
|  | 1160 | ``/etc/environment``. | 
| Petr Michalec | 10462bb | 2017-03-23 19:18:08 +0100 | [diff] [blame] | 1161 |  | 
|  | 1162 | .. code-block:: yaml | 
|  | 1163 |  | 
|  | 1164 | linux: | 
|  | 1165 | system: | 
|  | 1166 | profile: | 
|  | 1167 | locales: | | 
|  | 1168 | export LANG=C | 
|  | 1169 | export LC_ALL=C | 
|  | 1170 | ... | 
|  | 1171 | vi_flavors.sh: | | 
|  | 1172 | export PAGER=view | 
|  | 1173 | export EDITOR=vim | 
|  | 1174 | alias vi=vim | 
|  | 1175 | shell_locales.sh: | | 
|  | 1176 | export LANG=en_US | 
|  | 1177 | export LC_ALL=en_US.UTF-8 | 
|  | 1178 | shell_proxies.sh: | | 
|  | 1179 | export FTP_PROXY=ftp://127.0.3.3:2121 | 
|  | 1180 | export NO_PROXY='.local' | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1181 |  | 
|  | 1182 | Linux with hosts | 
|  | 1183 |  | 
| Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1184 | Parameter purge_hosts will enforce whole /etc/hosts file, removing entries | 
|  | 1185 | that are not defined in model except defaults for both IPv4 and IPv6 localhost | 
|  | 1186 | and hostname + fqdn. | 
| Ales Komarek | 417e8c5 | 2017-08-25 15:10:29 +0200 | [diff] [blame] | 1187 |  | 
| Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1188 | It's good to use this option if you want to ensure /etc/hosts is always in a | 
|  | 1189 | clean state however it's not enabled by default for safety. | 
|  | 1190 |  | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1191 | .. code-block:: yaml | 
|  | 1192 |  | 
|  | 1193 | linux: | 
|  | 1194 | network: | 
| Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1195 | purge_hosts: true | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1196 | host: | 
| Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1197 | # No need to define this one if purge_hosts is true | 
|  | 1198 | hostname: | 
|  | 1199 | address: 127.0.1.1 | 
|  | 1200 | names: | 
|  | 1201 | - ${linux:network:fqdn} | 
|  | 1202 | - ${linux:network:hostname} | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1203 | node1: | 
|  | 1204 | address: 192.168.10.200 | 
|  | 1205 | names: | 
|  | 1206 | - node2.domain.com | 
|  | 1207 | - service2.domain.com | 
|  | 1208 | node2: | 
|  | 1209 | address: 192.168.10.201 | 
|  | 1210 | names: | 
|  | 1211 | - node2.domain.com | 
|  | 1212 | - service2.domain.com | 
|  | 1213 |  | 
| Ales Komarek | 417e8c5 | 2017-08-25 15:10:29 +0200 | [diff] [blame] | 1214 | Linux with hosts collected from mine | 
|  | 1215 |  | 
|  | 1216 | In this case all dns records defined within infrastrucuture will be passed to | 
|  | 1217 | local hosts records or any DNS server. Only hosts with `grain` parameter to | 
|  | 1218 | true will be propagated to the mine. | 
|  | 1219 |  | 
|  | 1220 | .. code-block:: yaml | 
|  | 1221 |  | 
|  | 1222 | linux: | 
|  | 1223 | network: | 
|  | 1224 | purge_hosts: true | 
|  | 1225 | mine_dns_records: true | 
|  | 1226 | host: | 
|  | 1227 | node1: | 
|  | 1228 | address: 192.168.10.200 | 
|  | 1229 | grain: true | 
|  | 1230 | names: | 
|  | 1231 | - node2.domain.com | 
|  | 1232 | - service2.domain.com | 
| Filip Pytloun | 86506fe | 2017-01-26 14:36:16 +0100 | [diff] [blame] | 1233 |  | 
| Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 1234 | Setup resolv.conf, nameservers, domain and search domains | 
|  | 1235 |  | 
|  | 1236 | .. code-block:: yaml | 
|  | 1237 |  | 
|  | 1238 | linux: | 
|  | 1239 | network: | 
|  | 1240 | resolv: | 
|  | 1241 | dns: | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1242 | - 8.8.4.4 | 
|  | 1243 | - 8.8.8.8 | 
| Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 1244 | domain: my.example.com | 
|  | 1245 | search: | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1246 | - my.example.com | 
|  | 1247 | - example.com | 
| Marek Celoud | f6cd192 | 2016-12-05 13:39:49 +0100 | [diff] [blame] | 1248 | options: | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1249 | - ndots: 5 | 
|  | 1250 | - timeout: 2 | 
|  | 1251 | - attempts: 2 | 
| Filip Pytloun | de9bea5 | 2016-01-11 15:39:10 +0100 | [diff] [blame] | 1252 |  | 
| Ales Komarek | 417e8c5 | 2017-08-25 15:10:29 +0200 | [diff] [blame] | 1253 | setting custom TX queue length for tap interfaces | 
| Andrii Petrenko | 735761d | 2017-03-21 17:17:35 -0700 | [diff] [blame] | 1254 |  | 
|  | 1255 | .. code-block:: yaml | 
|  | 1256 |  | 
|  | 1257 | linux: | 
|  | 1258 | network: | 
|  | 1259 | tap_custom_txqueuelen: 10000 | 
|  | 1260 |  | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1261 | DPDK OVS interfaces | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1262 |  | 
|  | 1263 | **DPDK OVS NIC** | 
|  | 1264 |  | 
|  | 1265 | .. code-block:: yaml | 
|  | 1266 |  | 
|  | 1267 | linux: | 
|  | 1268 | network: | 
|  | 1269 | bridge: openvswitch | 
|  | 1270 | dpdk: | 
|  | 1271 | enabled: true | 
| Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1272 | driver: uio/vfio | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1273 | openvswitch: | 
|  | 1274 | pmd_cpu_mask: "0x6" | 
|  | 1275 | dpdk_socket_mem: "1024,1024" | 
|  | 1276 | dpdk_lcore_mask: "0x400" | 
|  | 1277 | memory_channels: 2 | 
|  | 1278 | interface: | 
|  | 1279 | dpkd0: | 
|  | 1280 | name: ${_param:dpdk_nic} | 
|  | 1281 | pci: 0000:06:00.0 | 
| Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1282 | driver: igb_uio/vfio-pci | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1283 | enabled: true | 
|  | 1284 | type: dpdk_ovs_port | 
|  | 1285 | n_rxq: 2 | 
| Oleg Bondarev | 43dbbd3 | 2017-05-24 17:06:19 +0400 | [diff] [blame] | 1286 | pmd_rxq_affinity: "0:1,1:2" | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1287 | bridge: br-prv | 
| Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1288 | mtu: 9000 | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1289 | br-prv: | 
|  | 1290 | enabled: true | 
|  | 1291 | type: dpdk_ovs_bridge | 
|  | 1292 |  | 
|  | 1293 | **DPDK OVS Bond** | 
|  | 1294 |  | 
|  | 1295 | .. code-block:: yaml | 
|  | 1296 |  | 
|  | 1297 | linux: | 
|  | 1298 | network: | 
|  | 1299 | bridge: openvswitch | 
|  | 1300 | dpdk: | 
|  | 1301 | enabled: true | 
| Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1302 | driver: uio/vfio | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1303 | openvswitch: | 
|  | 1304 | pmd_cpu_mask: "0x6" | 
|  | 1305 | dpdk_socket_mem: "1024,1024" | 
|  | 1306 | dpdk_lcore_mask: "0x400" | 
|  | 1307 | memory_channels: 2 | 
|  | 1308 | interface: | 
|  | 1309 | dpdk_second_nic: | 
|  | 1310 | name: ${_param:primary_second_nic} | 
|  | 1311 | pci: 0000:06:00.0 | 
| Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1312 | driver: igb_uio/vfio-pci | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1313 | bond: dpdkbond0 | 
|  | 1314 | enabled: true | 
|  | 1315 | type: dpdk_ovs_port | 
|  | 1316 | n_rxq: 2 | 
| Oleg Bondarev | 43dbbd3 | 2017-05-24 17:06:19 +0400 | [diff] [blame] | 1317 | pmd_rxq_affinity: "0:1,1:2" | 
| Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1318 | mtu: 9000 | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1319 | dpdk_first_nic: | 
|  | 1320 | name: ${_param:primary_first_nic} | 
|  | 1321 | pci: 0000:05:00.0 | 
| Oleg Bondarev | 9a46679 | 2017-05-25 15:55:42 +0400 | [diff] [blame] | 1322 | driver: igb_uio/vfio-pci | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1323 | bond: dpdkbond0 | 
|  | 1324 | enabled: true | 
|  | 1325 | type: dpdk_ovs_port | 
|  | 1326 | n_rxq: 2 | 
| Oleg Bondarev | 43dbbd3 | 2017-05-24 17:06:19 +0400 | [diff] [blame] | 1327 | pmd_rxq_affinity: "0:1,1:2" | 
| Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1328 | mtu: 9000 | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1329 | dpdkbond0: | 
|  | 1330 | enabled: true | 
|  | 1331 | bridge: br-prv | 
|  | 1332 | type: dpdk_ovs_bond | 
|  | 1333 | mode: active-backup | 
|  | 1334 | br-prv: | 
|  | 1335 | enabled: true | 
|  | 1336 | type: dpdk_ovs_bridge | 
|  | 1337 |  | 
| Jakub Pavlik | aa75906 | 2017-03-13 15:57:26 +0100 | [diff] [blame] | 1338 | **DPDK OVS bridge for VXLAN** | 
|  | 1339 |  | 
|  | 1340 | If VXLAN is used as tenant segmentation then ip address must be set on br-prv | 
|  | 1341 |  | 
|  | 1342 | .. code-block:: yaml | 
|  | 1343 |  | 
|  | 1344 | linux: | 
|  | 1345 | network: | 
|  | 1346 | ... | 
|  | 1347 | interface: | 
|  | 1348 | br-prv: | 
|  | 1349 | enabled: true | 
|  | 1350 | type: dpdk_ovs_bridge | 
|  | 1351 | address: 192.168.50.0 | 
|  | 1352 | netmask: 255.255.255.0 | 
|  | 1353 | mtu: 9000 | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1354 |  | 
|  | 1355 | Linux storage | 
|  | 1356 | ------------- | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1357 |  | 
|  | 1358 | Linux with mounted Samba | 
|  | 1359 |  | 
|  | 1360 | .. code-block:: yaml | 
|  | 1361 |  | 
|  | 1362 | linux: | 
|  | 1363 | storage: | 
|  | 1364 | enabled: true | 
|  | 1365 | mount: | 
|  | 1366 | samba1: | 
| Simon Pasquier | 376262a | 2016-11-16 15:21:51 +0100 | [diff] [blame] | 1367 | - enabled: true | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1368 | - path: /media/myuser/public/ | 
|  | 1369 | - device: //192.168.0.1/storage | 
|  | 1370 | - file_system: cifs | 
|  | 1371 | - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm | 
|  | 1372 |  | 
| Jiri Broulik | b017f93 | 2017-03-31 13:55:36 +0200 | [diff] [blame] | 1373 | NFS mount | 
|  | 1374 |  | 
|  | 1375 | .. code-block:: yaml | 
|  | 1376 |  | 
|  | 1377 | linux: | 
|  | 1378 | storage: | 
|  | 1379 | enabled: true | 
|  | 1380 | mount: | 
|  | 1381 | nfs_glance: | 
|  | 1382 | enabled: true | 
|  | 1383 | path: /var/lib/glance/images | 
|  | 1384 | device: 172.16.10.110:/var/nfs/glance | 
|  | 1385 | file_system: nfs | 
|  | 1386 | opts: rw,sync | 
|  | 1387 |  | 
|  | 1388 |  | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1389 | File swap configuration | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1390 |  | 
|  | 1391 | .. code-block:: yaml | 
|  | 1392 |  | 
|  | 1393 | linux: | 
|  | 1394 | storage: | 
|  | 1395 | enabled: true | 
|  | 1396 | swap: | 
|  | 1397 | file: | 
|  | 1398 | enabled: true | 
|  | 1399 | engine: file | 
|  | 1400 | device: /swapfile | 
|  | 1401 | size: 1024 | 
|  | 1402 |  | 
| Jakub Pavlik | 21ca215 | 2017-02-27 22:21:09 +0100 | [diff] [blame] | 1403 | Partition swap configuration | 
| Lachlan Evenson | 3067651 | 2016-01-22 15:43:28 -0800 | [diff] [blame] | 1404 |  | 
|  | 1405 | .. code-block:: yaml | 
|  | 1406 |  | 
|  | 1407 | linux: | 
|  | 1408 | storage: | 
|  | 1409 | enabled: true | 
|  | 1410 | swap: | 
|  | 1411 | partition: | 
|  | 1412 | enabled: true | 
|  | 1413 | engine: partition | 
|  | 1414 | device: /dev/vg0/swap | 
|  | 1415 |  | 
| Filip Pytloun | c8a001a | 2015-12-15 14:09:19 +0100 | [diff] [blame] | 1416 | LVM group `vg1` with one device and `data` volume mounted into `/mnt/data` | 
|  | 1417 |  | 
|  | 1418 | .. code-block:: yaml | 
|  | 1419 |  | 
|  | 1420 | parameters: | 
|  | 1421 | linux: | 
|  | 1422 | storage: | 
|  | 1423 | mount: | 
|  | 1424 | data: | 
| Simon Pasquier | 376262a | 2016-11-16 15:21:51 +0100 | [diff] [blame] | 1425 | enabled: true | 
| Filip Pytloun | c8a001a | 2015-12-15 14:09:19 +0100 | [diff] [blame] | 1426 | device: /dev/vg1/data | 
|  | 1427 | file_system: ext4 | 
|  | 1428 | path: /mnt/data | 
|  | 1429 | lvm: | 
|  | 1430 | vg1: | 
|  | 1431 | enabled: true | 
|  | 1432 | devices: | 
|  | 1433 | - /dev/sdb | 
|  | 1434 | volume: | 
|  | 1435 | data: | 
|  | 1436 | size: 40G | 
|  | 1437 | mount: ${linux:storage:mount:data} | 
|  | 1438 |  | 
| Jakub Pavlik | 4f74214 | 2017-08-08 15:05:50 +0200 | [diff] [blame] | 1439 | Create partitions on disk. Specify size in MB. It expects empty | 
| Piotr Kruk | d51911b | 2017-12-04 11:27:08 +0100 | [diff] [blame^] | 1440 | disk without any existing partitions. (set startsector=1, if you want to start partitions from 2048) | 
| Jakub Pavlik | 4f74214 | 2017-08-08 15:05:50 +0200 | [diff] [blame] | 1441 |  | 
|  | 1442 | .. code-block:: yaml | 
|  | 1443 |  | 
|  | 1444 | linux: | 
|  | 1445 | storage: | 
|  | 1446 | disk: | 
|  | 1447 | first_drive: | 
| Piotr Kruk | d51911b | 2017-12-04 11:27:08 +0100 | [diff] [blame^] | 1448 | startsector: 1 | 
| Jakub Pavlik | 4f74214 | 2017-08-08 15:05:50 +0200 | [diff] [blame] | 1449 | name: /dev/loop1 | 
|  | 1450 | type: gpt | 
|  | 1451 | partitions: | 
|  | 1452 | - size: 200 #size in MB | 
|  | 1453 | type: fat32 | 
|  | 1454 | - size: 300 #size in MB | 
| Jakub Pavlik | 8e2140a | 2017-08-14 23:29:57 +0200 | [diff] [blame] | 1455 | mkfs: True | 
|  | 1456 | type: xfs | 
| Jakub Pavlik | 4f74214 | 2017-08-08 15:05:50 +0200 | [diff] [blame] | 1457 | /dev/vda1: | 
|  | 1458 | partitions: | 
|  | 1459 | - size: 5 | 
|  | 1460 | type: ext2 | 
|  | 1461 | - size: 10 | 
|  | 1462 | type: ext4 | 
| Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 1463 |  | 
|  | 1464 | Multipath with Fujitsu Eternus DXL | 
|  | 1465 |  | 
|  | 1466 | .. code-block:: yaml | 
|  | 1467 |  | 
|  | 1468 | parameters: | 
|  | 1469 | linux: | 
|  | 1470 | storage: | 
|  | 1471 | multipath: | 
|  | 1472 | enabled: true | 
|  | 1473 | blacklist_devices: | 
|  | 1474 | - /dev/sda | 
|  | 1475 | - /dev/sdb | 
|  | 1476 | backends: | 
|  | 1477 | - fujitsu_eternus_dxl | 
|  | 1478 |  | 
|  | 1479 | Multipath with Hitachi VSP 1000 | 
|  | 1480 |  | 
|  | 1481 | .. code-block:: yaml | 
|  | 1482 |  | 
|  | 1483 | parameters: | 
|  | 1484 | linux: | 
|  | 1485 | storage: | 
|  | 1486 | multipath: | 
|  | 1487 | enabled: true | 
|  | 1488 | blacklist_devices: | 
|  | 1489 | - /dev/sda | 
|  | 1490 | - /dev/sdb | 
|  | 1491 | backends: | 
|  | 1492 | - hitachi_vsp1000 | 
|  | 1493 |  | 
|  | 1494 | Multipath with IBM Storwize | 
|  | 1495 |  | 
|  | 1496 | .. code-block:: yaml | 
|  | 1497 |  | 
|  | 1498 | parameters: | 
|  | 1499 | linux: | 
|  | 1500 | storage: | 
|  | 1501 | multipath: | 
|  | 1502 | enabled: true | 
|  | 1503 | blacklist_devices: | 
|  | 1504 | - /dev/sda | 
|  | 1505 | - /dev/sdb | 
|  | 1506 | backends: | 
|  | 1507 | - ibm_storwize | 
|  | 1508 |  | 
|  | 1509 | Multipath with multiple backends | 
|  | 1510 |  | 
|  | 1511 | .. code-block:: yaml | 
|  | 1512 |  | 
|  | 1513 | parameters: | 
|  | 1514 | linux: | 
|  | 1515 | storage: | 
|  | 1516 | multipath: | 
|  | 1517 | enabled: true | 
|  | 1518 | blacklist_devices: | 
|  | 1519 | - /dev/sda | 
|  | 1520 | - /dev/sdb | 
|  | 1521 | - /dev/sdc | 
|  | 1522 | - /dev/sdd | 
|  | 1523 | backends: | 
|  | 1524 | - ibm_storwize | 
|  | 1525 | - fujitsu_eternus_dxl | 
|  | 1526 | - hitachi_vsp1000 | 
|  | 1527 |  | 
|  | 1528 | Disabled multipath (the default setup) | 
|  | 1529 |  | 
|  | 1530 | .. code-block:: yaml | 
|  | 1531 |  | 
|  | 1532 | parameters: | 
|  | 1533 | linux: | 
|  | 1534 | storage: | 
|  | 1535 | multipath: | 
|  | 1536 | enabled: false | 
|  | 1537 |  | 
| Simon Pasquier | 375001e | 2017-01-26 13:22:33 +0100 | [diff] [blame] | 1538 | Linux with local loopback device | 
|  | 1539 |  | 
|  | 1540 | .. code-block:: yaml | 
|  | 1541 |  | 
|  | 1542 | linux: | 
|  | 1543 | storage: | 
|  | 1544 | loopback: | 
|  | 1545 | disk1: | 
|  | 1546 | file: /srv/disk1 | 
|  | 1547 | size: 50G | 
|  | 1548 |  | 
| Filip Pytloun | b2c8f85 | 2016-11-21 17:03:43 +0100 | [diff] [blame] | 1549 | External config generation | 
|  | 1550 | -------------------------- | 
|  | 1551 |  | 
|  | 1552 | You are able to use config support metadata between formulas and only generate | 
|  | 1553 | config files for external use, eg. docker, etc. | 
|  | 1554 |  | 
|  | 1555 | .. code-block:: yaml | 
|  | 1556 |  | 
|  | 1557 | parameters: | 
|  | 1558 | linux: | 
|  | 1559 | system: | 
|  | 1560 | config: | 
|  | 1561 | pillar: | 
|  | 1562 | jenkins: | 
|  | 1563 | master: | 
|  | 1564 | home: /srv/volumes/jenkins | 
|  | 1565 | approved_scripts: | 
|  | 1566 | - method java.net.URL openConnection | 
|  | 1567 | credentials: | 
|  | 1568 | - type: username_password | 
|  | 1569 | scope: global | 
|  | 1570 | id: test | 
|  | 1571 | desc: Testing credentials | 
|  | 1572 | username: test | 
|  | 1573 | password: test | 
|  | 1574 |  | 
| Vladimir Eremin | ccf2884 | 2017-04-10 23:52:10 +0300 | [diff] [blame] | 1575 | Netconsole Remote Kernel Logging | 
|  | 1576 | -------------------------------- | 
|  | 1577 |  | 
|  | 1578 | Netconsole logger could be configured for configfs-enabled kernels | 
|  | 1579 | (`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in | 
|  | 1580 | runtime (if network is already configured), and on-boot after interface | 
|  | 1581 | initialization. Notes: | 
|  | 1582 |  | 
|  | 1583 | * receiver could be located only in same L3 domain | 
|  | 1584 | (or you need to configure gateway MAC manually) | 
|  | 1585 | * receiver's MAC is detected only on configuration time | 
|  | 1586 | * using broadcast MAC is not recommended | 
|  | 1587 |  | 
|  | 1588 | .. code-block:: yaml | 
|  | 1589 |  | 
|  | 1590 | parameters: | 
|  | 1591 | linux: | 
|  | 1592 | system: | 
|  | 1593 | netconsole: | 
|  | 1594 | enabled: true | 
|  | 1595 | port: 514 (optional) | 
|  | 1596 | loglevel: debug (optional) | 
|  | 1597 | target: | 
|  | 1598 | 192.168.0.1: | 
|  | 1599 | interface: bond0 | 
|  | 1600 | mac: "ff:ff:ff:ff:ff:ff" (optional) | 
| Ales Komarek | a634f4b | 2016-10-02 13:11:04 +0200 | [diff] [blame] | 1601 |  | 
| Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1602 | Usage | 
|  | 1603 | ===== | 
|  | 1604 |  | 
|  | 1605 | Set mtu of network interface eth0 to 1400 | 
|  | 1606 |  | 
|  | 1607 | .. code-block:: bash | 
|  | 1608 |  | 
|  | 1609 | ip link set dev eth0 mtu 1400 | 
|  | 1610 |  | 
|  | 1611 | Read more | 
|  | 1612 | ========= | 
|  | 1613 |  | 
|  | 1614 | * https://www.archlinux.org/ | 
|  | 1615 | * http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu | 
| Filip Pytloun | 018f871 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 1616 |  | 
|  | 1617 | Documentation and Bugs | 
|  | 1618 | ====================== | 
|  | 1619 |  | 
|  | 1620 | To learn how to install and update salt-formulas, consult the documentation | 
|  | 1621 | available online at: | 
|  | 1622 |  | 
|  | 1623 | http://salt-formulas.readthedocs.io/ | 
|  | 1624 |  | 
|  | 1625 | In the unfortunate event that bugs are discovered, they should be reported to | 
|  | 1626 | the appropriate issue tracker. Use Github issue tracker for specific salt | 
|  | 1627 | formula: | 
|  | 1628 |  | 
|  | 1629 | https://github.com/salt-formulas/salt-formula-linux/issues | 
|  | 1630 |  | 
|  | 1631 | For feature requests, bug reports or blueprints affecting entire ecosystem, | 
|  | 1632 | use Launchpad salt-formulas project: | 
|  | 1633 |  | 
|  | 1634 | https://launchpad.net/salt-formulas | 
|  | 1635 |  | 
|  | 1636 | You can also join salt-formulas-users team and subscribe to mailing list: | 
|  | 1637 |  | 
|  | 1638 | https://launchpad.net/~salt-formulas-users | 
|  | 1639 |  | 
|  | 1640 | Developers wishing to work on the salt-formulas projects should always base | 
|  | 1641 | their work on master branch and submit pull request against specific formula. | 
|  | 1642 |  | 
|  | 1643 | https://github.com/salt-formulas/salt-formula-linux | 
|  | 1644 |  | 
|  | 1645 | Any questions or feedback is always welcome so feel free to join our IRC | 
|  | 1646 | channel: | 
|  | 1647 |  | 
|  | 1648 | #salt-formulas @ irc.freenode.net |