Saltstack Official Linux Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

README.rst 32KB

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