Saltstack Official Linux Formula
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

7 роки тому
9 роки тому
9 роки тому
7 роки тому
9 роки тому
7 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
7 роки тому
7 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
8 роки тому
8 роки тому
8 роки тому
8 роки тому
8 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
8 роки тому
8 роки тому
8 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
7 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213
  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:: If no ``password`` variable is passed,
  27. any predifined password will be removed.
  28. .. code-block:: yaml
  29. linux:
  30. system:
  31. ...
  32. user:
  33. jdoe:
  34. name: 'jdoe'
  35. enabled: true
  36. sudo: true
  37. shell: /bin/bash
  38. full_name: 'Jonh Doe'
  39. home: '/home/jdoe'
  40. home_dir_mode: 755
  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
  185. verification:
  186. .. code-block:: yaml
  187. linux:
  188. system:
  189. ...
  190. package:
  191. package-name:
  192. version: 2132.323
  193. repo: 'custom-repo'
  194. verify: false
  195. Linux with autoupdates (automatically install security package
  196. updates):
  197. .. code-block:: yaml
  198. linux:
  199. system:
  200. ...
  201. autoupdates:
  202. enabled: true
  203. mail: root@localhost
  204. mail_only_on_error: true
  205. remove_unused_dependencies: false
  206. automatic_reboot: true
  207. automatic_reboot_time: "02:00"
  208. Managing cron tasks
  209. -------------------
  210. There are two data structures that are related to managing cron itself and
  211. cron tasks:
  212. .. code-block:: yaml
  213. linux:
  214. system:
  215. cron:
  216. and
  217. .. code-block:: yaml
  218. linux:
  219. system:
  220. job:
  221. `linux:system:cron` manages cron packages, services, and '/etc/cron.allow' file.
  222. 'deny' files are managed the only way - we're ensuring they are absent, that's
  223. a requirement from CIS 5.1.8
  224. 'cron' pillar structure is the following:
  225. .. code-block:: yaml
  226. linux:
  227. system:
  228. cron:
  229. enabled: true
  230. pkgs: [ <cron packages> ]
  231. services: [ <cron services> ]
  232. user:
  233. <username>:
  234. enabled: true
  235. To add user to '/etc/cron.allow' use 'enabled' key as shown above.
  236. '/etc/cron.deny' is not managed as CIS 5.1.8 requires it was removed.
  237. A user would be ignored if any of the following is true:
  238. * user is disabled in `linux:system:user:<username>`
  239. * user is disabled in `linux:system:cron:user:<username>`
  240. `linux:system:job` manages individual cron tasks.
  241. By default, it will use name as an identifier, unless identifier key is
  242. explicitly set or False (then it will use Salt's default behavior which is
  243. identifier same as command resulting in not being able to change it):
  244. .. code-block:: yaml
  245. linux:
  246. system:
  247. ...
  248. job:
  249. cmd1:
  250. command: '/cmd/to/run'
  251. identifier: cmd1
  252. enabled: true
  253. user: 'root'
  254. hour: 2
  255. minute: 0
  256. Managing 'at' tasks
  257. -------------------
  258. Pillar for managing `at` tasks is similar to one for `cron` tasks:
  259. .. code-block:: yaml
  260. linux:
  261. system:
  262. at:
  263. enabled: true
  264. pkgs: [ <at packages> ]
  265. services: [ <at services> ]
  266. user:
  267. <username>:
  268. enabled: true
  269. To add a user to '/etc/at.allow' use 'enabled' key as shown above.
  270. '/etc/at.deny' is not managed as CIS 5.1.8 requires it was removed.
  271. A user will be ignored if any of the following is true:
  272. * user is disabled in `linux:system:user:<username>`
  273. * user is disabled in `linux:system:at:user:<username>`
  274. Linux security limits (limit sensu user memory usage to max 1GB):
  275. .. code-block:: yaml
  276. linux:
  277. system:
  278. ...
  279. limit:
  280. sensu:
  281. enabled: true
  282. domain: sensu
  283. limits:
  284. - type: hard
  285. item: as
  286. value: 1000000
  287. Enable autologin on ``tty1`` (may work only for Ubuntu 14.04):
  288. .. code-block:: yaml
  289. linux:
  290. system:
  291. console:
  292. tty1:
  293. autologin: root
  294. # Enable serial console
  295. ttyS0:
  296. autologin: root
  297. rate: 115200
  298. term: xterm
  299. To disable set autologin to ``false``.
  300. Set ``policy-rc.d`` on Debian-based systems. Action can be any available
  301. command in ``while true`` loop and ``case`` context.
  302. Following will disallow dpkg to stop/start services for the Cassandra
  303. package automatically:
  304. .. code-block:: yaml
  305. linux:
  306. system:
  307. policyrcd:
  308. - package: cassandra
  309. action: exit 101
  310. - package: '*'
  311. action: switch
  312. Set system locales:
  313. .. code-block:: yaml
  314. linux:
  315. system:
  316. locale:
  317. en_US.UTF-8:
  318. default: true
  319. "cs_CZ.UTF-8 UTF-8":
  320. enabled: true
  321. Systemd settings:
  322. .. code-block:: yaml
  323. linux:
  324. system:
  325. ...
  326. systemd:
  327. system:
  328. Manager:
  329. DefaultLimitNOFILE: 307200
  330. DefaultLimitNPROC: 307200
  331. user:
  332. Manager:
  333. DefaultLimitCPU: 2
  334. DefaultLimitNPROC: 4
  335. Ensure presence of directory:
  336. .. code-block:: yaml
  337. linux:
  338. system:
  339. directory:
  340. /tmp/test:
  341. user: root
  342. group: root
  343. mode: 700
  344. makedirs: true
  345. Ensure presence of file by specifying its source:
  346. .. code-block:: yaml
  347. linux:
  348. system:
  349. file:
  350. /tmp/test.txt:
  351. source: http://example.com/test.txt
  352. user: root #optional
  353. group: root #optional
  354. mode: 700 #optional
  355. dir_mode: 700 #optional
  356. encoding: utf-8 #optional
  357. hash: <<hash>> or <<URI to hash>> #optional
  358. makedirs: true #optional
  359. linux:
  360. system:
  361. file:
  362. test.txt:
  363. name: /tmp/test.txt
  364. source: http://example.com/test.txt
  365. Ensure presence of file by specifying its contents:
  366. .. code-block:: yaml
  367. linux:
  368. system:
  369. file:
  370. /tmp/test.txt:
  371. contents: |
  372. line1
  373. line2
  374. linux:
  375. system:
  376. file:
  377. /tmp/test.txt:
  378. contents_pillar: linux:network:hostname
  379. linux:
  380. system:
  381. file:
  382. /tmp/test.txt:
  383. contents_grains: motd
  384. Ensure presence of file to be serialized through one of the
  385. serializer modules (see:
  386. https://docs.saltstack.com/en/latest/ref/serializers/all/index.html):
  387. .. code-block:: yaml
  388. linux:
  389. system:
  390. file:
  391. /tmp/test.json:
  392. serialize: json
  393. contents:
  394. foo: 1
  395. bar: 'bar'
  396. Kernel
  397. ~~~~~~
  398. Install always up to date LTS kernel and headers from Ubuntu Trusty:
  399. .. code-block:: yaml
  400. linux:
  401. system:
  402. kernel:
  403. type: generic
  404. lts: trusty
  405. headers: true
  406. Load kernel modules and add them to ``/etc/modules``:
  407. .. code-block:: yaml
  408. linux:
  409. system:
  410. kernel:
  411. modules:
  412. - nf_conntrack
  413. - tp_smapi
  414. - 8021q
  415. Configure or blacklist kernel modules with additional options to
  416. ``/etc/modprobe.d`` following example will add
  417. ``/etc/modprobe.d/nf_conntrack.conf`` file with line
  418. ``options nf_conntrack hashsize=262144``:
  419. 'option' can be a mapping (with 'enabled' and 'value' keys) or a scalar.
  420. Example for 'scalar' option value:
  421. .. code-block:: yaml
  422. linux:
  423. system:
  424. kernel:
  425. module:
  426. nf_conntrack:
  427. option:
  428. hashsize: 262144
  429. Example for 'mapping' option value:
  430. .. code-block:: yaml
  431. linux:
  432. system:
  433. kernel:
  434. module:
  435. nf_conntrack:
  436. option:
  437. hashsize:
  438. enabled: true
  439. value: 262144
  440. NOTE: 'enabled' key is optional and is True by default.
  441. Blacklist a module:
  442. .. code-block:: yaml
  443. linux:
  444. system:
  445. kernel:
  446. module:
  447. nf_conntrack:
  448. blacklist: true
  449. A module can have a number of aliases, wildcards are allowed.
  450. Define an alias for a module:
  451. .. code-block:: yaml
  452. linux:
  453. system:
  454. kernel:
  455. module:
  456. nf_conntrack:
  457. alias:
  458. nfct:
  459. enabled: true
  460. "nf_conn*":
  461. enabled: true
  462. NOTE: 'enabled' key is mandatory as there are no other keys exist.
  463. Execute custom command instead of 'insmod' when inserting a module:
  464. .. code-block:: yaml
  465. linux:
  466. system:
  467. kernel:
  468. module:
  469. nf_conntrack:
  470. install:
  471. enabled: true
  472. command: /bin/true
  473. NOTE: 'enabled' key is optional and is True by default.
  474. Execute custom command instead of 'rmmod' when removing a module:
  475. .. code-block:: yaml
  476. linux:
  477. system:
  478. kernel:
  479. module:
  480. nf_conntrack:
  481. remove:
  482. enabled: true
  483. command: /bin/true
  484. NOTE: 'enabled' key is optional and is True by default.
  485. Define module dependencies:
  486. .. code-block:: yaml
  487. linux:
  488. system:
  489. kernel:
  490. module:
  491. nf_conntrack:
  492. softdep:
  493. pre:
  494. 1:
  495. enabled: true
  496. value: a
  497. 2:
  498. enabled: true
  499. value: b
  500. 3:
  501. enabled: true
  502. value: c
  503. post:
  504. 1:
  505. enabled: true
  506. value: x
  507. 2:
  508. enabled: true
  509. value: y
  510. 3:
  511. enabled: true
  512. value: z
  513. NOTE: 'enabled' key is optional and is True by default.
  514. Install specific kernel version and ensure all other kernel packages are
  515. not present. Also install extra modules and headers for this kernel:
  516. .. code-block:: yaml
  517. linux:
  518. system:
  519. kernel:
  520. type: generic
  521. extra: true
  522. headers: true
  523. version: 4.2.0-22
  524. Systcl kernel parameters:
  525. .. code-block:: yaml
  526. linux:
  527. system:
  528. kernel:
  529. sysctl:
  530. net.ipv4.tcp_keepalive_intvl: 3
  531. net.ipv4.tcp_keepalive_time: 30
  532. net.ipv4.tcp_keepalive_probes: 8
  533. Configure kernel boot options:
  534. .. code-block:: yaml
  535. linux:
  536. system:
  537. kernel:
  538. boot_options:
  539. - elevator=deadline
  540. - spectre_v2=off
  541. - nopti
  542. CPU
  543. ~~~
  544. Enable cpufreq governor for every cpu:
  545. .. code-block:: yaml
  546. linux:
  547. system:
  548. cpu:
  549. governor: performance
  550. CGROUPS
  551. ~~~~~~~
  552. Setup linux cgroups:
  553. .. code-block:: yaml
  554. linux:
  555. system:
  556. cgroup:
  557. enabled: true
  558. group:
  559. ceph_group_1:
  560. controller:
  561. cpu:
  562. shares:
  563. value: 250
  564. cpuacct:
  565. usage:
  566. value: 0
  567. cpuset:
  568. cpus:
  569. value: 1,2,3
  570. memory:
  571. limit_in_bytes:
  572. value: 2G
  573. memsw.limit_in_bytes:
  574. value: 3G
  575. mapping:
  576. subjects:
  577. - '@ceph'
  578. generic_group_1:
  579. controller:
  580. cpu:
  581. shares:
  582. value: 250
  583. cpuacct:
  584. usage:
  585. value: 0
  586. mapping:
  587. subjects:
  588. - '*:firefox'
  589. - 'student:cp'
  590. Shared libraries
  591. ~~~~~~~~~~~~~~~~
  592. Set additional shared library to Linux system library path:
  593. .. code-block:: yaml
  594. linux:
  595. system:
  596. ld:
  597. library:
  598. java:
  599. - /usr/lib/jvm/jre-openjdk/lib/amd64/server
  600. - /opt/java/jre/lib/amd64/server
  601. Certificates
  602. ~~~~~~~~~~~~
  603. Add certificate authority into system trusted CA bundle:
  604. .. code-block:: yaml
  605. linux:
  606. system:
  607. ca_certificates:
  608. mycert: |
  609. -----BEGIN CERTIFICATE-----
  610. MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
  611. A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
  612. cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
  613. MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
  614. BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
  615. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
  616. ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
  617. BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
  618. I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
  619. CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
  620. lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
  621. AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
  622. -----END CERTIFICATE-----
  623. Sysfs
  624. ~~~~~
  625. Install sysfsutils and set sysfs attributes:
  626. .. code-block:: yaml
  627. linux:
  628. system:
  629. sysfs:
  630. scheduler:
  631. block/sda/queue/scheduler: deadline
  632. power:
  633. mode:
  634. power/state: 0660
  635. owner:
  636. power/state: "root:power"
  637. devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
  638. Optional: You can also use list that will ensure order of items.
  639. .. code-block:: yaml
  640. linux:
  641. system:
  642. sysfs:
  643. scheduler:
  644. block/sda/queue/scheduler: deadline
  645. power:
  646. - mode:
  647. power/state: 0660
  648. - owner:
  649. power/state: "root:power"
  650. - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
  651. Huge Pages
  652. ~~~~~~~~~~~~
  653. Huge Pages give a performance boost to applications that intensively deal
  654. with memory allocation/deallocation by decreasing memory fragmentation:
  655. .. code-block:: yaml
  656. linux:
  657. system:
  658. kernel:
  659. hugepages:
  660. small:
  661. size: 2M
  662. count: 107520
  663. mount_point: /mnt/hugepages_2MB
  664. mount: false/true # default is true (mount immediately) / false (just save in the fstab)
  665. large:
  666. default: true # default automatically mounted
  667. size: 1G
  668. count: 210
  669. mount_point: /mnt/hugepages_1GB
  670. .. note:: Not recommended to use both pagesizes concurrently.
  671. Intel SR-IOV
  672. ~~~~~~~~~~~~
  673. PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV)
  674. specification defines a standardized mechanism to virtualize
  675. PCIe devices. The mechanism can virtualize a single PCIe
  676. Ethernet controller to appear as multiple PCIe devices:
  677. .. code-block:: yaml
  678. linux:
  679. system:
  680. kernel:
  681. sriov: True
  682. unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
  683. rc:
  684. local: |
  685. #!/bin/sh -e
  686. # Enable 7 VF on eth1
  687. echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
  688. exit 0
  689. Isolate CPU options
  690. ~~~~~~~~~~~~~~~~~~~
  691. Remove the specified CPUs, as defined by the cpu_number values, from
  692. the general kernel SMP balancing and scheduler algroithms. The only
  693. way to move a process onto or off an *isolated* CPU is via the CPU
  694. affinity syscalls. ``cpu_number begins`` at ``0``, so the
  695. maximum value is ``1`` less than the number of CPUs on the system.:
  696. .. code-block:: yaml
  697. linux:
  698. system:
  699. kernel:
  700. isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
  701. Repositories
  702. ~~~~~~~~~~~~
  703. RedHat-based Linux with additional OpenStack repo:
  704. .. code-block:: yaml
  705. linux:
  706. system:
  707. ...
  708. repo:
  709. rdo-icehouse:
  710. enabled: true
  711. source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
  712. pgpcheck: 0
  713. Ensure system repository to use czech Debian mirror (``default: true``)
  714. Also pin it's packages with priority ``900``:
  715. .. code-block:: yaml
  716. linux:
  717. system:
  718. repo:
  719. debian:
  720. default: true
  721. source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
  722. # Import signing key from URL if needed
  723. key_url: "http://dummy.com/public.gpg"
  724. pin:
  725. - pin: 'origin "ftp.cz.debian.org"'
  726. priority: 900
  727. package: '*'
  728. .. note:: For old Ubuntu releases (<xenial)
  729. extra packages for apt transport, like ``apt-transport-https``
  730. may be required to be installed manually.
  731. (Chicken-eggs issue: we need to install packages to
  732. reach repo from where they should be installed)
  733. Otherwise, you still can try 'fortune' and install prereq.packages before
  734. any repo configuration, using list of requires in map.jinja.
  735. Disabling any prerequisite packages installation:
  736. You can simply drop any package pre-installation (before system.linux.repo
  737. will be processed) via cluster lvl:
  738. .. code-block:: yaml
  739. linux:
  740. system:
  741. pkgs: ~
  742. Package manager proxy global setup:
  743. .. code-block:: yaml
  744. linux:
  745. system:
  746. ...
  747. repo:
  748. apt-mk:
  749. source: "deb http://apt-mk.mirantis.com/ stable main salt"
  750. ...
  751. proxy:
  752. pkg:
  753. enabled: true
  754. ftp: ftp://ftp-proxy-for-apt.host.local:2121
  755. ...
  756. # NOTE: Global defaults for any other componet that configure proxy on the system.
  757. # If your environment has just one simple proxy, set it on linux:system:proxy.
  758. #
  759. # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
  760. # as for https and http
  761. ftp: ftp://proxy.host.local:2121
  762. http: http://proxy.host.local:3142
  763. https: https://proxy.host.local:3143
  764. Package manager proxy setup per repository:
  765. .. code-block:: yaml
  766. linux:
  767. system:
  768. ...
  769. repo:
  770. debian:
  771. source: "deb http://apt-mk.mirantis.com/ stable main salt"
  772. ...
  773. apt-mk:
  774. source: "deb http://apt-mk.mirantis.com/ stable main salt"
  775. # per repository proxy
  776. proxy:
  777. enabled: true
  778. http: http://maas-01:8080
  779. https: http://maas-01:8080
  780. ...
  781. proxy:
  782. # package manager fallback defaults
  783. # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
  784. pkg:
  785. enabled: true
  786. ftp: ftp://proxy.host.local:2121
  787. #http: http://proxy.host.local:3142
  788. #https: https://proxy.host.local:3143
  789. ...
  790. # global system fallback system defaults
  791. ftp: ftp://proxy.host.local:2121
  792. http: http://proxy.host.local:3142
  793. https: https://proxy.host.local:3143
  794. Remove all repositories:
  795. .. code-block:: yaml
  796. linux:
  797. system:
  798. purge_repos: true
  799. Refresh repositories metada, after configuration:
  800. .. code-block:: yaml
  801. linux:
  802. system:
  803. refresh_repos_meta: true
  804. Setup custom apt config options:
  805. .. code-block:: yaml
  806. linux:
  807. system:
  808. apt:
  809. config:
  810. compression-workaround:
  811. "Acquire::CompressionTypes::Order": "gz"
  812. docker-clean:
  813. "DPkg::Post-Invoke":
  814. - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
  815. "APT::Update::Post-Invoke":
  816. - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
  817. RC
  818. ~~
  819. rc.local example
  820. .. code-block:: yaml
  821. linux:
  822. system:
  823. rc:
  824. local: |
  825. #!/bin/sh -e
  826. #
  827. # rc.local
  828. #
  829. # This script is executed at the end of each multiuser runlevel.
  830. # Make sure that the script will "exit 0" on success or any other
  831. # value on error.
  832. #
  833. # In order to enable or disable this script just change the execution
  834. # bits.
  835. #
  836. # By default this script does nothing.
  837. exit 0
  838. Prompt
  839. ~~~~~~
  840. Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``.
  841. Every user can have different prompt:
  842. .. code-block:: yaml
  843. linux:
  844. system:
  845. prompt:
  846. 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\\]
  847. default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
  848. On Debian systems, to set prompt system-wide, it's necessary to
  849. remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``,
  850. which comes from ``/etc/skel/.bashrc``. This formula will do
  851. this automatically, but will not touch existing user's
  852. ``~/.bashrc`` files except root.
  853. Bash
  854. ~~~~
  855. Fix bash configuration to preserve history across sessions
  856. like ZSH does by default:
  857. .. code-block:: yaml
  858. linux:
  859. system:
  860. bash:
  861. preserve_history: true
  862. Login banner message
  863. ~~~~~~~~~~~~~~~~~~~~
  864. ``/etc/issue`` is a text file which contains a message or system
  865. identification to be printed before the login prompt. It may contain
  866. various @char and \char sequences, if supported by the getty-type
  867. program employed on the system.
  868. Setting logon banner message is easy:
  869. .. code-block:: yaml
  870. liunx:
  871. system:
  872. banner:
  873. enabled: true
  874. contents: |
  875. UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
  876. You must have explicit, authorized permission to access or configure this
  877. device. Unauthorized attempts and actions to access or use this system may
  878. result in civil and/or criminal penalties.
  879. All activities performed on this system are logged and monitored.
  880. Message of the day
  881. ~~~~~~~~~~~~~~~~~~
  882. ``pam_motd`` from package ``libpam-modules`` is used for dynamic
  883. messages of the day. Setting custom ``motd`` will clean up existing ones.
  884. Setting static ``motd`` will replace existing ``/etc/motd`` and remove
  885. scripts from ``/etc/update-motd.d``.
  886. Setting static ``motd``:
  887. .. code-block:: yaml
  888. linux:
  889. system:
  890. motd: |
  891. UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
  892. You must have explicit, authorized permission to access or configure this
  893. device. Unauthorized attempts and actions to access or use this system may
  894. result in civil and/or criminal penalties.
  895. All activities performed on this system are logged and monitored.
  896. Setting dynamic ``motd``:
  897. .. code-block:: yaml
  898. linux:
  899. system:
  900. motd:
  901. - release: |
  902. #!/bin/sh
  903. [ -r /etc/lsb-release ] && . /etc/lsb-release
  904. if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
  905. # Fall back to using the very slow lsb_release utility
  906. DISTRIB_DESCRIPTION=$(lsb_release -s -d)
  907. fi
  908. printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
  909. - warning: |
  910. #!/bin/sh
  911. printf "This is [company name] network.\n"
  912. printf "Unauthorized access strictly prohibited.\n"
  913. Services
  914. ~~~~~~~~
  915. Stop and disable the ``linux`` service:
  916. .. code-block:: yaml
  917. linux:
  918. system:
  919. service:
  920. apt-daily.timer:
  921. status: dead
  922. Possible statuses are ``dead`` (disable service by default), ``running``
  923. (enable service by default), ``enabled``, ``disabled``:
  924. Linux with the ``atop`` service:
  925. .. code-block:: yaml
  926. linux:
  927. system:
  928. atop:
  929. enabled: true
  930. interval: 20
  931. logpath: "/var/log/atop"
  932. outfile: "/var/log/atop/daily.log"
  933. Linux with the ``mcelog`` service:
  934. .. code-block:: yaml
  935. linux:
  936. system:
  937. mcelog:
  938. enabled: true
  939. logging:
  940. syslog: true
  941. syslog_error: true
  942. RHEL / CentOS
  943. ^^^^^^^^^^^^^
  944. Currently, ``update-motd`` is not available
  945. for RHEL. So there is no native support for dynamic ``motd``.
  946. You can still set a static one, with a different pillar structure:
  947. .. code-block:: yaml
  948. linux:
  949. system:
  950. motd: |
  951. This is [company name] network.
  952. Unauthorized access strictly prohibited.
  953. Haveged
  954. ~~~~~~~
  955. If you are running headless server and are low on entropy,
  956. you may set up Haveged:
  957. .. code-block:: yaml
  958. linux:
  959. system:
  960. haveged:
  961. enabled: true
  962. Linux network
  963. -------------
  964. Linux with network manager:
  965. .. code-block:: yaml
  966. linux:
  967. network:
  968. enabled: true
  969. network_manager: true
  970. Linux with default static network interfaces, default gateway
  971. interface and DNS servers:
  972. .. code-block:: yaml
  973. linux:
  974. network:
  975. enabled: true
  976. interface:
  977. eth0:
  978. enabled: true
  979. type: eth
  980. address: 192.168.0.102
  981. netmask: 255.255.255.0
  982. gateway: 192.168.0.1
  983. name_servers:
  984. - 8.8.8.8
  985. - 8.8.4.4
  986. mtu: 1500
  987. Linux with bonded interfaces and disabled ``NetworkManager``:
  988. .. code-block:: yaml
  989. linux:
  990. network:
  991. enabled: true
  992. interface:
  993. eth0:
  994. type: eth
  995. ...
  996. eth1:
  997. type: eth
  998. ...
  999. bond0:
  1000. enabled: true
  1001. type: bond
  1002. address: 192.168.0.102
  1003. netmask: 255.255.255.0
  1004. mtu: 1500
  1005. use_in:
  1006. - interface: ${linux:interface:eth0}
  1007. - interface: ${linux:interface:eth0}
  1008. network_manager:
  1009. disable: true
  1010. Linux with VLAN ``interface_params``:
  1011. .. code-block:: yaml
  1012. linux:
  1013. network:
  1014. enabled: true
  1015. interface:
  1016. vlan69:
  1017. type: vlan
  1018. use_interfaces:
  1019. - interface: ${linux:interface:bond0}
  1020. Linux with wireless interface parameters:
  1021. .. code-block:: yaml
  1022. linux:
  1023. network:
  1024. enabled: true
  1025. gateway: 10.0.0.1
  1026. default_interface: eth0
  1027. interface:
  1028. wlan0:
  1029. type: eth
  1030. wireless:
  1031. essid: example
  1032. key: example_key
  1033. security: wpa
  1034. priority: 1
  1035. Linux networks with routes defined:
  1036. .. code-block:: yaml
  1037. linux:
  1038. network:
  1039. enabled: true
  1040. gateway: 10.0.0.1
  1041. default_interface: eth0
  1042. interface:
  1043. eth0:
  1044. type: eth
  1045. route:
  1046. default:
  1047. address: 192.168.0.123
  1048. netmask: 255.255.255.0
  1049. gateway: 192.168.0.1
  1050. Native Linux Bridges:
  1051. .. code-block:: yaml
  1052. linux:
  1053. network:
  1054. interface:
  1055. eth1:
  1056. enabled: true
  1057. type: eth
  1058. proto: manual
  1059. up_cmds:
  1060. - ip address add 0/0 dev $IFACE
  1061. - ip link set $IFACE up
  1062. down_cmds:
  1063. - ip link set $IFACE down
  1064. br-ex:
  1065. enabled: true
  1066. type: bridge
  1067. address: ${linux:network:host:public_local:address}
  1068. netmask: 255.255.255.0
  1069. use_interfaces:
  1070. - eth1
  1071. Open vSwitch Bridges:
  1072. .. code-block:: yaml
  1073. linux:
  1074. network:
  1075. bridge: openvswitch
  1076. interface:
  1077. eth1:
  1078. enabled: true
  1079. type: eth
  1080. proto: manual
  1081. up_cmds:
  1082. - ip address add 0/0 dev $IFACE
  1083. - ip link set $IFACE up
  1084. down_cmds:
  1085. - ip link set $IFACE down
  1086. br-ex:
  1087. enabled: true
  1088. type: bridge
  1089. address: ${linux:network:host:public_local:address}
  1090. netmask: 255.255.255.0
  1091. use_interfaces:
  1092. - eth1
  1093. br-prv:
  1094. enabled: true
  1095. type: ovs_bridge
  1096. mtu: 65000
  1097. br-ens7:
  1098. enabled: true
  1099. name: br-ens7
  1100. type: ovs_bridge
  1101. proto: manual
  1102. mtu: 9000
  1103. use_interfaces:
  1104. - ens7
  1105. patch-br-ens7-br-prv:
  1106. enabled: true
  1107. name: ens7-prv
  1108. ovs_type: ovs_port
  1109. type: ovs_port
  1110. bridge: br-ens7
  1111. port_type: patch
  1112. peer: prv-ens7
  1113. tag: 109 # [] to unset a tag
  1114. mtu: 65000
  1115. patch-br-prv-br-ens7:
  1116. enabled: true
  1117. name: prv-ens7
  1118. bridge: br-prv
  1119. ovs_type: ovs_port
  1120. type: ovs_port
  1121. port_type: patch
  1122. peer: ens7-prv
  1123. tag: 109
  1124. mtu: 65000
  1125. ens7:
  1126. enabled: true
  1127. name: ens7
  1128. proto: manual
  1129. ovs_port_type: OVSPort
  1130. type: ovs_port
  1131. ovs_bridge: br-ens7
  1132. bridge: br-ens7
  1133. Debian manual proto interfaces
  1134. When you are changing interface proto from static in up state
  1135. to manual, you may need to flush ip addresses. For example,
  1136. if you want to use the interface and the ip on the bridge.
  1137. This can be done by setting the ``ipflush_onchange`` to true.
  1138. .. code-block:: yaml
  1139. linux:
  1140. network:
  1141. interface:
  1142. eth1:
  1143. enabled: true
  1144. type: eth
  1145. proto: manual
  1146. mtu: 9100
  1147. ipflush_onchange: true
  1148. Debian static proto interfaces
  1149. When you are changing interface proto from dhcp in up state to
  1150. static, you may need to flush ip addresses and restart interface
  1151. to assign ip address from a managed file. For example, if you wantto
  1152. use the interface and the ip on the bridge. This can be done by
  1153. setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
  1154. param set to true.
  1155. .. code-block:: yaml
  1156. linux:
  1157. network:
  1158. interface:
  1159. eth1:
  1160. enabled: true
  1161. type: eth
  1162. proto: static
  1163. address: 10.1.0.22
  1164. netmask: 255.255.255.0
  1165. ipflush_onchange: true
  1166. restart_on_ipflush: true
  1167. Concatinating and removing interface files
  1168. Debian based distributions have ``/etc/network/interfaces.d/``
  1169. directory, where you can store configuration of network
  1170. interfaces in separate files. You can concatinate the files
  1171. to the defined destination when needed, this operation removes
  1172. the file from the ``/etc/network/interfaces.d/``. If you just need
  1173. to remove iface files, you can use the ``remove_iface_files`` key.
  1174. .. code-block:: yaml
  1175. linux:
  1176. network:
  1177. concat_iface_files:
  1178. - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
  1179. dst: '/etc/network/interfaces'
  1180. remove_iface_files:
  1181. - '/etc/network/interfaces.d/90-custom.cfg'
  1182. Configure DHCP client
  1183. None of the keys is mandatory, include only those you really need.
  1184. For full list of available options under send, supersede, prepend,
  1185. append refer to dhcp-options(5).
  1186. .. code-block:: yaml
  1187. linux:
  1188. network:
  1189. dhclient:
  1190. enabled: true
  1191. backoff_cutoff: 15
  1192. initial_interval: 10
  1193. reboot: 10
  1194. retry: 60
  1195. select_timeout: 0
  1196. timeout: 120
  1197. send:
  1198. - option: host-name
  1199. declaration: "= gethostname()"
  1200. supersede:
  1201. - option: host-name
  1202. declaration: "spaceship"
  1203. - option: domain-name
  1204. declaration: "domain.home"
  1205. #- option: arp-cache-timeout
  1206. # declaration: 20
  1207. prepend:
  1208. - option: domain-name-servers
  1209. declaration:
  1210. - 8.8.8.8
  1211. - 8.8.4.4
  1212. - option: domain-search
  1213. declaration:
  1214. - example.com
  1215. - eng.example.com
  1216. #append:
  1217. #- option: domain-name-servers
  1218. # declaration: 127.0.0.1
  1219. # ip or subnet to reject dhcp offer from
  1220. reject:
  1221. - 192.33.137.209
  1222. - 10.0.2.0/24
  1223. request:
  1224. - subnet-mask
  1225. - broadcast-address
  1226. - time-offset
  1227. - routers
  1228. - domain-name
  1229. - domain-name-servers
  1230. - domain-search
  1231. - host-name
  1232. - dhcp6.name-servers
  1233. - dhcp6.domain-search
  1234. - dhcp6.fqdn
  1235. - dhcp6.sntp-servers
  1236. - netbios-name-servers
  1237. - netbios-scope
  1238. - interface-mtu
  1239. - rfc3442-classless-static-routes
  1240. - ntp-servers
  1241. require:
  1242. - subnet-mask
  1243. - domain-name-servers
  1244. # if per interface configuration required add below
  1245. interface:
  1246. ens2:
  1247. initial_interval: 11
  1248. reject:
  1249. - 192.33.137.210
  1250. ens3:
  1251. initial_interval: 12
  1252. reject:
  1253. - 192.33.137.211
  1254. Linux network systemd settings:
  1255. .. code-block:: yaml
  1256. linux:
  1257. network:
  1258. ...
  1259. systemd:
  1260. link:
  1261. 10-iface-dmz:
  1262. Match:
  1263. MACAddress: c8:5b:67:fa:1a:af
  1264. OriginalName: eth0
  1265. Link:
  1266. Name: dmz0
  1267. netdev:
  1268. 20-bridge-dmz:
  1269. match:
  1270. name: dmz0
  1271. network:
  1272. mescription: bridge
  1273. bridge: br-dmz0
  1274. network:
  1275. # works with lowercase, keys are by default capitalized
  1276. 40-dhcp:
  1277. match:
  1278. name: '*'
  1279. network:
  1280. DHCP: yes
  1281. Configure global environment variables
  1282. Use ``/etc/environment`` for static system wide variable assignment
  1283. after boot. Variable expansion is frequently not supported.
  1284. .. code-block:: yaml
  1285. linux:
  1286. system:
  1287. env:
  1288. BOB_VARIABLE: Alice
  1289. ...
  1290. BOB_PATH:
  1291. - /srv/alice/bin
  1292. - /srv/bob/bin
  1293. ...
  1294. ftp_proxy: none
  1295. http_proxy: http://global-http-proxy.host.local:8080
  1296. https_proxy: ${linux:system:proxy:https}
  1297. no_proxy:
  1298. - 192.168.0.80
  1299. - 192.168.1.80
  1300. - .domain.com
  1301. - .local
  1302. ...
  1303. # NOTE: global defaults proxy configuration.
  1304. proxy:
  1305. ftp: ftp://proxy.host.local:2121
  1306. http: http://proxy.host.local:3142
  1307. https: https://proxy.host.local:3143
  1308. noproxy:
  1309. - .domain.com
  1310. - .local
  1311. Configure the ``profile.d`` scripts
  1312. The ``profile.d`` scripts are being sourced during ``.sh`` execution
  1313. and support variable expansion in opposite to /etc/environment global
  1314. settings in ``/etc/environment``.
  1315. .. code-block:: yaml
  1316. linux:
  1317. system:
  1318. profile:
  1319. locales: |
  1320. export LANG=C
  1321. export LC_ALL=C
  1322. ...
  1323. vi_flavors.sh: |
  1324. export PAGER=view
  1325. export EDITOR=vim
  1326. alias vi=vim
  1327. shell_locales.sh: |
  1328. export LANG=en_US
  1329. export LC_ALL=en_US.UTF-8
  1330. shell_proxies.sh: |
  1331. export FTP_PROXY=ftp://127.0.3.3:2121
  1332. export NO_PROXY='.local'
  1333. Configure login.defs parameters
  1334. -------------------------------
  1335. .. code-block:: yaml
  1336. linux:
  1337. system:
  1338. login_defs:
  1339. <opt_name>:
  1340. enabled: true
  1341. value: <opt_value>
  1342. <opt_name> is a configurational option defined in 'man login.defs'.
  1343. <opt_name> is case sensitive, should be UPPERCASE only!
  1344. Linux with hosts
  1345. Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
  1346. removing entries that are not defined in model except defaults
  1347. for both IPv4 and IPv6 localhost and hostname as well as FQDN.
  1348. We recommend using this option to verify that ``/etc/hosts``
  1349. is always in a clean state. However it is not enabled by default
  1350. for security reasons.
  1351. .. code-block:: yaml
  1352. linux:
  1353. network:
  1354. purge_hosts: true
  1355. host:
  1356. # No need to define this one if purge_hosts is true
  1357. hostname:
  1358. address: 127.0.1.1
  1359. names:
  1360. - ${linux:network:fqdn}
  1361. - ${linux:network:hostname}
  1362. node1:
  1363. address: 192.168.10.200
  1364. names:
  1365. - node2.domain.com
  1366. - service2.domain.com
  1367. node2:
  1368. address: 192.168.10.201
  1369. names:
  1370. - node2.domain.com
  1371. - service2.domain.com
  1372. Linux with hosts collected from mine
  1373. All DNS records defined within infrastrucuture
  1374. are passed to the local hosts records or any DNS server. Only
  1375. hosts with the ``grain`` parameter set to ``true`` will be propagated
  1376. to the mine.
  1377. .. code-block:: yaml
  1378. linux:
  1379. network:
  1380. purge_hosts: true
  1381. mine_dns_records: true
  1382. host:
  1383. node1:
  1384. address: 192.168.10.200
  1385. grain: true
  1386. names:
  1387. - node2.domain.com
  1388. - service2.domain.com
  1389. Set up ``resolv.conf``, nameservers, domain and search domains:
  1390. .. code-block:: yaml
  1391. linux:
  1392. network:
  1393. resolv:
  1394. dns:
  1395. - 8.8.4.4
  1396. - 8.8.8.8
  1397. domain: my.example.com
  1398. search:
  1399. - my.example.com
  1400. - example.com
  1401. options:
  1402. - ndots: 5
  1403. - timeout: 2
  1404. - attempts: 2
  1405. Set up custom TX queue length for tap interfaces:
  1406. .. code-block:: yaml
  1407. linux:
  1408. network:
  1409. tap_custom_txqueuelen: 10000
  1410. DPDK OVS interfaces
  1411. **DPDK OVS NIC**
  1412. .. code-block:: yaml
  1413. linux:
  1414. network:
  1415. bridge: openvswitch
  1416. dpdk:
  1417. enabled: true
  1418. driver: uio/vfio
  1419. openvswitch:
  1420. pmd_cpu_mask: "0x6"
  1421. dpdk_socket_mem: "1024,1024"
  1422. dpdk_lcore_mask: "0x400"
  1423. memory_channels: 2
  1424. interface:
  1425. dpkd0:
  1426. name: ${_param:dpdk_nic}
  1427. pci: 0000:06:00.0
  1428. driver: igb_uio/vfio-pci
  1429. enabled: true
  1430. type: dpdk_ovs_port
  1431. n_rxq: 2
  1432. pmd_rxq_affinity: "0:1,1:2"
  1433. bridge: br-prv
  1434. mtu: 9000
  1435. br-prv:
  1436. enabled: true
  1437. type: dpdk_ovs_bridge
  1438. **DPDK OVS Bond**
  1439. .. code-block:: yaml
  1440. linux:
  1441. network:
  1442. bridge: openvswitch
  1443. dpdk:
  1444. enabled: true
  1445. driver: uio/vfio
  1446. openvswitch:
  1447. pmd_cpu_mask: "0x6"
  1448. dpdk_socket_mem: "1024,1024"
  1449. dpdk_lcore_mask: "0x400"
  1450. memory_channels: 2
  1451. interface:
  1452. dpdk_second_nic:
  1453. name: ${_param:primary_second_nic}
  1454. pci: 0000:06:00.0
  1455. driver: igb_uio/vfio-pci
  1456. bond: dpdkbond0
  1457. enabled: true
  1458. type: dpdk_ovs_port
  1459. n_rxq: 2
  1460. pmd_rxq_affinity: "0:1,1:2"
  1461. mtu: 9000
  1462. dpdk_first_nic:
  1463. name: ${_param:primary_first_nic}
  1464. pci: 0000:05:00.0
  1465. driver: igb_uio/vfio-pci
  1466. bond: dpdkbond0
  1467. enabled: true
  1468. type: dpdk_ovs_port
  1469. n_rxq: 2
  1470. pmd_rxq_affinity: "0:1,1:2"
  1471. mtu: 9000
  1472. dpdkbond0:
  1473. enabled: true
  1474. bridge: br-prv
  1475. type: dpdk_ovs_bond
  1476. mode: active-backup
  1477. br-prv:
  1478. enabled: true
  1479. type: dpdk_ovs_bridge
  1480. **DPDK OVS LACP Bond with vlan tag**
  1481. .. code-block:: yaml
  1482. linux:
  1483. network:
  1484. bridge: openvswitch
  1485. dpdk:
  1486. enabled: true
  1487. driver: uio
  1488. openvswitch:
  1489. pmd_cpu_mask: "0x6"
  1490. dpdk_socket_mem: "1024,1024"
  1491. dpdk_lcore_mask: "0x400"
  1492. memory_channels: "2"
  1493. interface:
  1494. eth3:
  1495. enabled: true
  1496. type: eth
  1497. proto: manual
  1498. name: ${_param:tenant_first_nic}
  1499. eth4:
  1500. enabled: true
  1501. type: eth
  1502. proto: manual
  1503. name: ${_param:tenant_second_nic}
  1504. dpdk0:
  1505. name: ${_param:tenant_first_nic}
  1506. pci: "0000:81:00.0"
  1507. driver: igb_uio
  1508. bond: bond1
  1509. enabled: true
  1510. type: dpdk_ovs_port
  1511. n_rxq: 2
  1512. dpdk1:
  1513. name: ${_param:tenant_second_nic}
  1514. pci: "0000:81:00.1"
  1515. driver: igb_uio
  1516. bond: bond1
  1517. enabled: true
  1518. type: dpdk_ovs_port
  1519. n_rxq: 2
  1520. bond1:
  1521. enabled: true
  1522. bridge: br-prv
  1523. type: dpdk_ovs_bond
  1524. mode: balance-slb
  1525. br-prv:
  1526. enabled: true
  1527. type: dpdk_ovs_bridge
  1528. tag: ${_param:tenant_vlan}
  1529. address: ${_param:tenant_address}
  1530. netmask: ${_param:tenant_network_netmask}
  1531. **DPDK OVS bridge for VXLAN**
  1532. If VXLAN is used as tenant segmentation, IP address must
  1533. be set on ``br-prv``.
  1534. .. code-block:: yaml
  1535. linux:
  1536. network:
  1537. ...
  1538. interface:
  1539. br-prv:
  1540. enabled: true
  1541. type: dpdk_ovs_bridge
  1542. address: 192.168.50.0
  1543. netmask: 255.255.255.0
  1544. tag: 101
  1545. mtu: 9000
  1546. **DPDK OVS bridge with Linux network interface**
  1547. .. code-block:: yaml
  1548. linux:
  1549. network:
  1550. ...
  1551. interface:
  1552. eth0:
  1553. type: eth
  1554. ovs_bridge: br-prv
  1555. ...
  1556. br-prv:
  1557. enabled: true
  1558. type: dpdk_ovs_bridge
  1559. ...
  1560. Linux storage
  1561. -------------
  1562. Linux with mounted Samba:
  1563. .. code-block:: yaml
  1564. linux:
  1565. storage:
  1566. enabled: true
  1567. mount:
  1568. samba1:
  1569. - enabled: true
  1570. - path: /media/myuser/public/
  1571. - device: //192.168.0.1/storage
  1572. - file_system: cifs
  1573. - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
  1574. NFS mount:
  1575. .. code-block:: yaml
  1576. linux:
  1577. storage:
  1578. enabled: true
  1579. mount:
  1580. nfs_glance:
  1581. enabled: true
  1582. path: /var/lib/glance/images
  1583. device: 172.16.10.110:/var/nfs/glance
  1584. file_system: nfs
  1585. opts: rw,sync
  1586. File swap configuration:
  1587. .. code-block:: yaml
  1588. linux:
  1589. storage:
  1590. enabled: true
  1591. swap:
  1592. file:
  1593. enabled: true
  1594. engine: file
  1595. device: /swapfile
  1596. size: 1024
  1597. Partition swap configuration:
  1598. .. code-block:: yaml
  1599. linux:
  1600. storage:
  1601. enabled: true
  1602. swap:
  1603. partition:
  1604. enabled: true
  1605. engine: partition
  1606. device: /dev/vg0/swap
  1607. LVM group ``vg1`` with one device and ``data`` volume mounted
  1608. into ``/mnt/data``.
  1609. .. code-block:: yaml
  1610. parameters:
  1611. linux:
  1612. storage:
  1613. mount:
  1614. data:
  1615. enabled: true
  1616. device: /dev/vg1/data
  1617. file_system: ext4
  1618. path: /mnt/data
  1619. lvm:
  1620. vg1:
  1621. enabled: true
  1622. devices:
  1623. - /dev/sdb
  1624. volume:
  1625. data:
  1626. size: 40G
  1627. mount: ${linux:storage:mount:data}
  1628. Create partitions on disk. Specify size in MB. It expects empty
  1629. disk without any existing partitions.
  1630. Set ``startsector=1`` if you want to start partitions from ``2048``.
  1631. .. code-block:: yaml
  1632. linux:
  1633. storage:
  1634. disk:
  1635. first_drive:
  1636. startsector: 1
  1637. name: /dev/loop1
  1638. type: gpt
  1639. partitions:
  1640. - size: 200 #size in MB
  1641. type: fat32
  1642. - size: 300 #size in MB
  1643. mkfs: True
  1644. type: xfs
  1645. /dev/vda1:
  1646. partitions:
  1647. - size: 5
  1648. type: ext2
  1649. - size: 10
  1650. type: ext4
  1651. Multipath with Fujitsu Eternus DXL:
  1652. .. code-block:: yaml
  1653. parameters:
  1654. linux:
  1655. storage:
  1656. multipath:
  1657. enabled: true
  1658. blacklist_devices:
  1659. - /dev/sda
  1660. - /dev/sdb
  1661. backends:
  1662. - fujitsu_eternus_dxl
  1663. Multipath with Hitachi VSP 1000:
  1664. .. code-block:: yaml
  1665. parameters:
  1666. linux:
  1667. storage:
  1668. multipath:
  1669. enabled: true
  1670. blacklist_devices:
  1671. - /dev/sda
  1672. - /dev/sdb
  1673. backends:
  1674. - hitachi_vsp1000
  1675. Multipath with IBM Storwize:
  1676. .. code-block:: yaml
  1677. parameters:
  1678. linux:
  1679. storage:
  1680. multipath:
  1681. enabled: true
  1682. blacklist_devices:
  1683. - /dev/sda
  1684. - /dev/sdb
  1685. backends:
  1686. - ibm_storwize
  1687. Multipath with multiple backends:
  1688. .. code-block:: yaml
  1689. parameters:
  1690. linux:
  1691. storage:
  1692. multipath:
  1693. enabled: true
  1694. blacklist_devices:
  1695. - /dev/sda
  1696. - /dev/sdb
  1697. - /dev/sdc
  1698. - /dev/sdd
  1699. backends:
  1700. - ibm_storwize
  1701. - fujitsu_eternus_dxl
  1702. - hitachi_vsp1000
  1703. PAM LDAP integration:
  1704. .. code-block:: yaml
  1705. parameters:
  1706. linux:
  1707. system:
  1708. auth:
  1709. enabled: true
  1710. mkhomedir:
  1711. enabled: true
  1712. umask: 0027
  1713. ldap:
  1714. enabled: true
  1715. binddn: cn=bind,ou=service_users,dc=example,dc=com
  1716. bindpw: secret
  1717. uri: ldap://127.0.0.1
  1718. base: ou=users,dc=example,dc=com
  1719. ldap_version: 3
  1720. pagesize: 65536
  1721. referrals: off
  1722. filter:
  1723. passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
  1724. shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
  1725. group: (&(objectClass=group)(gidNumber=*))
  1726. Disabled multipath (the default setup):
  1727. .. code-block:: yaml
  1728. parameters:
  1729. linux:
  1730. storage:
  1731. multipath:
  1732. enabled: false
  1733. Linux with local loopback device:
  1734. .. code-block:: yaml
  1735. linux:
  1736. storage:
  1737. loopback:
  1738. disk1:
  1739. file: /srv/disk1
  1740. size: 50G
  1741. External config generation
  1742. --------------------------
  1743. You are able to use config support metadata between formulas
  1744. and only generate configuration files for external use, for example, Docker, and so on.
  1745. .. code-block:: yaml
  1746. parameters:
  1747. linux:
  1748. system:
  1749. config:
  1750. pillar:
  1751. jenkins:
  1752. master:
  1753. home: /srv/volumes/jenkins
  1754. approved_scripts:
  1755. - method java.net.URL openConnection
  1756. credentials:
  1757. - type: username_password
  1758. scope: global
  1759. id: test
  1760. desc: Testing credentials
  1761. username: test
  1762. password: test
  1763. Netconsole Remote Kernel Logging
  1764. --------------------------------
  1765. Netconsole logger can be configured for the configfs-enabled kernels
  1766. (``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
  1767. applies both in runtime (if network is already configured),
  1768. and on-boot after an interface initialization.
  1769. .. note::
  1770. * Receiver can be located only on the same L3 domain
  1771. (or you need to configure gateway MAC manually).
  1772. * The Receiver MAC is detected only on configuration time.
  1773. * Using broadcast MAC is not recommended.
  1774. .. code-block:: yaml
  1775. parameters:
  1776. linux:
  1777. system:
  1778. netconsole:
  1779. enabled: true
  1780. port: 514 (optional)
  1781. loglevel: debug (optional)
  1782. target:
  1783. 192.168.0.1:
  1784. interface: bond0
  1785. mac: "ff:ff:ff:ff:ff:ff" (optional)
  1786. Usage
  1787. =====
  1788. Set MTU of the eth0 network interface to 1400:
  1789. .. code-block:: bash
  1790. ip link set dev eth0 mtu 1400
  1791. Read more
  1792. =========
  1793. * https://www.archlinux.org/
  1794. * http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
  1795. Documentation and Bugs
  1796. ======================
  1797. * http://salt-formulas.readthedocs.io/
  1798. Learn how to install and update salt-formulas.
  1799. * https://github.com/salt-formulas/salt-formula-linux/issues
  1800. In the unfortunate event that bugs are discovered, report the issue to the
  1801. appropriate issue tracker. Use the Github issue tracker for a specific salt
  1802. formula.
  1803. * https://launchpad.net/salt-formulas
  1804. For feature requests, bug reports, or blueprints affecting the entire
  1805. ecosystem, use the Launchpad salt-formulas project.
  1806. * https://launchpad.net/~salt-formulas-users
  1807. Join the salt-formulas-users team and subscribe to mailing list if required.
  1808. * https://github.com/salt-formulas/salt-formula-linux
  1809. Develop the salt-formulas projects in the master branch and then submit pull
  1810. requests against a specific formula.
  1811. * #salt-formulas @ irc.freenode.net
  1812. Use this IRC channel in case of any questions or feedback which is always
  1813. welcome.