Saltstack Official Linux Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

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