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

8 anni fa
8 anni fa
8 anni fa
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348
  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. RHEL / CentOS
  489. ^^^^^^^^^^^^^
  490. Unfortunately ``update-motd`` is currently not available for RHEL so there's
  491. no native support for dynamic motd.
  492. You can still set static one, only pillar structure differs:
  493. .. code-block:: yaml
  494. linux:
  495. system:
  496. motd: |
  497. This is [company name] network.
  498. Unauthorized access strictly prohibited.
  499. Haveged
  500. ~~~~~~~
  501. If you are running headless server and are low on entropy, it may be a good
  502. idea to setup Haveged.
  503. .. code-block:: yaml
  504. linux:
  505. system:
  506. haveged:
  507. enabled: true
  508. Linux network
  509. -------------
  510. Linux with network manager
  511. .. code-block:: yaml
  512. linux:
  513. network:
  514. enabled: true
  515. network_manager: true
  516. Linux with default static network interfaces, default gateway interface and DNS servers
  517. .. code-block:: yaml
  518. linux:
  519. network:
  520. enabled: true
  521. interface:
  522. eth0:
  523. enabled: true
  524. type: eth
  525. address: 192.168.0.102
  526. netmask: 255.255.255.0
  527. gateway: 192.168.0.1
  528. name_servers:
  529. - 8.8.8.8
  530. - 8.8.4.4
  531. mtu: 1500
  532. Linux with bonded interfaces and disabled NetworkManager
  533. .. code-block:: yaml
  534. linux:
  535. network:
  536. enabled: true
  537. interface:
  538. eth0:
  539. type: eth
  540. ...
  541. eth1:
  542. type: eth
  543. ...
  544. bond0:
  545. enabled: true
  546. type: bond
  547. address: 192.168.0.102
  548. netmask: 255.255.255.0
  549. mtu: 1500
  550. use_in:
  551. - interface: ${linux:interface:eth0}
  552. - interface: ${linux:interface:eth0}
  553. network_manager:
  554. disable: true
  555. Linux with vlan interface_params
  556. .. code-block:: yaml
  557. linux:
  558. network:
  559. enabled: true
  560. interface:
  561. vlan69:
  562. type: vlan
  563. use_interfaces:
  564. - interface: ${linux:interface:bond0}
  565. Linux with wireless interface parameters
  566. .. code-block:: yaml
  567. linux:
  568. network:
  569. enabled: true
  570. gateway: 10.0.0.1
  571. default_interface: eth0
  572. interface:
  573. wlan0:
  574. type: eth
  575. wireless:
  576. essid: example
  577. key: example_key
  578. security: wpa
  579. priority: 1
  580. Linux networks with routes defined
  581. .. code-block:: yaml
  582. linux:
  583. network:
  584. enabled: true
  585. gateway: 10.0.0.1
  586. default_interface: eth0
  587. interface:
  588. eth0:
  589. type: eth
  590. route:
  591. default:
  592. address: 192.168.0.123
  593. netmask: 255.255.255.0
  594. gateway: 192.168.0.1
  595. Native Linux Bridges
  596. .. code-block:: yaml
  597. linux:
  598. network:
  599. interface:
  600. eth1:
  601. enabled: true
  602. type: eth
  603. proto: manual
  604. up_cmds:
  605. - ip address add 0/0 dev $IFACE
  606. - ip link set $IFACE up
  607. down_cmds:
  608. - ip link set $IFACE down
  609. br-ex:
  610. enabled: true
  611. type: bridge
  612. address: ${linux:network:host:public_local:address}
  613. netmask: 255.255.255.0
  614. use_interfaces:
  615. - eth1
  616. OpenVswitch Bridges
  617. .. code-block:: yaml
  618. linux:
  619. network:
  620. bridge: openvswitch
  621. interface:
  622. eth1:
  623. enabled: true
  624. type: eth
  625. proto: manual
  626. up_cmds:
  627. - ip address add 0/0 dev $IFACE
  628. - ip link set $IFACE up
  629. down_cmds:
  630. - ip link set $IFACE down
  631. br-ex:
  632. enabled: true
  633. type: bridge
  634. address: ${linux:network:host:public_local:address}
  635. netmask: 255.255.255.0
  636. use_interfaces:
  637. - eth1
  638. DHCP client configuration
  639. None of the keys is mandatory, include only those you really need. For full list
  640. of available options under send, supersede, prepend, append refer to dhcp-options(5)
  641. .. code-block:: yaml
  642. linux:
  643. network:
  644. dhclient:
  645. enabled: true
  646. backoff_cutoff: 15
  647. initial_interval: 10
  648. reboot: 10
  649. retry: 60
  650. select_timeout: 0
  651. timeout: 120
  652. send:
  653. - option: host-name
  654. declaration: "= gethostname()"
  655. supersede:
  656. - option: host-name
  657. declaration: "spaceship"
  658. - option: domain-name
  659. declaration: "domain.home"
  660. #- option: arp-cache-timeout
  661. # declaration: 20
  662. prepend:
  663. - option: domain-name-servers
  664. declaration:
  665. - 8.8.8.8
  666. - 8.8.4.4
  667. - option: domain-search
  668. declaration:
  669. - example.com
  670. - eng.example.com
  671. #append:
  672. #- option: domain-name-servers
  673. # declaration: 127.0.0.1
  674. # ip or subnet to reject dhcp offer from
  675. reject:
  676. - 192.33.137.209
  677. - 10.0.2.0/24
  678. request:
  679. - subnet-mask
  680. - broadcast-address
  681. - time-offset
  682. - routers
  683. - domain-name
  684. - domain-name-servers
  685. - domain-search
  686. - host-name
  687. - dhcp6.name-servers
  688. - dhcp6.domain-search
  689. - dhcp6.fqdn
  690. - dhcp6.sntp-servers
  691. - netbios-name-servers
  692. - netbios-scope
  693. - interface-mtu
  694. - rfc3442-classless-static-routes
  695. - ntp-servers
  696. require:
  697. - subnet-mask
  698. - domain-name-servers
  699. # if per interface configuration required add below
  700. interface:
  701. ens2:
  702. initial_interval: 11
  703. reject:
  704. - 192.33.137.210
  705. ens3:
  706. initial_interval: 12
  707. reject:
  708. - 192.33.137.211
  709. Configure global environment variables
  710. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  711. Linux /etc/environment:
  712. ``/etc/environment`` is for static system wide variable assignment after boot. Variable expansion is frequently not supported.
  713. .. code-block:: yaml
  714. linux:
  715. system:
  716. env:
  717. BOB_VARIABLE: Alice
  718. ...
  719. BOB_PATH:
  720. - /srv/alice/bin
  721. - /srv/bob/bin
  722. ...
  723. ftp_proxy: none
  724. http_proxy: http://global-http-proxy.host.local:8080
  725. https_proxy: ${linux:system:proxy:https}
  726. no_proxy:
  727. - 192.168.0.80
  728. - 192.168.1.80
  729. - .domain.com
  730. - .local
  731. ...
  732. # NOTE: global defaults proxy configuration.
  733. proxy:
  734. ftp: ftp://proxy.host.local:2121
  735. http: http://proxy.host.local:3142
  736. https: https://proxy.host.local:3143
  737. noproxy:
  738. - .domain.com
  739. - .local
  740. Configure profile.d scripts
  741. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  742. Linux /etc/profile.d:
  743. The profile.d scripts are being sourced during .sh execution and support variable expansion in opposite to /etc/environment
  744. global settings in ``/etc/environment``.
  745. .. code-block:: yaml
  746. linux:
  747. system:
  748. profile:
  749. locales: |
  750. export LANG=C
  751. export LC_ALL=C
  752. ...
  753. vi_flavors.sh: |
  754. export PAGER=view
  755. export EDITOR=vim
  756. alias vi=vim
  757. shell_locales.sh: |
  758. export LANG=en_US
  759. export LC_ALL=en_US.UTF-8
  760. shell_proxies.sh: |
  761. export FTP_PROXY=ftp://127.0.3.3:2121
  762. export NO_PROXY='.local'
  763. Linux with hosts
  764. ~~~~~~~~~~~~~~~~
  765. Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
  766. that are not defined in model except defaults for both IPv4 and IPv6 localhost
  767. and hostname + fqdn.
  768. It's good to use this option if you want to ensure /etc/hosts is always in a
  769. clean state however it's not enabled by default for safety.
  770. .. code-block:: yaml
  771. linux:
  772. network:
  773. ...
  774. purge_hosts: true
  775. host:
  776. # No need to define this one if purge_hosts is true
  777. hostname:
  778. address: 127.0.1.1
  779. names:
  780. - ${linux:network:fqdn}
  781. - ${linux:network:hostname}
  782. node1:
  783. address: 192.168.10.200
  784. names:
  785. - node2.domain.com
  786. - service2.domain.com
  787. node2:
  788. address: 192.168.10.201
  789. names:
  790. - node2.domain.com
  791. - service2.domain.com
  792. Setup resolv.conf, nameservers, domain and search domains
  793. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  794. .. code-block:: yaml
  795. linux:
  796. network:
  797. resolv:
  798. dns:
  799. - 8.8.4.4
  800. - 8.8.8.8
  801. domain: my.example.com
  802. search:
  803. - my.example.com
  804. - example.com
  805. options:
  806. - ndots: 5
  807. - timeout: 2
  808. - attempts: 2
  809. **setting custom TX queue length for tap interfaces**
  810. .. code-block:: yaml
  811. linux:
  812. network:
  813. tap_custom_txqueuelen: 10000
  814. DPDK OVS interfaces
  815. --------------------
  816. **DPDK OVS NIC**
  817. .. code-block:: yaml
  818. linux:
  819. network:
  820. bridge: openvswitch
  821. dpdk:
  822. enabled: true
  823. driver: uio/vfio-pci
  824. openvswitch:
  825. pmd_cpu_mask: "0x6"
  826. dpdk_socket_mem: "1024,1024"
  827. dpdk_lcore_mask: "0x400"
  828. memory_channels: 2
  829. interface:
  830. dpkd0:
  831. name: ${_param:dpdk_nic}
  832. pci: 0000:06:00.0
  833. driver: igb_uio/vfio
  834. enabled: true
  835. type: dpdk_ovs_port
  836. n_rxq: 2
  837. bridge: br-prv
  838. mtu: 9000
  839. br-prv:
  840. enabled: true
  841. type: dpdk_ovs_bridge
  842. **DPDK OVS Bond**
  843. .. code-block:: yaml
  844. linux:
  845. network:
  846. bridge: openvswitch
  847. dpdk:
  848. enabled: true
  849. driver: uio/vfio-pci
  850. openvswitch:
  851. pmd_cpu_mask: "0x6"
  852. dpdk_socket_mem: "1024,1024"
  853. dpdk_lcore_mask: "0x400"
  854. memory_channels: 2
  855. interface:
  856. dpdk_second_nic:
  857. name: ${_param:primary_second_nic}
  858. pci: 0000:06:00.0
  859. driver: igb_uio/vfio
  860. bond: dpdkbond0
  861. enabled: true
  862. type: dpdk_ovs_port
  863. n_rxq: 2
  864. mtu: 9000
  865. dpdk_first_nic:
  866. name: ${_param:primary_first_nic}
  867. pci: 0000:05:00.0
  868. driver: igb_uio/vfio
  869. bond: dpdkbond0
  870. enabled: true
  871. type: dpdk_ovs_port
  872. n_rxq: 2
  873. mtu: 9000
  874. dpdkbond0:
  875. enabled: true
  876. bridge: br-prv
  877. type: dpdk_ovs_bond
  878. mode: active-backup
  879. br-prv:
  880. enabled: true
  881. type: dpdk_ovs_bridge
  882. **DPDK OVS bridge for VXLAN**
  883. If VXLAN is used as tenant segmentation then ip address must be set on br-prv
  884. .. code-block:: yaml
  885. linux:
  886. network:
  887. ...
  888. interface:
  889. br-prv:
  890. enabled: true
  891. type: dpdk_ovs_bridge
  892. address: 192.168.50.0
  893. netmask: 255.255.255.0
  894. mtu: 9000
  895. Linux storage
  896. -------------
  897. Linux with mounted Samba
  898. .. code-block:: yaml
  899. linux:
  900. storage:
  901. enabled: true
  902. mount:
  903. samba1:
  904. - enabled: true
  905. - path: /media/myuser/public/
  906. - device: //192.168.0.1/storage
  907. - file_system: cifs
  908. - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
  909. NFS mount
  910. .. code-block:: yaml
  911. linux:
  912. storage:
  913. enabled: true
  914. mount:
  915. nfs_glance:
  916. enabled: true
  917. path: /var/lib/glance/images
  918. device: 172.16.10.110:/var/nfs/glance
  919. file_system: nfs
  920. opts: rw,sync
  921. File swap configuration
  922. .. code-block:: yaml
  923. linux:
  924. storage:
  925. enabled: true
  926. swap:
  927. file:
  928. enabled: true
  929. engine: file
  930. device: /swapfile
  931. size: 1024
  932. Partition swap configuration
  933. .. code-block:: yaml
  934. linux:
  935. storage:
  936. enabled: true
  937. swap:
  938. partition:
  939. enabled: true
  940. engine: partition
  941. device: /dev/vg0/swap
  942. LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
  943. .. code-block:: yaml
  944. parameters:
  945. linux:
  946. storage:
  947. mount:
  948. data:
  949. enabled: true
  950. device: /dev/vg1/data
  951. file_system: ext4
  952. path: /mnt/data
  953. lvm:
  954. vg1:
  955. enabled: true
  956. devices:
  957. - /dev/sdb
  958. volume:
  959. data:
  960. size: 40G
  961. mount: ${linux:storage:mount:data}
  962. Multipath with Fujitsu Eternus DXL
  963. .. code-block:: yaml
  964. parameters:
  965. linux:
  966. storage:
  967. multipath:
  968. enabled: true
  969. blacklist_devices:
  970. - /dev/sda
  971. - /dev/sdb
  972. backends:
  973. - fujitsu_eternus_dxl
  974. Multipath with Hitachi VSP 1000
  975. .. code-block:: yaml
  976. parameters:
  977. linux:
  978. storage:
  979. multipath:
  980. enabled: true
  981. blacklist_devices:
  982. - /dev/sda
  983. - /dev/sdb
  984. backends:
  985. - hitachi_vsp1000
  986. Multipath with IBM Storwize
  987. .. code-block:: yaml
  988. parameters:
  989. linux:
  990. storage:
  991. multipath:
  992. enabled: true
  993. blacklist_devices:
  994. - /dev/sda
  995. - /dev/sdb
  996. backends:
  997. - ibm_storwize
  998. Multipath with multiple backends
  999. .. code-block:: yaml
  1000. parameters:
  1001. linux:
  1002. storage:
  1003. multipath:
  1004. enabled: true
  1005. blacklist_devices:
  1006. - /dev/sda
  1007. - /dev/sdb
  1008. - /dev/sdc
  1009. - /dev/sdd
  1010. backends:
  1011. - ibm_storwize
  1012. - fujitsu_eternus_dxl
  1013. - hitachi_vsp1000
  1014. Disabled multipath (the default setup)
  1015. .. code-block:: yaml
  1016. parameters:
  1017. linux:
  1018. storage:
  1019. multipath:
  1020. enabled: false
  1021. Linux with local loopback device
  1022. .. code-block:: yaml
  1023. linux:
  1024. storage:
  1025. loopback:
  1026. disk1:
  1027. file: /srv/disk1
  1028. size: 50G
  1029. External config generation
  1030. --------------------------
  1031. You are able to use config support metadata between formulas and only generate
  1032. config files for external use, eg. docker, etc.
  1033. .. code-block:: yaml
  1034. parameters:
  1035. linux:
  1036. system:
  1037. config:
  1038. pillar:
  1039. jenkins:
  1040. master:
  1041. home: /srv/volumes/jenkins
  1042. approved_scripts:
  1043. - method java.net.URL openConnection
  1044. credentials:
  1045. - type: username_password
  1046. scope: global
  1047. id: test
  1048. desc: Testing credentials
  1049. username: test
  1050. password: test
  1051. Netconsole Remote Kernel Logging
  1052. --------------------------------
  1053. Netconsole logger could be configured for configfs-enabled kernels
  1054. (`CONFIG_NETCONSOLE_DYNAMIC` should be enabled). Configuration applies both in
  1055. runtime (if network is already configured), and on-boot after interface
  1056. initialization. Notes:
  1057. * receiver could be located only in same L3 domain
  1058. (or you need to configure gateway MAC manually)
  1059. * receiver's MAC is detected only on configuration time
  1060. * using broadcast MAC is not recommended
  1061. .. code-block:: yaml
  1062. parameters:
  1063. linux:
  1064. system:
  1065. netconsole:
  1066. enabled: true
  1067. port: 514 (optional)
  1068. loglevel: debug (optional)
  1069. target:
  1070. 192.168.0.1:
  1071. interface: bond0
  1072. mac: "ff:ff:ff:ff:ff:ff" (optional)
  1073. Usage
  1074. =====
  1075. Set mtu of network interface eth0 to 1400
  1076. .. code-block:: bash
  1077. ip link set dev eth0 mtu 1400
  1078. Read more
  1079. =========
  1080. * https://www.archlinux.org/
  1081. * http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
  1082. Documentation and Bugs
  1083. ======================
  1084. To learn how to install and update salt-formulas, consult the documentation
  1085. available online at:
  1086. http://salt-formulas.readthedocs.io/
  1087. In the unfortunate event that bugs are discovered, they should be reported to
  1088. the appropriate issue tracker. Use Github issue tracker for specific salt
  1089. formula:
  1090. https://github.com/salt-formulas/salt-formula-linux/issues
  1091. For feature requests, bug reports or blueprints affecting entire ecosystem,
  1092. use Launchpad salt-formulas project:
  1093. https://launchpad.net/salt-formulas
  1094. You can also join salt-formulas-users team and subscribe to mailing list:
  1095. https://launchpad.net/~salt-formulas-users
  1096. Developers wishing to work on the salt-formulas projects should always base
  1097. their work on master branch and submit pull request against specific formula.
  1098. https://github.com/salt-formulas/salt-formula-linux
  1099. Any questions or feedback is always welcome so feel free to join our IRC
  1100. channel:
  1101. #salt-formulas @ irc.freenode.net