Saltstack Official Linux Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.rst 33KB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414
  1. ============
  2. Linux Fomula
  3. ============
  4. Linux Operating Systems.
  5. * Ubuntu
  6. * CentOS
  7. * RedHat
  8. * Fedora
  9. * Arch
  10. Sample Pillars
  11. ==============
  12. Linux System
  13. ------------
  14. Basic Linux box
  15. .. code-block:: yaml
  16. linux:
  17. system:
  18. enabled: true
  19. name: 'node1'
  20. domain: 'domain.com'
  21. cluster: 'system'
  22. environment: prod
  23. timezone: 'Europe/Prague'
  24. utc: true
  25. Linux with system users, some with password set:
  26. .. WARNING::
  27. If no 'password' variable has been passed - any predifined password
  28. will be removed.
  29. .. code-block:: yaml
  30. linux:
  31. system:
  32. ...
  33. user:
  34. jdoe:
  35. name: 'jdoe'
  36. enabled: true
  37. sudo: true
  38. shell: /bin/bash
  39. full_name: 'Jonh Doe'
  40. home: '/home/jdoe'
  41. email: 'jonh@doe.com'
  42. jsmith:
  43. name: 'jsmith'
  44. enabled: true
  45. full_name: 'With clear password'
  46. home: '/home/jsmith'
  47. hash_password: true
  48. password: "userpassword"
  49. mark:
  50. name: 'mark'
  51. enabled: true
  52. full_name: "unchange password'
  53. home: '/home/mark'
  54. password: false
  55. elizabeth:
  56. name: 'elizabeth'
  57. enabled: true
  58. full_name: 'With hased password'
  59. home: '/home/elizabeth'
  60. password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10"
  61. Configure sudo for users and groups under ``/etc/sudoers.d/``.
  62. This ways ``linux.system.sudo`` pillar map to actual sudo attributes:
  63. .. code-block:: jinja
  64. # simplified template:
  65. Cmds_Alias {{ alias }}={{ commands }}
  66. {{ user }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
  67. %{{ group }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
  68. # when rendered:
  69. saltuser1 ALL=(ALL) NOPASSWD: ALL
  70. .. code-block:: yaml
  71. linux:
  72. system:
  73. sudo:
  74. enabled: true
  75. aliases:
  76. host:
  77. LOCAL:
  78. - localhost
  79. PRODUCTION:
  80. - db1
  81. - db2
  82. runas:
  83. DBA:
  84. - postgres
  85. - mysql
  86. SALT:
  87. - root
  88. command:
  89. # Note: This is not 100% safe when ALL keyword is used, user still may modify configs and hide his actions.
  90. # Best practice is to specify full list of commands user is allowed to run.
  91. SUPPORT_RESTRICTED:
  92. - /bin/vi /etc/sudoers*
  93. - /bin/vim /etc/sudoers*
  94. - /bin/nano /etc/sudoers*
  95. - /bin/emacs /etc/sudoers*
  96. - /bin/su - root
  97. - /bin/su -
  98. - /bin/su
  99. - /usr/sbin/visudo
  100. SUPPORT_SHELLS:
  101. - /bin/sh
  102. - /bin/ksh
  103. - /bin/bash
  104. - /bin/rbash
  105. - /bin/dash
  106. - /bin/zsh
  107. - /bin/csh
  108. - /bin/fish
  109. - /bin/tcsh
  110. - /usr/bin/login
  111. - /usr/bin/su
  112. - /usr/su
  113. ALL_SALT_SAFE:
  114. - /usr/bin/salt state*
  115. - /usr/bin/salt service*
  116. - /usr/bin/salt pillar*
  117. - /usr/bin/salt grains*
  118. - /usr/bin/salt saltutil*
  119. - /usr/bin/salt-call state*
  120. - /usr/bin/salt-call service*
  121. - /usr/bin/salt-call pillar*
  122. - /usr/bin/salt-call grains*
  123. - /usr/bin/salt-call saltutil*
  124. SALT_TRUSTED:
  125. - /usr/bin/salt*
  126. users:
  127. # saltuser1 with default values: saltuser1 ALL=(ALL) NOPASSWD: ALL
  128. saltuser1: {}
  129. saltuser2:
  130. hosts:
  131. - LOCAL
  132. # User Alias DBA
  133. DBA:
  134. hosts:
  135. - ALL
  136. commands:
  137. - ALL_SALT_SAFE
  138. groups:
  139. db-ops:
  140. hosts:
  141. - ALL
  142. - '!PRODUCTION'
  143. runas:
  144. - DBA
  145. commands:
  146. - /bin/cat *
  147. - /bin/less *
  148. - /bin/ls *
  149. salt-ops:
  150. hosts:
  151. - 'ALL'
  152. runas:
  153. - SALT
  154. commands:
  155. - SUPPORT_SHELLS
  156. salt-ops-2nd:
  157. name: salt-ops
  158. nopasswd: false
  159. setenv: true # Enable sudo -E option
  160. runas:
  161. - DBA
  162. commands:
  163. - ALL
  164. - '!SUPPORT_SHELLS'
  165. - '!SUPPORT_RESTRICTED'
  166. Linux with package, latest version
  167. .. code-block:: yaml
  168. linux:
  169. system:
  170. ...
  171. package:
  172. package-name:
  173. version: latest
  174. Linux with package from certail repo, version with no upgrades
  175. .. code-block:: yaml
  176. linux:
  177. system:
  178. ...
  179. package:
  180. package-name:
  181. version: 2132.323
  182. repo: 'custom-repo'
  183. hold: true
  184. Linux with package from certail repo, version with no GPG verification
  185. .. code-block:: yaml
  186. linux:
  187. system:
  188. ...
  189. package:
  190. package-name:
  191. version: 2132.323
  192. repo: 'custom-repo'
  193. verify: false
  194. Linux with autoupdates (automatically install security package updates)
  195. .. code-block:: yaml
  196. linux:
  197. system:
  198. ...
  199. autoupdates:
  200. enabled: true
  201. mail: root@localhost
  202. mail_only_on_error: true
  203. remove_unused_dependencies: false
  204. automatic_reboot: true
  205. automatic_reboot_time: "02:00"
  206. Linux with cron jobs
  207. .. code-block:: yaml
  208. linux:
  209. system:
  210. ...
  211. job:
  212. cmd1:
  213. command: '/cmd/to/run'
  214. enabled: true
  215. user: 'root'
  216. hour: 2
  217. minute: 0
  218. Linux security limits (limit sensu user memory usage to max 1GB):
  219. .. code-block:: yaml
  220. linux:
  221. system:
  222. ...
  223. limit:
  224. sensu:
  225. enabled: true
  226. domain: sensu
  227. limits:
  228. - type: hard
  229. item: as
  230. value: 1000000
  231. Enable autologin on tty1 (may work only for Ubuntu 14.04):
  232. .. code-block:: yaml
  233. linux:
  234. system:
  235. console:
  236. tty1:
  237. autologin: root
  238. # Enable serial console
  239. ttyS0:
  240. autologin: root
  241. rate: 115200
  242. term: xterm
  243. To disable set autologin to `false`.
  244. Set ``policy-rc.d`` on Debian-based systems. Action can be any available
  245. command in ``while true`` loop and ``case`` context.
  246. Following will disallow dpkg to stop/start services for cassandra package automatically:
  247. .. code-block:: yaml
  248. linux:
  249. system:
  250. policyrcd:
  251. - package: cassandra
  252. action: exit 101
  253. - package: '*'
  254. action: switch
  255. Set system locales:
  256. .. code-block:: yaml
  257. linux:
  258. system:
  259. locale:
  260. en_US.UTF-8:
  261. default: true
  262. "cs_CZ.UTF-8 UTF-8":
  263. enabled: true
  264. Systemd settings:
  265. .. code-block:: yaml
  266. linux:
  267. system:
  268. ...
  269. systemd:
  270. system:
  271. Manager:
  272. DefaultLimitNOFILE: 307200
  273. DefaultLimitNPROC: 307200
  274. user:
  275. Manager:
  276. DefaultLimitCPU: 2
  277. DefaultLimitNPROC: 4
  278. Kernel
  279. ~~~~~~
  280. Install always up to date LTS kernel and headers from Ubuntu trusty:
  281. .. code-block:: yaml
  282. linux:
  283. system:
  284. kernel:
  285. type: generic
  286. lts: trusty
  287. headers: true
  288. Load kernel modules and add them to `/etc/modules`:
  289. .. code-block:: yaml
  290. linux:
  291. system:
  292. kernel:
  293. modules:
  294. - nf_conntrack
  295. - tp_smapi
  296. - 8021q
  297. Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
  298. will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`:
  299. .. code-block:: yaml
  300. linux:
  301. system:
  302. kernel:
  303. module:
  304. nf_conntrack:
  305. option:
  306. hashsize: 262144
  307. Install specific kernel version and ensure all other kernel packages are
  308. not present. Also install extra modules and headers for this kernel:
  309. .. code-block:: yaml
  310. linux:
  311. system:
  312. kernel:
  313. type: generic
  314. extra: true
  315. headers: true
  316. version: 4.2.0-22
  317. Systcl kernel parameters
  318. .. code-block:: yaml
  319. linux:
  320. system:
  321. kernel:
  322. sysctl:
  323. net.ipv4.tcp_keepalive_intvl: 3
  324. net.ipv4.tcp_keepalive_time: 30
  325. net.ipv4.tcp_keepalive_probes: 8
  326. CPU
  327. ~~~
  328. Enable cpufreq governor for every cpu:
  329. .. code-block:: yaml
  330. linux:
  331. system:
  332. cpu:
  333. governor: performance
  334. Huge Pages
  335. ~~~~~~~~~~~~
  336. Huge Pages give a performance boost to applications that intensively deal
  337. with memory allocation/deallocation by decreasing memory fragmentation.
  338. .. code-block:: yaml
  339. linux:
  340. system:
  341. kernel:
  342. hugepages:
  343. small:
  344. size: 2M
  345. count: 107520
  346. mount_point: /mnt/hugepages_2MB
  347. mount: false/true # default false
  348. large:
  349. default: true # default automatically mounted
  350. size: 1G
  351. count: 210
  352. mount_point: /mnt/hugepages_1GB
  353. Note: not recommended to use both pagesizes in concurrently.
  354. Intel SR-IOV
  355. ~~~~~~~~~~~~
  356. 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.
  357. .. code-block:: yaml
  358. linux:
  359. system:
  360. kernel:
  361. sriov: True
  362. unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
  363. rc:
  364. local: |
  365. #!/bin/sh -e
  366. # Enable 7 VF on eth1
  367. echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
  368. exit 0
  369. Isolate CPU options
  370. ~~~~~~~~~~~~~~~~~~~
  371. Remove the specified CPUs, as defined by the cpu_number values, from the general kernel
  372. SMP balancing and scheduler algroithms. The only way to move a process onto or off an
  373. "isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the
  374. maximum value is 1 less than the number of CPUs on the system.
  375. .. code-block:: yaml
  376. linux:
  377. system:
  378. kernel:
  379. isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
  380. Repositories
  381. ~~~~~~~~~~~~
  382. RedHat based Linux with additional OpenStack repo
  383. .. code-block:: yaml
  384. linux:
  385. system:
  386. ...
  387. repo:
  388. rdo-icehouse:
  389. enabled: true
  390. source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
  391. pgpcheck: 0
  392. Ensure system repository to use czech Debian mirror (``default: true``)
  393. Also pin it's packages with priority 900.
  394. .. code-block:: yaml
  395. linux:
  396. system:
  397. repo:
  398. debian:
  399. default: true
  400. source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
  401. # Import signing key from URL if needed
  402. key_url: "http://dummy.com/public.gpg"
  403. pin:
  404. - pin: 'origin "ftp.cz.debian.org"'
  405. priority: 900
  406. package: '*'
  407. Package manager proxy setup globally:
  408. .. code-block:: yaml
  409. linux:
  410. system:
  411. ...
  412. repo:
  413. apt-mk:
  414. source: "deb http://apt-mk.mirantis.com/ stable main salt"
  415. ...
  416. proxy:
  417. pkg:
  418. enabled: true
  419. ftp: ftp://ftp-proxy-for-apt.host.local:2121
  420. ...
  421. # NOTE: Global defaults for any other componet that configure proxy on the system.
  422. # If your environment has just one simple proxy, set it on linux:system:proxy.
  423. #
  424. # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
  425. # as for https and http
  426. ftp: ftp://proxy.host.local:2121
  427. http: http://proxy.host.local:3142
  428. https: https://proxy.host.local:3143
  429. Package manager proxy setup per repository:
  430. .. code-block:: yaml
  431. linux:
  432. system:
  433. ...
  434. repo:
  435. debian:
  436. source: "deb http://apt-mk.mirantis.com/ stable main salt"
  437. ...
  438. apt-mk:
  439. source: "deb http://apt-mk.mirantis.com/ stable main salt"
  440. # per repository proxy
  441. proxy:
  442. enabled: true
  443. http: http://maas-01:8080
  444. https: http://maas-01:8080
  445. ...
  446. proxy:
  447. # package manager fallback defaults
  448. # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
  449. pkg:
  450. enabled: true
  451. ftp: ftp://proxy.host.local:2121
  452. #http: http://proxy.host.local:3142
  453. #https: https://proxy.host.local:3143
  454. ...
  455. # global system fallback system defaults
  456. ftp: ftp://proxy.host.local:2121
  457. http: http://proxy.host.local:3142
  458. https: https://proxy.host.local:3143
  459. Remove all repositories:
  460. .. code-block:: yaml
  461. linux:
  462. system:
  463. purge_repos: true
  464. RC
  465. ~~
  466. rc.local example
  467. .. code-block:: yaml
  468. linux:
  469. system:
  470. rc:
  471. local: |
  472. #!/bin/sh -e
  473. #
  474. # rc.local
  475. #
  476. # This script is executed at the end of each multiuser runlevel.
  477. # Make sure that the script will "exit 0" on success or any other
  478. # value on error.
  479. #
  480. # In order to enable or disable this script just change the execution
  481. # bits.
  482. #
  483. # By default this script does nothing.
  484. exit 0
  485. Prompt
  486. ~~~~~~
  487. Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every
  488. user can have different prompt.
  489. .. code-block:: yaml
  490. linux:
  491. system:
  492. prompt:
  493. 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\\]
  494. default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
  495. On Debian systems to set prompt system-wide it's necessary to remove setting
  496. PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from
  497. ``/etc/skel/.bashrc``). This formula will do this automatically, but will not
  498. touch existing user's ``~/.bashrc`` files except root.
  499. Bash
  500. ~~~~
  501. Fix bash configuration to preserve history across sessions (like ZSH does by
  502. default).
  503. .. code-block:: yaml
  504. linux:
  505. system:
  506. bash:
  507. preserve_history: true
  508. Message of the day
  509. ~~~~~~~~~~~~~~~~~~
  510. ``pam_motd`` from package ``update-motd`` is used for dynamic messages of the
  511. day. Setting custom motd will cleanup existing ones.
  512. .. code-block:: yaml
  513. linux:
  514. system:
  515. motd:
  516. - release: |
  517. #!/bin/sh
  518. [ -r /etc/lsb-release ] && . /etc/lsb-release
  519. if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
  520. # Fall back to using the very slow lsb_release utility
  521. DISTRIB_DESCRIPTION=$(lsb_release -s -d)
  522. fi
  523. printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
  524. - warning: |
  525. #!/bin/sh
  526. printf "This is [company name] network.\n"
  527. printf "Unauthorized access strictly prohibited.\n"
  528. Services
  529. ~~~~~~~~
  530. Stop and disable linux service:
  531. .. code-block:: yaml
  532. linux:
  533. system:
  534. service:
  535. apt-daily.timer:
  536. status: dead
  537. Possible status is dead (disable service by default), running (enable service by default), enabled, disabled.
  538. RHEL / CentOS
  539. ^^^^^^^^^^^^^
  540. Unfortunately ``update-motd`` is currently not available for RHEL so there's
  541. no native support for dynamic motd.
  542. You can still set static one, only pillar structure differs:
  543. .. code-block:: yaml
  544. linux:
  545. system:
  546. motd: |
  547. This is [company name] network.
  548. Unauthorized access strictly prohibited.
  549. Haveged
  550. ~~~~~~~
  551. If you are running headless server and are low on entropy, it may be a good
  552. idea to setup Haveged.
  553. .. code-block:: yaml
  554. linux:
  555. system:
  556. haveged:
  557. enabled: true
  558. Linux network
  559. -------------
  560. Linux with network manager
  561. .. code-block:: yaml
  562. linux:
  563. network:
  564. enabled: true
  565. network_manager: true
  566. Linux with default static network interfaces, default gateway interface and DNS servers
  567. .. code-block:: yaml
  568. linux:
  569. network:
  570. enabled: true
  571. interface:
  572. eth0:
  573. enabled: true
  574. type: eth
  575. address: 192.168.0.102
  576. netmask: 255.255.255.0
  577. gateway: 192.168.0.1
  578. name_servers:
  579. - 8.8.8.8
  580. - 8.8.4.4
  581. mtu: 1500
  582. Linux with bonded interfaces and disabled NetworkManager
  583. .. code-block:: yaml
  584. linux:
  585. network:
  586. enabled: true
  587. interface:
  588. eth0:
  589. type: eth
  590. ...
  591. eth1:
  592. type: eth
  593. ...
  594. bond0:
  595. enabled: true
  596. type: bond
  597. address: 192.168.0.102
  598. netmask: 255.255.255.0
  599. mtu: 1500
  600. use_in:
  601. - interface: ${linux:interface:eth0}
  602. - interface: ${linux:interface:eth0}
  603. network_manager:
  604. disable: true
  605. Linux with vlan interface_params
  606. .. code-block:: yaml
  607. linux:
  608. network:
  609. enabled: true
  610. interface:
  611. vlan69:
  612. type: vlan
  613. use_interfaces:
  614. - interface: ${linux:interface:bond0}
  615. Linux with wireless interface parameters
  616. .. code-block:: yaml
  617. linux:
  618. network:
  619. enabled: true
  620. gateway: 10.0.0.1
  621. default_interface: eth0
  622. interface:
  623. wlan0:
  624. type: eth
  625. wireless:
  626. essid: example
  627. key: example_key
  628. security: wpa
  629. priority: 1
  630. Linux networks with routes defined
  631. .. code-block:: yaml
  632. linux:
  633. network:
  634. enabled: true
  635. gateway: 10.0.0.1
  636. default_interface: eth0
  637. interface:
  638. eth0:
  639. type: eth
  640. route:
  641. default:
  642. address: 192.168.0.123
  643. netmask: 255.255.255.0
  644. gateway: 192.168.0.1
  645. Native Linux Bridges
  646. .. code-block:: yaml
  647. linux:
  648. network:
  649. interface:
  650. eth1:
  651. enabled: true
  652. type: eth
  653. proto: manual
  654. up_cmds:
  655. - ip address add 0/0 dev $IFACE
  656. - ip link set $IFACE up
  657. down_cmds:
  658. - ip link set $IFACE down
  659. br-ex:
  660. enabled: true
  661. type: bridge
  662. address: ${linux:network:host:public_local:address}
  663. netmask: 255.255.255.0
  664. use_interfaces:
  665. - eth1
  666. OpenVswitch Bridges
  667. .. code-block:: yaml
  668. linux:
  669. network:
  670. bridge: openvswitch
  671. interface:
  672. eth1:
  673. enabled: true
  674. type: eth
  675. proto: manual
  676. up_cmds:
  677. - ip address add 0/0 dev $IFACE
  678. - ip link set $IFACE up
  679. down_cmds:
  680. - ip link set $IFACE down
  681. br-ex:
  682. enabled: true
  683. type: bridge
  684. address: ${linux:network:host:public_local:address}
  685. netmask: 255.255.255.0
  686. use_interfaces:
  687. - eth1
  688. DHCP client configuration
  689. None of the keys is mandatory, include only those you really need. For full list
  690. of available options under send, supersede, prepend, append refer to dhcp-options(5)
  691. .. code-block:: yaml
  692. linux:
  693. network:
  694. dhclient:
  695. enabled: true
  696. backoff_cutoff: 15
  697. initial_interval: 10
  698. reboot: 10
  699. retry: 60
  700. select_timeout: 0
  701. timeout: 120
  702. send:
  703. - option: host-name
  704. declaration: "= gethostname()"
  705. supersede:
  706. - option: host-name
  707. declaration: "spaceship"
  708. - option: domain-name
  709. declaration: "domain.home"
  710. #- option: arp-cache-timeout
  711. # declaration: 20
  712. prepend:
  713. - option: domain-name-servers
  714. declaration:
  715. - 8.8.8.8
  716. - 8.8.4.4
  717. - option: domain-search
  718. declaration:
  719. - example.com
  720. - eng.example.com
  721. #append:
  722. #- option: domain-name-servers
  723. # declaration: 127.0.0.1
  724. # ip or subnet to reject dhcp offer from
  725. reject:
  726. - 192.33.137.209
  727. - 10.0.2.0/24
  728. request:
  729. - subnet-mask
  730. - broadcast-address
  731. - time-offset
  732. - routers
  733. - domain-name
  734. - domain-name-servers
  735. - domain-search
  736. - host-name
  737. - dhcp6.name-servers
  738. - dhcp6.domain-search
  739. - dhcp6.fqdn
  740. - dhcp6.sntp-servers
  741. - netbios-name-servers
  742. - netbios-scope
  743. - interface-mtu
  744. - rfc3442-classless-static-routes
  745. - ntp-servers
  746. require:
  747. - subnet-mask
  748. - domain-name-servers
  749. # if per interface configuration required add below
  750. interface:
  751. ens2:
  752. initial_interval: 11
  753. reject:
  754. - 192.33.137.210
  755. ens3:
  756. initial_interval: 12
  757. reject:
  758. - 192.33.137.211
  759. Configure global environment variables
  760. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  761. Linux /etc/environment:
  762. ``/etc/environment`` is for static system wide variable assignment after boot. Variable expansion is frequently not supported.
  763. .. code-block:: yaml
  764. linux:
  765. system:
  766. env:
  767. BOB_VARIABLE: Alice
  768. ...
  769. BOB_PATH:
  770. - /srv/alice/bin
  771. - /srv/bob/bin
  772. ...
  773. ftp_proxy: none
  774. http_proxy: http://global-http-proxy.host.local:8080
  775. https_proxy: ${linux:system:proxy:https}
  776. no_proxy:
  777. - 192.168.0.80
  778. - 192.168.1.80
  779. - .domain.com
  780. - .local
  781. ...
  782. # NOTE: global defaults proxy configuration.
  783. proxy:
  784. ftp: ftp://proxy.host.local:2121
  785. http: http://proxy.host.local:3142
  786. https: https://proxy.host.local:3143
  787. noproxy:
  788. - .domain.com
  789. - .local
  790. Configure profile.d scripts
  791. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  792. Linux /etc/profile.d:
  793. The profile.d scripts are being sourced during .sh execution and support variable expansion in opposite to /etc/environment
  794. global settings in ``/etc/environment``.
  795. .. code-block:: yaml
  796. linux:
  797. system:
  798. profile:
  799. locales: |
  800. export LANG=C
  801. export LC_ALL=C
  802. ...
  803. vi_flavors.sh: |
  804. export PAGER=view
  805. export EDITOR=vim
  806. alias vi=vim
  807. shell_locales.sh: |
  808. export LANG=en_US
  809. export LC_ALL=en_US.UTF-8
  810. shell_proxies.sh: |
  811. export FTP_PROXY=ftp://127.0.3.3:2121
  812. export NO_PROXY='.local'
  813. Linux with hosts
  814. ~~~~~~~~~~~~~~~~
  815. Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
  816. that are not defined in model except defaults for both IPv4 and IPv6 localhost
  817. and hostname + fqdn.
  818. It's good to use this option if you want to ensure /etc/hosts is always in a
  819. clean state however it's not enabled by default for safety.
  820. .. code-block:: yaml
  821. linux:
  822. network:
  823. ...
  824. purge_hosts: true
  825. host:
  826. # No need to define this one if purge_hosts is true
  827. hostname:
  828. address: 127.0.1.1
  829. names:
  830. - ${linux:network:fqdn}
  831. - ${linux:network:hostname}
  832. node1:
  833. address: 192.168.10.200
  834. names:
  835. - node2.domain.com
  836. - service2.domain.com
  837. node2:
  838. address: 192.168.10.201
  839. names:
  840. - node2.domain.com
  841. - service2.domain.com
  842. Setup resolv.conf, nameservers, domain and search domains
  843. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  844. .. code-block:: yaml
  845. linux:
  846. network:
  847. resolv:
  848. dns:
  849. - 8.8.4.4
  850. - 8.8.8.8
  851. domain: my.example.com
  852. search:
  853. - my.example.com
  854. - example.com
  855. options:
  856. - ndots: 5
  857. - timeout: 2
  858. - attempts: 2
  859. **setting custom TX queue length for tap interfaces**
  860. .. code-block:: yaml
  861. linux:
  862. network:
  863. tap_custom_txqueuelen: 10000
  864. DPDK OVS interfaces
  865. --------------------
  866. **DPDK OVS NIC**
  867. .. code-block:: yaml
  868. linux:
  869. network:
  870. bridge: openvswitch
  871. dpdk:
  872. enabled: true
  873. driver: uio/vfio
  874. openvswitch:
  875. pmd_cpu_mask: "0x6"
  876. dpdk_socket_mem: "1024,1024"
  877. dpdk_lcore_mask: "0x400"
  878. memory_channels: 2
  879. interface:
  880. dpkd0:
  881. name: ${_param:dpdk_nic}
  882. pci: 0000:06:00.0
  883. driver: igb_uio/vfio-pci
  884. enabled: true
  885. type: dpdk_ovs_port
  886. n_rxq: 2
  887. pmd_rxq_affinity: "0:1,1:2"
  888. bridge: br-prv
  889. mtu: 9000
  890. br-prv:
  891. enabled: true
  892. type: dpdk_ovs_bridge
  893. **DPDK OVS Bond**
  894. .. code-block:: yaml
  895. linux:
  896. network:
  897. bridge: openvswitch
  898. dpdk:
  899. enabled: true
  900. driver: uio/vfio
  901. openvswitch:
  902. pmd_cpu_mask: "0x6"
  903. dpdk_socket_mem: "1024,1024"
  904. dpdk_lcore_mask: "0x400"
  905. memory_channels: 2
  906. interface:
  907. dpdk_second_nic:
  908. name: ${_param:primary_second_nic}
  909. pci: 0000:06:00.0
  910. driver: igb_uio/vfio-pci
  911. bond: dpdkbond0
  912. enabled: true
  913. type: dpdk_ovs_port
  914. n_rxq: 2
  915. pmd_rxq_affinity: "0:1,1:2"
  916. mtu: 9000
  917. dpdk_first_nic:
  918. name: ${_param:primary_first_nic}
  919. pci: 0000:05:00.0
  920. driver: igb_uio/vfio-pci
  921. bond: dpdkbond0
  922. enabled: true
  923. type: dpdk_ovs_port
  924. n_rxq: 2
  925. pmd_rxq_affinity: "0:1,1:2"
  926. mtu: 9000
  927. dpdkbond0:
  928. enabled: true
  929. bridge: br-prv
  930. type: dpdk_ovs_bond
  931. mode: active-backup
  932. br-prv:
  933. enabled: true
  934. type: dpdk_ovs_bridge
  935. **DPDK OVS bridge for VXLAN**
  936. If VXLAN is used as tenant segmentation then ip address must be set on br-prv
  937. .. code-block:: yaml
  938. linux:
  939. network:
  940. ...
  941. interface:
  942. br-prv:
  943. enabled: true
  944. type: dpdk_ovs_bridge
  945. address: 192.168.50.0
  946. netmask: 255.255.255.0
  947. mtu: 9000
  948. Linux storage
  949. -------------
  950. Linux with mounted Samba
  951. .. code-block:: yaml
  952. linux:
  953. storage:
  954. enabled: true
  955. mount:
  956. samba1:
  957. - enabled: true
  958. - path: /media/myuser/public/
  959. - device: //192.168.0.1/storage
  960. - file_system: cifs
  961. - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
  962. NFS mount
  963. .. code-block:: yaml
  964. linux:
  965. storage:
  966. enabled: true
  967. mount:
  968. nfs_glance:
  969. enabled: true
  970. path: /var/lib/glance/images
  971. device: 172.16.10.110:/var/nfs/glance
  972. file_system: nfs
  973. opts: rw,sync
  974. File swap configuration
  975. .. code-block:: yaml
  976. linux:
  977. storage:
  978. enabled: true
  979. swap:
  980. file:
  981. enabled: true
  982. engine: file
  983. device: /swapfile
  984. size: 1024
  985. Partition swap configuration
  986. .. code-block:: yaml
  987. linux:
  988. storage:
  989. enabled: true
  990. swap:
  991. partition:
  992. enabled: true
  993. engine: partition
  994. device: /dev/vg0/swap
  995. LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
  996. .. code-block:: yaml
  997. parameters:
  998. linux:
  999. storage:
  1000. mount:
  1001. data:
  1002. enabled: true
  1003. device: /dev/vg1/data
  1004. file_system: ext4
  1005. path: /mnt/data
  1006. lvm:
  1007. vg1:
  1008. enabled: true
  1009. devices:
  1010. - /dev/sdb
  1011. volume:
  1012. data:
  1013. size: 40G
  1014. mount: ${linux:storage:mount:data}
  1015. Multipath with Fujitsu Eternus DXL
  1016. .. code-block:: yaml
  1017. parameters:
  1018. linux:
  1019. storage:
  1020. multipath:
  1021. enabled: true
  1022. blacklist_devices:
  1023. - /dev/sda
  1024. - /dev/sdb
  1025. backends:
  1026. - fujitsu_eternus_dxl
  1027. Multipath with Hitachi VSP 1000
  1028. .. code-block:: yaml
  1029. parameters:
  1030. linux:
  1031. storage:
  1032. multipath:
  1033. enabled: true
  1034. blacklist_devices:
  1035. - /dev/sda
  1036. - /dev/sdb
  1037. backends:
  1038. - hitachi_vsp1000
  1039. Multipath with IBM Storwize
  1040. .. code-block:: yaml
  1041. parameters:
  1042. linux:
  1043. storage:
  1044. multipath:
  1045. enabled: true
  1046. blacklist_devices:
  1047. - /dev/sda
  1048. - /dev/sdb
  1049. backends:
  1050. - ibm_storwize
  1051. Multipath with multiple backends
  1052. .. code-block:: yaml
  1053. parameters:
  1054. linux:
  1055. storage:
  1056. multipath:
  1057. enabled: true
  1058. blacklist_devices:
  1059. - /dev/sda
  1060. - /dev/sdb
  1061. - /dev/sdc
  1062. - /dev/sdd
  1063. backends:
  1064. - ibm_storwize
  1065. - fujitsu_eternus_dxl
  1066. - hitachi_vsp1000
  1067. Disabled multipath (the default setup)
  1068. .. code-block:: yaml
  1069. parameters:
  1070. linux:
  1071. storage:
  1072. multipath:
  1073. enabled: false
  1074. Linux with local loopback device
  1075. .. code-block:: yaml
  1076. linux:
  1077. storage:
  1078. loopback:
  1079. disk1:
  1080. file: /srv/disk1
  1081. size: 50G
  1082. External config generation
  1083. --------------------------
  1084. You are able to use config support metadata between formulas and only generate
  1085. config files for external use, eg. docker, etc.
  1086. .. code-block:: yaml
  1087. parameters:
  1088. linux:
  1089. system:
  1090. config:
  1091. pillar:
  1092. jenkins:
  1093. master:
  1094. home: /srv/volumes/jenkins
  1095. approved_scripts:
  1096. - method java.net.URL openConnection
  1097. credentials:
  1098. - type: username_password
  1099. scope: global
  1100. id: test
  1101. desc: Testing credentials
  1102. username: test
  1103. password: test
  1104. Netconsole Remote Kernel Logging
  1105. --------------------------------
  1106. Netconsole logger could be configured for configfs-enabled kernels
  1107. (`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in
  1108. runtime (if network is already configured), and on-boot after interface
  1109. initialization. Notes:
  1110. * receiver could be located only in same L3 domain
  1111. (or you need to configure gateway MAC manually)
  1112. * receiver's MAC is detected only on configuration time
  1113. * using broadcast MAC is not recommended
  1114. .. code-block:: yaml
  1115. parameters:
  1116. linux:
  1117. system:
  1118. netconsole:
  1119. enabled: true
  1120. port: 514 (optional)
  1121. loglevel: debug (optional)
  1122. target:
  1123. 192.168.0.1:
  1124. interface: bond0
  1125. mac: "ff:ff:ff:ff:ff:ff" (optional)
  1126. Usage
  1127. =====
  1128. Set mtu of network interface eth0 to 1400
  1129. .. code-block:: bash
  1130. ip link set dev eth0 mtu 1400
  1131. Read more
  1132. =========
  1133. * https://www.archlinux.org/
  1134. * http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
  1135. Documentation and Bugs
  1136. ======================
  1137. To learn how to install and update salt-formulas, consult the documentation
  1138. available online at:
  1139. http://salt-formulas.readthedocs.io/
  1140. In the unfortunate event that bugs are discovered, they should be reported to
  1141. the appropriate issue tracker. Use Github issue tracker for specific salt
  1142. formula:
  1143. https://github.com/salt-formulas/salt-formula-linux/issues
  1144. For feature requests, bug reports or blueprints affecting entire ecosystem,
  1145. use Launchpad salt-formulas project:
  1146. https://launchpad.net/salt-formulas
  1147. You can also join salt-formulas-users team and subscribe to mailing list:
  1148. https://launchpad.net/~salt-formulas-users
  1149. Developers wishing to work on the salt-formulas projects should always base
  1150. their work on master branch and submit pull request against specific formula.
  1151. https://github.com/salt-formulas/salt-formula-linux
  1152. Any questions or feedback is always welcome so feel free to join our IRC
  1153. channel:
  1154. #salt-formulas @ irc.freenode.net