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 31KB

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