Filip Pytloun | f5383a4 | 2015-10-06 16:28:32 +0200 | [diff] [blame^] | 1 | |
| 2 | ===== |
| 3 | Linux |
| 4 | ===== |
| 5 | |
| 6 | Linux Operating Systems. |
| 7 | |
| 8 | * Ubuntu |
| 9 | * CentOS |
| 10 | * RedHat |
| 11 | * Fedora |
| 12 | * Arch |
| 13 | |
| 14 | Sample pillars |
| 15 | ============== |
| 16 | |
| 17 | Linux system |
| 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 | |
| 34 | Linux with system users, sowe with password set |
| 35 | |
| 36 | .. code-block:: yaml |
| 37 | |
| 38 | linux: |
| 39 | system: |
| 40 | ... |
| 41 | user: |
| 42 | jdoe: |
| 43 | name: 'jdoe' |
| 44 | enabled: true |
| 45 | sudo: true |
| 46 | shell: /bin/bash |
| 47 | full_name: 'Jonh Doe' |
| 48 | home: '/home/jdoe' |
| 49 | email: 'jonh@doe.com' |
| 50 | jsmith: |
| 51 | name: 'jsmith' |
| 52 | enabled: true |
| 53 | full_name: 'Password' |
| 54 | home: '/home/jsmith' |
| 55 | password: userpassword |
| 56 | |
| 57 | Linux with package, latest version |
| 58 | |
| 59 | .. code-block:: yaml |
| 60 | |
| 61 | linux: |
| 62 | system: |
| 63 | ... |
| 64 | package: |
| 65 | package-name: |
| 66 | version: latest |
| 67 | |
| 68 | Linux with package from certail repo, version with no upgrades |
| 69 | |
| 70 | .. code-block:: yaml |
| 71 | |
| 72 | linux: |
| 73 | system: |
| 74 | ... |
| 75 | package: |
| 76 | package-name: |
| 77 | version: 2132.323 |
| 78 | repo: 'custom-repo' |
| 79 | hold: true |
| 80 | |
| 81 | Linux with package from certail repo, version with no GPG verification |
| 82 | |
| 83 | .. code-block:: yaml |
| 84 | |
| 85 | linux: |
| 86 | system: |
| 87 | ... |
| 88 | package: |
| 89 | package-name: |
| 90 | version: 2132.323 |
| 91 | repo: 'custom-repo' |
| 92 | verify: false |
| 93 | |
| 94 | Linux with cron jobs |
| 95 | |
| 96 | .. code-block:: yaml |
| 97 | |
| 98 | linux: |
| 99 | system: |
| 100 | ... |
| 101 | job: |
| 102 | cmd1: |
| 103 | command: '/cmd/to/run' |
| 104 | enabled: true |
| 105 | user: 'root' |
| 106 | hour: 2 |
| 107 | minute: 0 |
| 108 | |
| 109 | Repositories |
| 110 | ~~~~~~~~~~~~ |
| 111 | |
| 112 | RedHat based Linux with additional OpenStack repo |
| 113 | |
| 114 | .. code-block:: yaml |
| 115 | |
| 116 | linux: |
| 117 | system: |
| 118 | ... |
| 119 | repo: |
| 120 | rdo-icehouse: |
| 121 | enabled: true |
| 122 | source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/' |
| 123 | pgpcheck: 0 |
| 124 | |
| 125 | Ensure system repository to use czech Debian mirror (``default: true``) |
| 126 | Also pin it's packages with priority 900. |
| 127 | |
| 128 | .. code-block:: yaml |
| 129 | |
| 130 | linux: |
| 131 | system: |
| 132 | repo: |
| 133 | debian: |
| 134 | default: true |
| 135 | source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free" |
| 136 | # Import signing key from URL if needed |
| 137 | key_url: "http://dummy.com/public.gpg" |
| 138 | pin: |
| 139 | - pin: 'origin "ftp.cz.debian.org"' |
| 140 | priority: 900 |
| 141 | package: '*' |
| 142 | |
| 143 | Linux network |
| 144 | ------------- |
| 145 | |
| 146 | Linux with network manager |
| 147 | |
| 148 | .. code-block:: yaml |
| 149 | |
| 150 | linux: |
| 151 | network: |
| 152 | enabled: true |
| 153 | network_manager: true |
| 154 | |
| 155 | Linux with default static network interfaces, default gateway interface and DNS servers |
| 156 | |
| 157 | .. code-block:: yaml |
| 158 | |
| 159 | linux: |
| 160 | network: |
| 161 | enabled: true |
| 162 | interface: |
| 163 | eth0: |
| 164 | enabled: true |
| 165 | type: eth |
| 166 | address: 192.168.0.102 |
| 167 | netmask: 255.255.255.0 |
| 168 | gateway: 192.168.0.1 |
| 169 | name_servers: |
| 170 | - 8.8.8.8 |
| 171 | - 8.8.4.4 |
| 172 | mtu: 1500 |
| 173 | |
| 174 | Linux with bonded interfaces |
| 175 | |
| 176 | .. code-block:: yaml |
| 177 | |
| 178 | linux: |
| 179 | network: |
| 180 | enabled: true |
| 181 | interface: |
| 182 | eth0: |
| 183 | type: eth |
| 184 | ... |
| 185 | eth1: |
| 186 | type: eth |
| 187 | ... |
| 188 | bond0: |
| 189 | enabled: true |
| 190 | type: bond |
| 191 | address: 192.168.0.102 |
| 192 | netmask: 255.255.255.0 |
| 193 | mtu: 1500 |
| 194 | use_in: |
| 195 | - interface: ${linux:interface:eth0} |
| 196 | - interface: ${linux:interface:eth0} |
| 197 | |
| 198 | Linux with wireless interface parameters |
| 199 | |
| 200 | .. code-block:: yaml |
| 201 | |
| 202 | linux: |
| 203 | network: |
| 204 | enabled: true |
| 205 | gateway: 10.0.0.1 |
| 206 | default_interface: eth0 |
| 207 | interface: |
| 208 | wlan0: |
| 209 | type: eth |
| 210 | wireless: |
| 211 | essid: example |
| 212 | key: example_key |
| 213 | security: wpa |
| 214 | priority: 1 |
| 215 | |
| 216 | Linux networks with routes defined |
| 217 | |
| 218 | .. code-block:: yaml |
| 219 | |
| 220 | linux: |
| 221 | network: |
| 222 | enabled: true |
| 223 | gateway: 10.0.0.1 |
| 224 | default_interface: eth0 |
| 225 | interface: |
| 226 | eth0: |
| 227 | type: eth |
| 228 | route: |
| 229 | default: |
| 230 | address: 192.168.0.123 |
| 231 | netmask: 255.255.255.0 |
| 232 | gateway: 192.168.0.1 |
| 233 | |
| 234 | Native Linux Bridges |
| 235 | |
| 236 | .. code-block:: yaml |
| 237 | |
| 238 | linux: |
| 239 | network: |
| 240 | interface: |
| 241 | eth1: |
| 242 | enabled: true |
| 243 | type: eth |
| 244 | proto: manual |
| 245 | up_cmds: |
| 246 | - ip address add 0/0 dev $IFACE |
| 247 | - ip link set $IFACE up |
| 248 | down_cmds: |
| 249 | - ip link set $IFACE down |
| 250 | br-ex: |
| 251 | enabled: true |
| 252 | type: bridge |
| 253 | address: ${linux:network:host:public_local:address} |
| 254 | netmask: 255.255.255.0 |
| 255 | use_interfaces: |
| 256 | - eth1 |
| 257 | |
| 258 | OpenVswitch Bridges |
| 259 | |
| 260 | .. code-block:: yaml |
| 261 | |
| 262 | linux: |
| 263 | network: |
| 264 | bridge: openvswitch |
| 265 | interface: |
| 266 | eth1: |
| 267 | enabled: true |
| 268 | type: eth |
| 269 | proto: manual |
| 270 | up_cmds: |
| 271 | - ip address add 0/0 dev $IFACE |
| 272 | - ip link set $IFACE up |
| 273 | down_cmds: |
| 274 | - ip link set $IFACE down |
| 275 | br-ex: |
| 276 | enabled: true |
| 277 | type: bridge |
| 278 | address: ${linux:network:host:public_local:address} |
| 279 | netmask: 255.255.255.0 |
| 280 | use_interfaces: |
| 281 | - eth1 |
| 282 | |
| 283 | Linux with proxy |
| 284 | |
| 285 | .. code-block:: yaml |
| 286 | |
| 287 | linux: |
| 288 | network: |
| 289 | ... |
| 290 | proxy: |
| 291 | host: proxy.domain.com |
| 292 | port: 3128 |
| 293 | |
| 294 | Linux with hosts |
| 295 | |
| 296 | .. code-block:: yaml |
| 297 | |
| 298 | linux: |
| 299 | network: |
| 300 | ... |
| 301 | host: |
| 302 | node1: |
| 303 | address: 192.168.10.200 |
| 304 | names: |
| 305 | - node2.domain.com |
| 306 | - service2.domain.com |
| 307 | node2: |
| 308 | address: 192.168.10.201 |
| 309 | names: |
| 310 | - node2.domain.com |
| 311 | - service2.domain.com |
| 312 | |
| 313 | Linux storage pillars |
| 314 | --------------------- |
| 315 | |
| 316 | Linux with mounted Samba |
| 317 | |
| 318 | .. code-block:: yaml |
| 319 | |
| 320 | linux: |
| 321 | storage: |
| 322 | enabled: true |
| 323 | mount: |
| 324 | samba1: |
| 325 | - path: /media/myuser/public/ |
| 326 | - device: //192.168.0.1/storage |
| 327 | - file_system: cifs |
| 328 | - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm |
| 329 | |
| 330 | Linux with file swap |
| 331 | |
| 332 | .. code-block:: yaml |
| 333 | |
| 334 | linux: |
| 335 | storage: |
| 336 | enabled: true |
| 337 | swap: |
| 338 | file: |
| 339 | enabled: true |
| 340 | engine: file |
| 341 | device: /swapfile |
| 342 | size: 1024 |
| 343 | |
| 344 | Usage |
| 345 | ===== |
| 346 | |
| 347 | Set mtu of network interface eth0 to 1400 |
| 348 | |
| 349 | .. code-block:: bash |
| 350 | |
| 351 | ip link set dev eth0 mtu 1400 |
| 352 | |
| 353 | Read more |
| 354 | ========= |
| 355 | |
| 356 | * https://www.archlinux.org/ |
| 357 | * http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu |