Saltstack Official Linux Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.rst 63KB

2 years ago
9 years ago
9 years ago
9 years ago
9 years ago
2 years ago
9 years ago
9 years ago
9 years ago
9 years ago
2 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
8 years ago
2 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678
  1. ============
  2. Linux Formula
  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 predefined 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. unique: false
  43. jsmith:
  44. name: 'jsmith'
  45. enabled: true
  46. full_name: 'With clear password'
  47. home: '/home/jsmith'
  48. hash_password: true
  49. password: "userpassword"
  50. mark:
  51. name: 'mark'
  52. enabled: true
  53. full_name: "unchange password'
  54. home: '/home/mark'
  55. password: false
  56. elizabeth:
  57. name: 'elizabeth'
  58. enabled: true
  59. full_name: 'With hashed password'
  60. home: '/home/elizabeth'
  61. password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10"
  62. Configure password expiration parameters
  63. ----------------------------------------
  64. The following login.defs parameters can be overridden per-user:
  65. * PASS_MAX_DAYS
  66. * PASS_MIN_DAYS
  67. * PASS_WARN_DAYS
  68. * INACTIVE
  69. .. code-block:: yaml
  70. linux:
  71. system:
  72. ...
  73. user:
  74. jdoe:
  75. name: 'jdoe'
  76. enabled: true
  77. ...
  78. maxdays: <PASS_MAX_DAYS>
  79. mindays: <PASS_MIN_DAYS>
  80. warndays: <PASS_WARN_DAYS>
  81. inactdays: <INACTIVE>
  82. Configure sudo for users and groups under ``/etc/sudoers.d/``.
  83. This ways ``linux.system.sudo`` pillar map to actual sudo attributes:
  84. .. code-block:: jinja
  85. # simplified template:
  86. Cmds_Alias {{ alias }}={{ commands }}
  87. {{ user }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
  88. %{{ group }} {{ hosts }}=({{ runas }}) NOPASSWD: {{ commands }}
  89. # when rendered:
  90. saltuser1 ALL=(ALL) NOPASSWD: ALL
  91. .. code-block:: yaml
  92. linux:
  93. system:
  94. sudo:
  95. enabled: true
  96. aliases:
  97. host:
  98. LOCAL:
  99. - localhost
  100. PRODUCTION:
  101. - db1
  102. - db2
  103. runas:
  104. DBA:
  105. - postgres
  106. - mysql
  107. SALT:
  108. - root
  109. command:
  110. # Note: This is not 100% safe when ALL keyword is used, user still may modify configs and hide his actions.
  111. # Best practice is to specify full list of commands user is allowed to run.
  112. SUPPORT_RESTRICTED:
  113. - /bin/vi /etc/sudoers*
  114. - /bin/vim /etc/sudoers*
  115. - /bin/nano /etc/sudoers*
  116. - /bin/emacs /etc/sudoers*
  117. - /bin/su - root
  118. - /bin/su -
  119. - /bin/su
  120. - /usr/sbin/visudo
  121. SUPPORT_SHELLS:
  122. - /bin/sh
  123. - /bin/ksh
  124. - /bin/bash
  125. - /bin/rbash
  126. - /bin/dash
  127. - /bin/zsh
  128. - /bin/csh
  129. - /bin/fish
  130. - /bin/tcsh
  131. - /usr/bin/login
  132. - /usr/bin/su
  133. - /usr/su
  134. ALL_SALT_SAFE:
  135. - /usr/bin/salt state*
  136. - /usr/bin/salt service*
  137. - /usr/bin/salt pillar*
  138. - /usr/bin/salt grains*
  139. - /usr/bin/salt saltutil*
  140. - /usr/bin/salt-call state*
  141. - /usr/bin/salt-call service*
  142. - /usr/bin/salt-call pillar*
  143. - /usr/bin/salt-call grains*
  144. - /usr/bin/salt-call saltutil*
  145. SALT_TRUSTED:
  146. - /usr/bin/salt*
  147. users:
  148. # saltuser1 with default values: saltuser1 ALL=(ALL) NOPASSWD: ALL
  149. saltuser1: {}
  150. saltuser2:
  151. hosts:
  152. - LOCAL
  153. # User Alias DBA
  154. DBA:
  155. hosts:
  156. - ALL
  157. commands:
  158. - ALL_SALT_SAFE
  159. groups:
  160. db-ops:
  161. hosts:
  162. - ALL
  163. - '!PRODUCTION'
  164. runas:
  165. - DBA
  166. commands:
  167. - /bin/cat *
  168. - /bin/less *
  169. - /bin/ls *
  170. salt-ops:
  171. hosts:
  172. - 'ALL'
  173. runas:
  174. - SALT
  175. commands:
  176. - SUPPORT_SHELLS
  177. salt-ops-2nd:
  178. name: salt-ops
  179. nopasswd: false
  180. setenv: true # Enable sudo -E option
  181. runas:
  182. - DBA
  183. commands:
  184. - ALL
  185. - '!SUPPORT_SHELLS'
  186. - '!SUPPORT_RESTRICTED'
  187. Linux with package, latest version:
  188. .. code-block:: yaml
  189. linux:
  190. system:
  191. ...
  192. package:
  193. package-name:
  194. version: latest
  195. Linux with package from certail repo, version with no upgrades:
  196. .. code-block:: yaml
  197. linux:
  198. system:
  199. ...
  200. package:
  201. package-name:
  202. version: 2132.323
  203. repo: 'custom-repo'
  204. hold: true
  205. Linux with package from certail repo, version with no GPG
  206. verification:
  207. .. code-block:: yaml
  208. linux:
  209. system:
  210. ...
  211. package:
  212. package-name:
  213. version: 2132.323
  214. repo: 'custom-repo'
  215. verify: false
  216. Linux with autoupdates (automatically install security package
  217. updates):
  218. .. code-block:: yaml
  219. linux:
  220. system:
  221. ...
  222. autoupdates:
  223. enabled: true
  224. mail: root@localhost
  225. mail_only_on_error: true
  226. remove_unused_dependencies: false
  227. automatic_reboot: true
  228. automatic_reboot_time: "02:00"
  229. Managing cron tasks
  230. -------------------
  231. There are two data structures that are related to managing cron itself and
  232. cron tasks:
  233. .. code-block:: yaml
  234. linux:
  235. system:
  236. cron:
  237. and
  238. .. code-block:: yaml
  239. linux:
  240. system:
  241. job:
  242. `linux:system:cron` manages cron packages, services, and '/etc/cron.allow' file.
  243. 'deny' files are managed the only way - we're ensuring they are absent, that's
  244. a requirement from CIS 5.1.8
  245. 'cron' pillar structure is the following:
  246. .. code-block:: yaml
  247. linux:
  248. system:
  249. cron:
  250. enabled: true
  251. pkgs: [ <cron packages> ]
  252. services: [ <cron services> ]
  253. user:
  254. <username>:
  255. enabled: true
  256. To add user to '/etc/cron.allow' use 'enabled' key as shown above.
  257. '/etc/cron.deny' is not managed as CIS 5.1.8 requires it was removed.
  258. A user would be ignored if any of the following is true:
  259. * user is disabled in `linux:system:user:<username>`
  260. * user is disabled in `linux:system:cron:user:<username>`
  261. `linux:system:job` manages individual cron tasks.
  262. By default, it will use name as an identifier, unless identifier key is
  263. explicitly set or False (then it will use Salt's default behavior which is
  264. identifier same as command resulting in not being able to change it):
  265. .. code-block:: yaml
  266. linux:
  267. system:
  268. ...
  269. job:
  270. cmd1:
  271. command: '/cmd/to/run'
  272. identifier: cmd1
  273. enabled: true
  274. user: 'root'
  275. hour: 2
  276. minute: 0
  277. Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.
  278. .. code-block:: yaml
  279. linux:
  280. system:
  281. ...
  282. job:
  283. cmd1:
  284. command: '/cmd/to/run'
  285. identifier: cmd1
  286. enabled: true
  287. user: 'root'
  288. special: '@reboot'
  289. Managing 'at' tasks
  290. -------------------
  291. Pillar for managing `at` tasks is similar to one for `cron` tasks:
  292. .. code-block:: yaml
  293. linux:
  294. system:
  295. at:
  296. enabled: true
  297. pkgs: [ <at packages> ]
  298. services: [ <at services> ]
  299. user:
  300. <username>:
  301. enabled: true
  302. To add a user to '/etc/at.allow' use 'enabled' key as shown above.
  303. '/etc/at.deny' is not managed as CIS 5.1.8 requires it was removed.
  304. A user will be ignored if any of the following is true:
  305. * user is disabled in `linux:system:user:<username>`
  306. * user is disabled in `linux:system:at:user:<username>`
  307. Linux security limits (limit sensu user memory usage to max 1GB):
  308. .. code-block:: yaml
  309. linux:
  310. system:
  311. ...
  312. limit:
  313. sensu:
  314. enabled: true
  315. domain: sensu
  316. limits:
  317. - type: hard
  318. item: as
  319. value: 1000000
  320. Enable autologin on ``tty1`` (may work only for Ubuntu 14.04):
  321. .. code-block:: yaml
  322. linux:
  323. system:
  324. console:
  325. tty1:
  326. autologin: root
  327. # Enable serial console
  328. ttyS0:
  329. autologin: root
  330. rate: 115200
  331. term: xterm
  332. To disable set autologin to ``false``.
  333. Set ``policy-rc.d`` on Debian-based systems. Action can be any available
  334. command in ``while true`` loop and ``case`` context.
  335. Following will disallow dpkg to stop/start services for the Cassandra
  336. package automatically:
  337. .. code-block:: yaml
  338. linux:
  339. system:
  340. policyrcd:
  341. - package: cassandra
  342. action: exit 101
  343. - package: '*'
  344. action: switch
  345. Set system locales:
  346. .. code-block:: yaml
  347. linux:
  348. system:
  349. locale:
  350. en_US.UTF-8:
  351. default: true
  352. "cs_CZ.UTF-8 UTF-8":
  353. enabled: true
  354. Systemd settings:
  355. .. code-block:: yaml
  356. linux:
  357. system:
  358. ...
  359. systemd:
  360. system:
  361. Manager:
  362. DefaultLimitNOFILE: 307200
  363. DefaultLimitNPROC: 307200
  364. user:
  365. Manager:
  366. DefaultLimitCPU: 2
  367. DefaultLimitNPROC: 4
  368. Systemd journal settings:
  369. .. code-block:: yaml
  370. linux:
  371. system:
  372. ...
  373. systemd:
  374. journal:
  375. SystemMaxUse: "50M"
  376. RuntimeMaxFiles: "100"
  377. Ensure presence of directory:
  378. .. code-block:: yaml
  379. linux:
  380. system:
  381. directory:
  382. /tmp/test:
  383. user: root
  384. group: root
  385. mode: 700
  386. makedirs: true
  387. Ensure presence of file by specifying its source:
  388. .. code-block:: yaml
  389. linux:
  390. system:
  391. file:
  392. /tmp/test.txt:
  393. source: http://example.com/test.txt
  394. user: root #optional
  395. group: root #optional
  396. mode: 700 #optional
  397. dir_mode: 700 #optional
  398. encoding: utf-8 #optional
  399. hash: <<hash>> or <<URI to hash>> #optional
  400. makedirs: true #optional
  401. linux:
  402. system:
  403. file:
  404. test.txt:
  405. name: /tmp/test.txt
  406. source: http://example.com/test.txt
  407. linux:
  408. system:
  409. file:
  410. test2:
  411. name: /tmp/test2.txt
  412. source: http://example.com/test2.jinja
  413. template: jinja
  414. Ensure presence of file by specifying its contents:
  415. .. code-block:: yaml
  416. linux:
  417. system:
  418. file:
  419. /tmp/test.txt:
  420. contents: |
  421. line1
  422. line2
  423. linux:
  424. system:
  425. file:
  426. /tmp/test.txt:
  427. contents_pillar: linux:network:hostname
  428. linux:
  429. system:
  430. file:
  431. /tmp/test.txt:
  432. contents_grains: motd
  433. Ensure presence of file to be serialized through one of the
  434. serializer modules (see:
  435. https://docs.saltstack.com/en/latest/ref/serializers/all/index.html):
  436. .. code-block:: yaml
  437. linux:
  438. system:
  439. file:
  440. /tmp/test.json:
  441. serialize: json
  442. contents:
  443. foo: 1
  444. bar: 'bar'
  445. Kernel
  446. ~~~~~~
  447. Install always up to date LTS kernel and headers from Ubuntu Trusty:
  448. .. code-block:: yaml
  449. linux:
  450. system:
  451. kernel:
  452. type: generic
  453. lts: trusty
  454. headers: true
  455. Load kernel modules and add them to ``/etc/modules``:
  456. .. code-block:: yaml
  457. linux:
  458. system:
  459. kernel:
  460. modules:
  461. - nf_conntrack
  462. - tp_smapi
  463. - 8021q
  464. Configure or blacklist kernel modules with additional options to
  465. ``/etc/modprobe.d`` following example will add
  466. ``/etc/modprobe.d/nf_conntrack.conf`` file with line
  467. ``options nf_conntrack hashsize=262144``:
  468. 'option' can be a mapping (with 'enabled' and 'value' keys) or a scalar.
  469. Example for 'scalar' option value:
  470. .. code-block:: yaml
  471. linux:
  472. system:
  473. kernel:
  474. module:
  475. nf_conntrack:
  476. option:
  477. hashsize: 262144
  478. Example for 'mapping' option value:
  479. .. code-block:: yaml
  480. linux:
  481. system:
  482. kernel:
  483. module:
  484. nf_conntrack:
  485. option:
  486. hashsize:
  487. enabled: true
  488. value: 262144
  489. NOTE: 'enabled' key is optional and is True by default.
  490. Blacklist a module:
  491. .. code-block:: yaml
  492. linux:
  493. system:
  494. kernel:
  495. module:
  496. nf_conntrack:
  497. blacklist: true
  498. A module can have a number of aliases, wildcards are allowed.
  499. Define an alias for a module:
  500. .. code-block:: yaml
  501. linux:
  502. system:
  503. kernel:
  504. module:
  505. nf_conntrack:
  506. alias:
  507. nfct:
  508. enabled: true
  509. "nf_conn*":
  510. enabled: true
  511. NOTE: 'enabled' key is mandatory as there are no other keys exist.
  512. Execute custom command instead of 'insmod' when inserting a module:
  513. .. code-block:: yaml
  514. linux:
  515. system:
  516. kernel:
  517. module:
  518. nf_conntrack:
  519. install:
  520. enabled: true
  521. command: /bin/true
  522. NOTE: 'enabled' key is optional and is True by default.
  523. Execute custom command instead of 'rmmod' when removing a module:
  524. .. code-block:: yaml
  525. linux:
  526. system:
  527. kernel:
  528. module:
  529. nf_conntrack:
  530. remove:
  531. enabled: true
  532. command: /bin/true
  533. NOTE: 'enabled' key is optional and is True by default.
  534. Define module dependencies:
  535. .. code-block:: yaml
  536. linux:
  537. system:
  538. kernel:
  539. module:
  540. nf_conntrack:
  541. softdep:
  542. pre:
  543. 1:
  544. enabled: true
  545. value: a
  546. 2:
  547. enabled: true
  548. value: b
  549. 3:
  550. enabled: true
  551. value: c
  552. post:
  553. 1:
  554. enabled: true
  555. value: x
  556. 2:
  557. enabled: true
  558. value: y
  559. 3:
  560. enabled: true
  561. value: z
  562. NOTE: 'enabled' key is optional and is True by default.
  563. Install specific kernel version and ensure all other kernel packages are
  564. not present. Also install extra modules and headers for this kernel:
  565. .. code-block:: yaml
  566. linux:
  567. system:
  568. kernel:
  569. type: generic
  570. extra: true
  571. headers: true
  572. version: 4.2.0-22
  573. Systcl kernel parameters:
  574. .. code-block:: yaml
  575. linux:
  576. system:
  577. kernel:
  578. sysctl:
  579. net.ipv4.tcp_keepalive_intvl: 3
  580. net.ipv4.tcp_keepalive_time: 30
  581. net.ipv4.tcp_keepalive_probes: 8
  582. Configure kernel boot options:
  583. .. code-block:: yaml
  584. linux:
  585. system:
  586. kernel:
  587. boot_options:
  588. - elevator=deadline
  589. - spectre_v2=off
  590. - nopti
  591. Alternative way to set kernel boot options:
  592. .. code-block:: yaml
  593. linux:
  594. system:
  595. kernel:
  596. transparent_hugepage: always
  597. elevator: deadline
  598. isolcpu: 1,2,3,4
  599. CPU
  600. ~~~
  601. Enable cpufreq governor for every cpu:
  602. .. code-block:: yaml
  603. linux:
  604. system:
  605. cpu:
  606. governor: performance
  607. SELinux
  608. ~~~~~~~
  609. Set SELinux mode on System:
  610. .. code-block:: yaml
  611. linux:
  612. system:
  613. selinux: permissive
  614. CGROUPS
  615. ~~~~~~~
  616. Setup linux cgroups:
  617. .. code-block:: yaml
  618. linux:
  619. system:
  620. cgroup:
  621. enabled: true
  622. group:
  623. ceph_group_1:
  624. controller:
  625. cpu:
  626. shares:
  627. value: 250
  628. cpuacct:
  629. usage:
  630. value: 0
  631. cpuset:
  632. cpus:
  633. value: 1,2,3
  634. memory:
  635. limit_in_bytes:
  636. value: 2G
  637. memsw.limit_in_bytes:
  638. value: 3G
  639. mapping:
  640. subjects:
  641. - '@ceph'
  642. generic_group_1:
  643. controller:
  644. cpu:
  645. shares:
  646. value: 250
  647. cpuacct:
  648. usage:
  649. value: 0
  650. mapping:
  651. subjects:
  652. - '*:firefox'
  653. - 'student:cp'
  654. Shared libraries
  655. ~~~~~~~~~~~~~~~~
  656. Set additional shared library to Linux system library path:
  657. .. code-block:: yaml
  658. linux:
  659. system:
  660. ld:
  661. library:
  662. java:
  663. - /usr/lib/jvm/jre-openjdk/lib/amd64/server
  664. - /opt/java/jre/lib/amd64/server
  665. Certificates
  666. ~~~~~~~~~~~~
  667. Add certificate authority into system trusted CA bundle:
  668. .. code-block:: yaml
  669. linux:
  670. system:
  671. ca_certificates:
  672. mycert: |
  673. -----BEGIN CERTIFICATE-----
  674. MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
  675. A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
  676. cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
  677. MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
  678. BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
  679. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
  680. ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
  681. BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
  682. I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
  683. CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
  684. lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
  685. AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
  686. -----END CERTIFICATE-----
  687. Sysfs
  688. ~~~~~
  689. Install sysfsutils and set sysfs attributes:
  690. .. code-block:: yaml
  691. linux:
  692. system:
  693. sysfs:
  694. scheduler:
  695. block/sda/queue/scheduler: deadline
  696. power:
  697. mode:
  698. power/state: 0660
  699. owner:
  700. power/state: "root:power"
  701. devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
  702. Optional: You can also use list that will ensure order of items.
  703. .. code-block:: yaml
  704. linux:
  705. system:
  706. sysfs:
  707. scheduler:
  708. block/sda/queue/scheduler: deadline
  709. power:
  710. - mode:
  711. power/state: 0660
  712. - owner:
  713. power/state: "root:power"
  714. - devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave
  715. Sysfs definition with disabled automatic write. Attributes are saved
  716. to configuration, but are not applied during the run.
  717. They will be applied automatically after the reboot.
  718. .. code-block:: yaml
  719. linux:
  720. system:
  721. sysfs:
  722. enable_apply: false
  723. scheduler:
  724. block/sda/queue/scheduler: deadline
  725. .. note:: The `enable_apply` parameter defaults to `True` if not defined.
  726. Huge Pages
  727. ~~~~~~~~~~~~
  728. Huge Pages give a performance boost to applications that intensively deal
  729. with memory allocation/deallocation by decreasing memory fragmentation:
  730. .. code-block:: yaml
  731. linux:
  732. system:
  733. kernel:
  734. hugepages:
  735. small:
  736. size: 2M
  737. count: 107520
  738. mount_point: /mnt/hugepages_2MB
  739. mount: false/true # default is true (mount immediately) / false (just save in the fstab)
  740. large:
  741. default: true # default automatically mounted
  742. size: 1G
  743. count: 210
  744. mount_point: /mnt/hugepages_1GB
  745. .. note:: Not recommended to use both pagesizes concurrently.
  746. Intel SR-IOV
  747. ~~~~~~~~~~~~
  748. PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV)
  749. specification defines a standardized mechanism to virtualize
  750. PCIe devices. The mechanism can virtualize a single PCIe
  751. Ethernet controller to appear as multiple PCIe devices:
  752. .. code-block:: yaml
  753. linux:
  754. system:
  755. kernel:
  756. sriov: True
  757. unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
  758. rc:
  759. local: |
  760. #!/bin/sh -e
  761. # Enable 7 VF on eth1
  762. echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
  763. exit 0
  764. Isolate CPU options
  765. ~~~~~~~~~~~~~~~~~~~
  766. Remove the specified CPUs, as defined by the cpu_number values, from
  767. the general kernel SMP balancing and scheduler algroithms. The only
  768. way to move a process onto or off an *isolated* CPU is via the CPU
  769. affinity syscalls. ``cpu_number begins`` at ``0``, so the
  770. maximum value is ``1`` less than the number of CPUs on the system.:
  771. .. code-block:: yaml
  772. linux:
  773. system:
  774. kernel:
  775. isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
  776. Repositories
  777. ~~~~~~~~~~~~
  778. RedHat-based Linux with additional OpenStack repo:
  779. .. code-block:: yaml
  780. linux:
  781. system:
  782. ...
  783. repo:
  784. rdo-icehouse:
  785. enabled: true
  786. source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
  787. gpgcheck: 0
  788. Ensure system repository to use czech Debian mirror (``default: true``)
  789. Also pin it's packages with priority ``900``:
  790. .. code-block:: yaml
  791. linux:
  792. system:
  793. repo:
  794. debian:
  795. default: true
  796. source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
  797. # Import signing key from URL if needed
  798. key_url: "http://dummy.com/public.gpg"
  799. pin:
  800. - pin: 'origin "ftp.cz.debian.org"'
  801. priority: 900
  802. package: '*'
  803. If you need to add multiple pin rules for one repo, please use new,ordered definition format
  804. ('pinning' definition will be in priotity to use):
  805. .. code-block:: yaml
  806. linux:
  807. system:
  808. repo:
  809. mcp_saltstack:
  810. source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main"
  811. architectures: amd64
  812. clean_file: true
  813. pinning:
  814. 10:
  815. enabled: true
  816. pin: 'release o=SaltStack'
  817. priority: 50
  818. package: 'libsodium18'
  819. 20:
  820. enabled: true
  821. pin: 'release o=SaltStack'
  822. priority: 1100
  823. package: '*'
  824. .. note:: For old Ubuntu releases (<xenial)
  825. extra packages for apt transport, like ``apt-transport-https``
  826. may be required to be installed manually.
  827. (Chicken-eggs issue: we need to install packages to
  828. reach repo from where they should be installed)
  829. Otherwise, you still can try 'fortune' and install prereq.packages before
  830. any repo configuration, using list of requires in map.jinja.
  831. Disabling any prerequisite packages installation:
  832. You can simply drop any package pre-installation (before system.linux.repo
  833. will be processed) via cluster lvl:
  834. .. code-block:: yaml
  835. linux:
  836. system:
  837. pkgs: ~
  838. Package manager proxy global setup:
  839. .. code-block:: yaml
  840. linux:
  841. system:
  842. ...
  843. repo:
  844. apt-mk:
  845. source: "deb http://apt-mk.mirantis.com/ stable main salt"
  846. ...
  847. proxy:
  848. pkg:
  849. enabled: true
  850. ftp: ftp://ftp-proxy-for-apt.host.local:2121
  851. ...
  852. # NOTE: Global defaults for any other componet that configure proxy on the system.
  853. # If your environment has just one simple proxy, set it on linux:system:proxy.
  854. #
  855. # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
  856. # as for https and http
  857. ftp: ftp://proxy.host.local:2121
  858. http: http://proxy.host.local:3142
  859. https: https://proxy.host.local:3143
  860. Package manager proxy setup per repository:
  861. .. code-block:: yaml
  862. linux:
  863. system:
  864. ...
  865. repo:
  866. debian:
  867. source: "deb http://apt-mk.mirantis.com/ stable main salt"
  868. ...
  869. apt-mk:
  870. source: "deb http://apt-mk.mirantis.com/ stable main salt"
  871. # per repository proxy
  872. proxy:
  873. enabled: true
  874. http: http://maas-01:8080
  875. https: http://maas-01:8080
  876. ...
  877. proxy:
  878. # package manager fallback defaults
  879. # used if linux:system:repo:apt-mk:proxy has no protocol specific entries
  880. pkg:
  881. enabled: true
  882. ftp: ftp://proxy.host.local:2121
  883. #http: http://proxy.host.local:3142
  884. #https: https://proxy.host.local:3143
  885. ...
  886. # global system fallback system defaults
  887. ftp: ftp://proxy.host.local:2121
  888. http: http://proxy.host.local:3142
  889. https: https://proxy.host.local:3143
  890. Remove all repositories:
  891. .. code-block:: yaml
  892. linux:
  893. system:
  894. purge_repos: true
  895. Refresh repositories metada, after configuration:
  896. .. code-block:: yaml
  897. linux:
  898. system:
  899. refresh_repos_meta: true
  900. Setup custom apt config options:
  901. .. code-block:: yaml
  902. linux:
  903. system:
  904. apt:
  905. config:
  906. compression-workaround:
  907. "Acquire::CompressionTypes::Order": "gz"
  908. docker-clean:
  909. "DPkg::Post-Invoke":
  910. - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
  911. "APT::Update::Post-Invoke":
  912. - "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
  913. RC
  914. ~~
  915. rc.local example
  916. .. code-block:: yaml
  917. linux:
  918. system:
  919. rc:
  920. local: |
  921. #!/bin/sh -e
  922. #
  923. # rc.local
  924. #
  925. # This script is executed at the end of each multiuser runlevel.
  926. # Make sure that the script will "exit 0" on success or any other
  927. # value on error.
  928. #
  929. # In order to enable or disable this script just change the execution
  930. # bits.
  931. #
  932. # By default this script does nothing.
  933. exit 0
  934. Prompt
  935. ~~~~~~
  936. Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``.
  937. Every user can have different prompt:
  938. .. code-block:: yaml
  939. linux:
  940. system:
  941. prompt:
  942. 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\\]
  943. default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
  944. On Debian systems, to set prompt system-wide, it's necessary to
  945. remove setting PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc``,
  946. which comes from ``/etc/skel/.bashrc``. This formula will do
  947. this automatically, but will not touch existing user's
  948. ``~/.bashrc`` files except root.
  949. Bash
  950. ~~~~
  951. Fix bash configuration to preserve history across sessions
  952. like ZSH does by default:
  953. .. code-block:: yaml
  954. linux:
  955. system:
  956. bash:
  957. preserve_history: true
  958. Login banner message
  959. ~~~~~~~~~~~~~~~~~~~~
  960. ``/etc/issue`` is a text file which contains a message or system
  961. identification to be printed before the login prompt. It may contain
  962. various @char and \char sequences, if supported by the getty-type
  963. program employed on the system.
  964. Setting logon banner message is easy:
  965. .. code-block:: yaml
  966. liunx:
  967. system:
  968. banner:
  969. enabled: true
  970. contents: |
  971. UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
  972. You must have explicit, authorized permission to access or configure this
  973. device. Unauthorized attempts and actions to access or use this system may
  974. result in civil and/or criminal penalties.
  975. All activities performed on this system are logged and monitored.
  976. Message of the day
  977. ~~~~~~~~~~~~~~~~~~
  978. ``pam_motd`` from package ``libpam-modules`` is used for dynamic
  979. messages of the day. Setting custom ``motd`` will clean up existing ones.
  980. Setting static ``motd`` will replace existing ``/etc/motd`` and remove
  981. scripts from ``/etc/update-motd.d``.
  982. Setting static ``motd``:
  983. .. code-block:: yaml
  984. linux:
  985. system:
  986. motd: |
  987. UNAUTHORIZED ACCESS TO THIS SYSTEM IS PROHIBITED
  988. You must have explicit, authorized permission to access or configure this
  989. device. Unauthorized attempts and actions to access or use this system may
  990. result in civil and/or criminal penalties.
  991. All activities performed on this system are logged and monitored.
  992. Setting dynamic ``motd``:
  993. .. code-block:: yaml
  994. linux:
  995. system:
  996. motd:
  997. - release: |
  998. #!/bin/sh
  999. [ -r /etc/lsb-release ] && . /etc/lsb-release
  1000. if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
  1001. # Fall back to using the very slow lsb_release utility
  1002. DISTRIB_DESCRIPTION=$(lsb_release -s -d)
  1003. fi
  1004. printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
  1005. - warning: |
  1006. #!/bin/sh
  1007. printf "This is [company name] network.\n"
  1008. printf "Unauthorized access strictly prohibited.\n"
  1009. Services
  1010. ~~~~~~~~
  1011. Stop and disable the ``linux`` service:
  1012. .. code-block:: yaml
  1013. linux:
  1014. system:
  1015. service:
  1016. apt-daily.timer:
  1017. status: dead
  1018. Possible statuses are ``dead`` (disable service by default), ``running``
  1019. (enable service by default), ``enabled``, ``disabled``:
  1020. Linux with the ``atop`` service:
  1021. .. code-block:: yaml
  1022. linux:
  1023. system:
  1024. atop:
  1025. enabled: true
  1026. interval: 20
  1027. logpath: "/var/log/atop"
  1028. outfile: "/var/log/atop/daily.log"
  1029. Linux with the ``mcelog`` service:
  1030. .. code-block:: yaml
  1031. linux:
  1032. system:
  1033. mcelog:
  1034. enabled: true
  1035. logging:
  1036. syslog: true
  1037. syslog_error: true
  1038. RHEL / CentOS
  1039. ^^^^^^^^^^^^^
  1040. Currently, ``update-motd`` is not available
  1041. for RHEL. So there is no native support for dynamic ``motd``.
  1042. You can still set a static one, with a different pillar structure:
  1043. .. code-block:: yaml
  1044. linux:
  1045. system:
  1046. motd: |
  1047. This is [company name] network.
  1048. Unauthorized access strictly prohibited.
  1049. Haveged
  1050. ~~~~~~~
  1051. If you are running headless server and are low on entropy,
  1052. you may set up Haveged:
  1053. .. code-block:: yaml
  1054. linux:
  1055. system:
  1056. haveged:
  1057. enabled: true
  1058. Linux network
  1059. -------------
  1060. Linux with network manager:
  1061. .. code-block:: yaml
  1062. linux:
  1063. network:
  1064. enabled: true
  1065. network_manager: true
  1066. Execute linux.network.interface state without ifupdown activity:
  1067. .. code-block:: bash
  1068. salt-call linux.network.interface pillar='{"linux":{"network":{"noifupdown":True}}}'
  1069. Linux with default static network interfaces, default gateway
  1070. interface and DNS servers:
  1071. .. code-block:: yaml
  1072. linux:
  1073. network:
  1074. enabled: true
  1075. interface:
  1076. eth0:
  1077. enabled: true
  1078. type: eth
  1079. address: 192.168.0.102
  1080. netmask: 255.255.255.0
  1081. gateway: 192.168.0.1
  1082. name_servers:
  1083. - 8.8.8.8
  1084. - 8.8.4.4
  1085. mtu: 1500
  1086. Linux with IPv4 and IPv6 static network interfaces, default gateway
  1087. .. code-block:: yaml
  1088. linux:
  1089. network:
  1090. enabled: true
  1091. interface:
  1092. eth0:
  1093. enabled: true
  1094. type: eth
  1095. address: 192.168.0.102
  1096. netmask: 255.255.255.0
  1097. gateway: 192.168.0.1
  1098. enable_ipv6: true
  1099. ipv6proto: static
  1100. ipv6ipaddr: 1234:abcd::ffff:192.168.0.102
  1101. ipv6gateway: 1234:abcd::ffff:192.168.0.1
  1102. ipv6netmask: 64
  1103. Linux with bonded interfaces and disabled ``NetworkManager``:
  1104. .. code-block:: yaml
  1105. linux:
  1106. network:
  1107. enabled: true
  1108. interface:
  1109. eth0:
  1110. type: eth
  1111. ...
  1112. eth1:
  1113. type: eth
  1114. ...
  1115. bond0:
  1116. enabled: true
  1117. type: bond
  1118. address: 192.168.0.102
  1119. netmask: 255.255.255.0
  1120. mtu: 1500
  1121. use_in:
  1122. - interface: ${linux:interface:eth0}
  1123. - interface: ${linux:interface:eth0}
  1124. network_manager:
  1125. disable: true
  1126. Linux with VLAN ``interface_params``:
  1127. .. code-block:: yaml
  1128. linux:
  1129. network:
  1130. enabled: true
  1131. interface:
  1132. vlan69:
  1133. type: vlan
  1134. use_interfaces:
  1135. - interface: ${linux:interface:bond0}
  1136. Linux with wireless interface parameters:
  1137. .. code-block:: yaml
  1138. linux:
  1139. network:
  1140. enabled: true
  1141. gateway: 10.0.0.1
  1142. default_interface: eth0
  1143. interface:
  1144. wlan0:
  1145. type: eth
  1146. wireless:
  1147. essid: example
  1148. key: example_key
  1149. security: wpa
  1150. priority: 1
  1151. Linux networks with routes defined:
  1152. .. code-block:: yaml
  1153. linux:
  1154. network:
  1155. enabled: true
  1156. gateway: 10.0.0.1
  1157. default_interface: eth0
  1158. interface:
  1159. eth0:
  1160. type: eth
  1161. route:
  1162. default:
  1163. address: 192.168.0.123
  1164. netmask: 255.255.255.0
  1165. gateway: 192.168.0.1
  1166. Native Linux Bridges:
  1167. .. code-block:: yaml
  1168. linux:
  1169. network:
  1170. interface:
  1171. eth1:
  1172. enabled: true
  1173. type: eth
  1174. proto: manual
  1175. up_cmds:
  1176. - ip address add 0/0 dev $IFACE
  1177. - ip link set $IFACE up
  1178. down_cmds:
  1179. - ip link set $IFACE down
  1180. br-ex:
  1181. enabled: true
  1182. type: bridge
  1183. address: ${linux:network:host:public_local:address}
  1184. netmask: 255.255.255.0
  1185. use_interfaces:
  1186. - eth1
  1187. Open vSwitch Bridges:
  1188. .. code-block:: yaml
  1189. linux:
  1190. network:
  1191. bridge: openvswitch
  1192. interface:
  1193. eth1:
  1194. enabled: true
  1195. type: eth
  1196. proto: manual
  1197. up_cmds:
  1198. - ip address add 0/0 dev $IFACE
  1199. - ip link set $IFACE up
  1200. down_cmds:
  1201. - ip link set $IFACE down
  1202. br-ex:
  1203. enabled: true
  1204. type: bridge
  1205. address: ${linux:network:host:public_local:address}
  1206. netmask: 255.255.255.0
  1207. use_interfaces:
  1208. - eth1
  1209. br-prv:
  1210. enabled: true
  1211. type: ovs_bridge
  1212. mtu: 65000
  1213. br-ens7:
  1214. enabled: true
  1215. name: br-ens7
  1216. type: ovs_bridge
  1217. proto: manual
  1218. mtu: 9000
  1219. use_interfaces:
  1220. - ens7
  1221. patch-br-ens7-br-prv:
  1222. enabled: true
  1223. name: ens7-prv
  1224. ovs_type: ovs_port
  1225. type: ovs_port
  1226. bridge: br-ens7
  1227. port_type: patch
  1228. peer: prv-ens7
  1229. tag: 109 # [] to unset a tag
  1230. mtu: 65000
  1231. patch-br-prv-br-ens7:
  1232. enabled: true
  1233. name: prv-ens7
  1234. bridge: br-prv
  1235. ovs_type: ovs_port
  1236. type: ovs_port
  1237. port_type: patch
  1238. peer: ens7-prv
  1239. tag: 109
  1240. mtu: 65000
  1241. ens7:
  1242. enabled: true
  1243. name: ens7
  1244. proto: manual
  1245. ovs_port_type: OVSPort
  1246. type: ovs_port
  1247. ovs_bridge: br-ens7
  1248. bridge: br-ens7
  1249. Debian manual proto interfaces
  1250. When you are changing interface proto from static in up state
  1251. to manual, you may need to flush ip addresses. For example,
  1252. if you want to use the interface and the ip on the bridge.
  1253. This can be done by setting the ``ipflush_onchange`` to true.
  1254. .. code-block:: yaml
  1255. linux:
  1256. network:
  1257. interface:
  1258. eth1:
  1259. enabled: true
  1260. type: eth
  1261. proto: manual
  1262. mtu: 9100
  1263. ipflush_onchange: true
  1264. Debian static proto interfaces
  1265. When you are changing interface proto from dhcp in up state to
  1266. static, you may need to flush ip addresses and restart interface
  1267. to assign ip address from a managed file. For example, if you wantto
  1268. use the interface and the ip on the bridge. This can be done by
  1269. setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
  1270. param set to true.
  1271. .. code-block:: yaml
  1272. linux:
  1273. network:
  1274. interface:
  1275. eth1:
  1276. enabled: true
  1277. type: eth
  1278. proto: static
  1279. address: 10.1.0.22
  1280. netmask: 255.255.255.0
  1281. ipflush_onchange: true
  1282. restart_on_ipflush: true
  1283. Concatinating and removing interface files
  1284. Debian based distributions have ``/etc/network/interfaces.d/``
  1285. directory, where you can store configuration of network
  1286. interfaces in separate files. You can concatinate the files
  1287. to the defined destination when needed, this operation removes
  1288. the file from the ``/etc/network/interfaces.d/``. If you just need
  1289. to remove iface files, you can use the ``remove_iface_files`` key.
  1290. .. code-block:: yaml
  1291. linux:
  1292. network:
  1293. concat_iface_files:
  1294. - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
  1295. dst: '/etc/network/interfaces'
  1296. remove_iface_files:
  1297. - '/etc/network/interfaces.d/90-custom.cfg'
  1298. Configure DHCP client
  1299. None of the keys is mandatory, include only those you really need.
  1300. For full list of available options under send, supersede, prepend,
  1301. append refer to dhcp-options(5).
  1302. .. code-block:: yaml
  1303. linux:
  1304. network:
  1305. dhclient:
  1306. enabled: true
  1307. backoff_cutoff: 15
  1308. initial_interval: 10
  1309. reboot: 10
  1310. retry: 60
  1311. select_timeout: 0
  1312. timeout: 120
  1313. send:
  1314. - option: host-name
  1315. declaration: "= gethostname()"
  1316. supersede:
  1317. - option: host-name
  1318. declaration: "spaceship"
  1319. - option: domain-name
  1320. declaration: "domain.home"
  1321. #- option: arp-cache-timeout
  1322. # declaration: 20
  1323. prepend:
  1324. - option: domain-name-servers
  1325. declaration:
  1326. - 8.8.8.8
  1327. - 8.8.4.4
  1328. - option: domain-search
  1329. declaration:
  1330. - example.com
  1331. - eng.example.com
  1332. #append:
  1333. #- option: domain-name-servers
  1334. # declaration: 127.0.0.1
  1335. # ip or subnet to reject dhcp offer from
  1336. reject:
  1337. - 192.33.137.209
  1338. - 10.0.2.0/24
  1339. request:
  1340. - subnet-mask
  1341. - broadcast-address
  1342. - time-offset
  1343. - routers
  1344. - domain-name
  1345. - domain-name-servers
  1346. - domain-search
  1347. - host-name
  1348. - dhcp6.name-servers
  1349. - dhcp6.domain-search
  1350. - dhcp6.fqdn
  1351. - dhcp6.sntp-servers
  1352. - netbios-name-servers
  1353. - netbios-scope
  1354. - interface-mtu
  1355. - rfc3442-classless-static-routes
  1356. - ntp-servers
  1357. require:
  1358. - subnet-mask
  1359. - domain-name-servers
  1360. # if per interface configuration required add below
  1361. interface:
  1362. ens2:
  1363. initial_interval: 11
  1364. reject:
  1365. - 192.33.137.210
  1366. ens3:
  1367. initial_interval: 12
  1368. reject:
  1369. - 192.33.137.211
  1370. Linux network systemd settings:
  1371. .. code-block:: yaml
  1372. linux:
  1373. network:
  1374. ...
  1375. systemd:
  1376. link:
  1377. 10-iface-dmz:
  1378. Match:
  1379. MACAddress: c8:5b:67:fa:1a:af
  1380. OriginalName: eth0
  1381. Link:
  1382. Name: dmz0
  1383. netdev:
  1384. 20-bridge-dmz:
  1385. match:
  1386. name: dmz0
  1387. network:
  1388. mescription: bridge
  1389. bridge: br-dmz0
  1390. network:
  1391. # works with lowercase, keys are by default capitalized
  1392. 40-dhcp:
  1393. match:
  1394. name: '*'
  1395. network:
  1396. DHCP: yes
  1397. Configure global environment variables
  1398. Use ``/etc/environment`` for static system wide variable assignment
  1399. after boot. Variable expansion is frequently not supported.
  1400. .. code-block:: yaml
  1401. linux:
  1402. system:
  1403. env:
  1404. BOB_VARIABLE: Alice
  1405. ...
  1406. BOB_PATH:
  1407. - /srv/alice/bin
  1408. - /srv/bob/bin
  1409. ...
  1410. ftp_proxy: none
  1411. http_proxy: http://global-http-proxy.host.local:8080
  1412. https_proxy: ${linux:system:proxy:https}
  1413. no_proxy:
  1414. - 192.168.0.80
  1415. - 192.168.1.80
  1416. - .domain.com
  1417. - .local
  1418. ...
  1419. # NOTE: global defaults proxy configuration.
  1420. proxy:
  1421. ftp: ftp://proxy.host.local:2121
  1422. http: http://proxy.host.local:3142
  1423. https: https://proxy.host.local:3143
  1424. noproxy:
  1425. - .domain.com
  1426. - .local
  1427. Configure the ``profile.d`` scripts
  1428. The ``profile.d`` scripts are being sourced during ``.sh`` execution
  1429. and support variable expansion in opposite to /etc/environment global
  1430. settings in ``/etc/environment``.
  1431. .. code-block:: yaml
  1432. linux:
  1433. system:
  1434. profile:
  1435. locales: |
  1436. export LANG=C
  1437. export LC_ALL=C
  1438. ...
  1439. vi_flavors.sh: |
  1440. export PAGER=view
  1441. export EDITOR=vim
  1442. alias vi=vim
  1443. shell_locales.sh: |
  1444. export LANG=en_US
  1445. export LC_ALL=en_US.UTF-8
  1446. shell_proxies.sh: |
  1447. export FTP_PROXY=ftp://127.0.3.3:2121
  1448. export NO_PROXY='.local'
  1449. Configure login.defs parameters
  1450. -------------------------------
  1451. .. code-block:: yaml
  1452. linux:
  1453. system:
  1454. login_defs:
  1455. <opt_name>:
  1456. enabled: true
  1457. value: <opt_value>
  1458. <opt_name> is a configurational option defined in 'man login.defs'.
  1459. <opt_name> is case sensitive, should be UPPERCASE only!
  1460. Linux with hosts
  1461. Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
  1462. removing entries that are not defined in model except defaults
  1463. for both IPv4 and IPv6 localhost and hostname as well as FQDN.
  1464. We recommend using this option to verify that ``/etc/hosts``
  1465. is always in a clean state. However it is not enabled by default
  1466. for security reasons.
  1467. .. code-block:: yaml
  1468. linux:
  1469. network:
  1470. purge_hosts: true
  1471. host:
  1472. # No need to define this one if purge_hosts is true
  1473. hostname:
  1474. address: 127.0.1.1
  1475. names:
  1476. - ${linux:network:fqdn}
  1477. - ${linux:network:hostname}
  1478. node1:
  1479. address: 192.168.10.200
  1480. names:
  1481. - node2.domain.com
  1482. - service2.domain.com
  1483. node2:
  1484. address: 192.168.10.201
  1485. names:
  1486. - node2.domain.com
  1487. - service2.domain.com
  1488. Linux with hosts collected from mine
  1489. All DNS records defined within infrastrucuture
  1490. are passed to the local hosts records or any DNS server. Only
  1491. hosts with the ``grain`` parameter set to ``true`` will be propagated
  1492. to the mine.
  1493. .. code-block:: yaml
  1494. linux:
  1495. network:
  1496. purge_hosts: true
  1497. mine_dns_records: true
  1498. host:
  1499. node1:
  1500. address: 192.168.10.200
  1501. grain: true
  1502. names:
  1503. - node2.domain.com
  1504. - service2.domain.com
  1505. Set up ``resolv.conf``, nameservers, domain and search domains:
  1506. .. code-block:: yaml
  1507. linux:
  1508. network:
  1509. resolv:
  1510. dns:
  1511. - 8.8.4.4
  1512. - 8.8.8.8
  1513. domain: my.example.com
  1514. search:
  1515. - my.example.com
  1516. - example.com
  1517. options:
  1518. - ndots: 5
  1519. - timeout: 2
  1520. - attempts: 2
  1521. Set up custom TX queue length for tap interfaces:
  1522. .. code-block:: yaml
  1523. linux:
  1524. network:
  1525. tap_custom_txqueuelen: 10000
  1526. Open vSwitch native bond:
  1527. .. code-block:: yaml
  1528. bond1:
  1529. enabled: true
  1530. type: ovs_bond
  1531. mode: balance-slb
  1532. bridge: br-ex
  1533. slaves: eno3 eno4
  1534. DPDK OVS interfaces
  1535. **DPDK OVS NIC**
  1536. .. code-block:: yaml
  1537. linux:
  1538. network:
  1539. bridge: openvswitch
  1540. dpdk:
  1541. enabled: true
  1542. driver: uio/vfio
  1543. openvswitch:
  1544. pmd_cpu_mask: "0x6"
  1545. dpdk_socket_mem: "1024,1024"
  1546. dpdk_lcore_mask: "0x400"
  1547. memory_channels: 2
  1548. interface:
  1549. dpkd0:
  1550. name: ${_param:dpdk_nic}
  1551. pci: 0000:06:00.0
  1552. driver: igb_uio/vfio-pci
  1553. enabled: true
  1554. type: dpdk_ovs_port
  1555. n_rxq: 2
  1556. pmd_rxq_affinity: "0:1,1:2"
  1557. bridge: br-prv
  1558. mtu: 9000
  1559. br-prv:
  1560. enabled: true
  1561. type: dpdk_ovs_bridge
  1562. **DPDK OVS Bond**
  1563. .. code-block:: yaml
  1564. linux:
  1565. network:
  1566. bridge: openvswitch
  1567. dpdk:
  1568. enabled: true
  1569. driver: uio/vfio
  1570. openvswitch:
  1571. pmd_cpu_mask: "0x6"
  1572. dpdk_socket_mem: "1024,1024"
  1573. dpdk_lcore_mask: "0x400"
  1574. memory_channels: 2
  1575. interface:
  1576. dpdk_second_nic:
  1577. name: ${_param:primary_second_nic}
  1578. pci: 0000:06:00.0
  1579. driver: igb_uio/vfio-pci
  1580. bond: dpdkbond0
  1581. enabled: true
  1582. type: dpdk_ovs_port
  1583. n_rxq: 2
  1584. pmd_rxq_affinity: "0:1,1:2"
  1585. mtu: 9000
  1586. dpdk_first_nic:
  1587. name: ${_param:primary_first_nic}
  1588. pci: 0000:05:00.0
  1589. driver: igb_uio/vfio-pci
  1590. bond: dpdkbond0
  1591. enabled: true
  1592. type: dpdk_ovs_port
  1593. n_rxq: 2
  1594. pmd_rxq_affinity: "0:1,1:2"
  1595. mtu: 9000
  1596. dpdkbond0:
  1597. enabled: true
  1598. bridge: br-prv
  1599. type: dpdk_ovs_bond
  1600. mode: active-backup
  1601. br-prv:
  1602. enabled: true
  1603. type: dpdk_ovs_bridge
  1604. **DPDK OVS LACP Bond with vlan tag**
  1605. .. code-block:: yaml
  1606. linux:
  1607. network:
  1608. bridge: openvswitch
  1609. dpdk:
  1610. enabled: true
  1611. driver: uio
  1612. openvswitch:
  1613. pmd_cpu_mask: "0x6"
  1614. dpdk_socket_mem: "1024,1024"
  1615. dpdk_lcore_mask: "0x400"
  1616. memory_channels: "2"
  1617. interface:
  1618. eth3:
  1619. enabled: true
  1620. type: eth
  1621. proto: manual
  1622. name: ${_param:tenant_first_nic}
  1623. eth4:
  1624. enabled: true
  1625. type: eth
  1626. proto: manual
  1627. name: ${_param:tenant_second_nic}
  1628. dpdk0:
  1629. name: ${_param:tenant_first_nic}
  1630. pci: "0000:81:00.0"
  1631. driver: igb_uio
  1632. bond: bond1
  1633. enabled: true
  1634. type: dpdk_ovs_port
  1635. n_rxq: 2
  1636. dpdk1:
  1637. name: ${_param:tenant_second_nic}
  1638. pci: "0000:81:00.1"
  1639. driver: igb_uio
  1640. bond: bond1
  1641. enabled: true
  1642. type: dpdk_ovs_port
  1643. n_rxq: 2
  1644. bond1:
  1645. enabled: true
  1646. bridge: br-prv
  1647. type: dpdk_ovs_bond
  1648. mode: balance-slb
  1649. br-prv:
  1650. enabled: true
  1651. type: dpdk_ovs_bridge
  1652. tag: ${_param:tenant_vlan}
  1653. address: ${_param:tenant_address}
  1654. netmask: ${_param:tenant_network_netmask}
  1655. **DPDK OVS bridge for VXLAN**
  1656. If VXLAN is used as tenant segmentation, IP address must
  1657. be set on ``br-prv``.
  1658. .. code-block:: yaml
  1659. linux:
  1660. network:
  1661. ...
  1662. interface:
  1663. br-prv:
  1664. enabled: true
  1665. type: dpdk_ovs_bridge
  1666. address: 192.168.50.0
  1667. netmask: 255.255.255.0
  1668. tag: 101
  1669. mtu: 9000
  1670. **DPDK OVS bridge with Linux network interface**
  1671. .. code-block:: yaml
  1672. linux:
  1673. network:
  1674. ...
  1675. interface:
  1676. eth0:
  1677. type: eth
  1678. ovs_bridge: br-prv
  1679. ...
  1680. br-prv:
  1681. enabled: true
  1682. type: dpdk_ovs_bridge
  1683. ...
  1684. Linux storage
  1685. -------------
  1686. Linux with mounted Samba:
  1687. .. code-block:: yaml
  1688. linux:
  1689. storage:
  1690. enabled: true
  1691. mount:
  1692. samba1:
  1693. - enabled: true
  1694. - path: /media/myuser/public/
  1695. - device: //192.168.0.1/storage
  1696. - file_system: cifs
  1697. - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
  1698. NFS mount:
  1699. .. code-block:: yaml
  1700. linux:
  1701. storage:
  1702. enabled: true
  1703. mount:
  1704. nfs_glance:
  1705. enabled: true
  1706. path: /var/lib/glance/images
  1707. device: 172.16.10.110:/var/nfs/glance
  1708. file_system: nfs
  1709. opts: rw,sync
  1710. Bind mount:
  1711. .. code-block:: yaml
  1712. linux:
  1713. storage:
  1714. enabled: true
  1715. mount:
  1716. mount_bind:
  1717. enabled: true
  1718. path: /mnt/bind/name
  1719. device: /mnt/source/bind
  1720. file_system: none
  1721. opts: bind,defaults
  1722. dump: 0
  1723. pass_num: 1
  1724. File swap configuration:
  1725. .. code-block:: yaml
  1726. linux:
  1727. storage:
  1728. enabled: true
  1729. swap:
  1730. file:
  1731. enabled: true
  1732. engine: file
  1733. device: /swapfile
  1734. size: 1024
  1735. Partition swap configuration:
  1736. .. code-block:: yaml
  1737. linux:
  1738. storage:
  1739. enabled: true
  1740. swap:
  1741. partition:
  1742. enabled: true
  1743. engine: partition
  1744. device: /dev/vg0/swap
  1745. LVM group ``vg1`` with one device and ``data`` volume mounted
  1746. into ``/mnt/data``.
  1747. .. code-block:: yaml
  1748. parameters:
  1749. linux:
  1750. storage:
  1751. mount:
  1752. data:
  1753. enabled: true
  1754. device: /dev/vg1/data
  1755. file_system: ext4
  1756. path: /mnt/data
  1757. lvm:
  1758. vg1:
  1759. enabled: true
  1760. devices:
  1761. - /dev/sdb
  1762. volume:
  1763. data:
  1764. size: 40G
  1765. mount: ${linux:storage:mount:data}
  1766. Salt now also supports expanding and shrinking a LV:
  1767. To reduce the size of an LV the option force must be set to true.
  1768. ! Caution this can destroy the file system if it is not shrunk before !
  1769. only some file systems can be shrunk.
  1770. .. code-block:: yaml
  1771. parameters:
  1772. linux:
  1773. lvm:
  1774. vg1:
  1775. enabled: true
  1776. devices:
  1777. - /dev/sdb
  1778. volume:
  1779. data: # to expand
  1780. size: 50G
  1781. mount: ${linux:storage:mount:data}
  1782. data: # to reduce
  1783. size: 30G
  1784. force: true
  1785. mount: ${linux:storage:mount:data}
  1786. Create partitions on disk. Specify size in MB. It expects empty
  1787. disk without any existing partitions.
  1788. Set ``startsector=1`` if you want to start partitions from ``2048``.
  1789. .. code-block:: yaml
  1790. linux:
  1791. storage:
  1792. disk:
  1793. first_drive:
  1794. startsector: 1
  1795. name: /dev/loop1
  1796. type: gpt
  1797. partitions:
  1798. - size: 200 #size in MB
  1799. type: fat32
  1800. - size: 300 #size in MB
  1801. mkfs: True
  1802. type: xfs
  1803. /dev/vda1:
  1804. partitions:
  1805. - size: 5
  1806. type: ext2
  1807. - size: 10
  1808. type: ext4
  1809. Multipath with Fujitsu Eternus DXL:
  1810. .. code-block:: yaml
  1811. parameters:
  1812. linux:
  1813. storage:
  1814. multipath:
  1815. enabled: true
  1816. blacklist_devices:
  1817. - /dev/sda
  1818. - /dev/sdb
  1819. backends:
  1820. - fujitsu_eternus_dxl
  1821. Multipath with Hitachi VSP 1000:
  1822. .. code-block:: yaml
  1823. parameters:
  1824. linux:
  1825. storage:
  1826. multipath:
  1827. enabled: true
  1828. blacklist_devices:
  1829. - /dev/sda
  1830. - /dev/sdb
  1831. backends:
  1832. - hitachi_vsp1000
  1833. Multipath with IBM Storwize:
  1834. .. code-block:: yaml
  1835. parameters:
  1836. linux:
  1837. storage:
  1838. multipath:
  1839. enabled: true
  1840. blacklist_devices:
  1841. - /dev/sda
  1842. - /dev/sdb
  1843. backends:
  1844. - ibm_storwize
  1845. Multipath with multiple backends:
  1846. .. code-block:: yaml
  1847. parameters:
  1848. linux:
  1849. storage:
  1850. multipath:
  1851. enabled: true
  1852. blacklist_devices:
  1853. - /dev/sda
  1854. - /dev/sdb
  1855. - /dev/sdc
  1856. - /dev/sdd
  1857. backends:
  1858. - ibm_storwize
  1859. - fujitsu_eternus_dxl
  1860. - hitachi_vsp1000
  1861. PAM LDAP integration:
  1862. .. code-block:: yaml
  1863. parameters:
  1864. linux:
  1865. system:
  1866. auth:
  1867. enabled: true
  1868. mkhomedir:
  1869. enabled: true
  1870. umask: 0027
  1871. ldap:
  1872. enabled: true
  1873. binddn: cn=bind,ou=service_users,dc=example,dc=com
  1874. bindpw: secret
  1875. uri: ldap://127.0.0.1
  1876. base: ou=users,dc=example,dc=com
  1877. ldap_version: 3
  1878. pagesize: 65536
  1879. referrals: off
  1880. filter:
  1881. passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
  1882. shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
  1883. group: (&(objectClass=group)(gidNumber=*))
  1884. PAM duo 2FA integration
  1885. .. code-block:: yaml
  1886. parameters:
  1887. linux:
  1888. system:
  1889. auth:
  1890. enabled: true
  1891. duo:
  1892. enabled: true
  1893. duo_host: localhost
  1894. duo_ikey: DUO-INTEGRATION-KEY
  1895. duo_skey: DUO-SECRET-KEY
  1896. duo package version may be specified (optional)
  1897. .. code-block:: yaml
  1898. linux:
  1899. system:
  1900. package:
  1901. duo-unix:
  1902. version: 1.10.1-0
  1903. Disabled multipath (the default setup):
  1904. .. code-block:: yaml
  1905. parameters:
  1906. linux:
  1907. storage:
  1908. multipath:
  1909. enabled: false
  1910. Linux with local loopback device:
  1911. .. code-block:: yaml
  1912. linux:
  1913. storage:
  1914. loopback:
  1915. disk1:
  1916. file: /srv/disk1
  1917. size: 50G
  1918. External config generation
  1919. --------------------------
  1920. You are able to use config support metadata between formulas
  1921. and only generate configuration files for external use, for example, Docker, and so on.
  1922. .. code-block:: yaml
  1923. parameters:
  1924. linux:
  1925. system:
  1926. config:
  1927. pillar:
  1928. jenkins:
  1929. master:
  1930. home: /srv/volumes/jenkins
  1931. approved_scripts:
  1932. - method java.net.URL openConnection
  1933. credentials:
  1934. - type: username_password
  1935. scope: global
  1936. id: test
  1937. desc: Testing credentials
  1938. username: test
  1939. password: test
  1940. Netconsole Remote Kernel Logging
  1941. --------------------------------
  1942. Netconsole logger can be configured for the configfs-enabled kernels
  1943. (``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
  1944. applies both in runtime (if network is already configured),
  1945. and on-boot after an interface initialization.
  1946. .. note::
  1947. * Receiver can be located only on the same L3 domain
  1948. (or you need to configure gateway MAC manually).
  1949. * The Receiver MAC is detected only on configuration time.
  1950. * Using broadcast MAC is not recommended.
  1951. .. code-block:: yaml
  1952. parameters:
  1953. linux:
  1954. system:
  1955. netconsole:
  1956. enabled: true
  1957. port: 514 (optional)
  1958. loglevel: debug (optional)
  1959. target:
  1960. 192.168.0.1:
  1961. interface: bond0
  1962. mac: "ff:ff:ff:ff:ff:ff" (optional)
  1963. Check network params on the environment
  1964. ---------------------------------------
  1965. Grab nics and nics states
  1966. .. code-block:: bash
  1967. salt osd001\* net_checks.get_nics
  1968. **Example of system output:**
  1969. .. code-block:: bash
  1970. osd001.domain.com:
  1971. |_
  1972. - bond0
  1973. - None
  1974. - 1e:c8:64:42:23:b9
  1975. - 0
  1976. - 1500
  1977. |_
  1978. - bond1
  1979. - None
  1980. - 3c:fd:fe:27:3b:00
  1981. - 1
  1982. - 9100
  1983. |_
  1984. - fourty1
  1985. - None
  1986. - 3c:fd:fe:27:3b:00
  1987. - 1
  1988. - 9100
  1989. |_
  1990. - fourty2
  1991. - None
  1992. - 3c:fd:fe:27:3b:02
  1993. - 1
  1994. - 9100
  1995. Grab 10G nics PCI addresses for hugepages setup
  1996. .. code-block:: bash
  1997. salt cmp001\* net_checks.get_ten_pci
  1998. **Example of system output:**
  1999. .. code-block:: bash
  2000. cmp001.domain.com:
  2001. |_
  2002. - ten1
  2003. - 0000:19:00.0
  2004. |_
  2005. - ten2
  2006. - 0000:19:00.1
  2007. |_
  2008. - ten3
  2009. - 0000:19:00.2
  2010. |_
  2011. - ten4
  2012. - 0000:19:00.3
  2013. Grab ip address for an interface
  2014. .. code-block:: bash
  2015. salt cmp001\* net_checks.get_ip iface=one4
  2016. **Example of system output:**
  2017. .. code-block:: bash
  2018. cmp001.domain.com:
  2019. 10.200.177.101
  2020. Grab ip addresses map
  2021. .. code-block:: bash
  2022. salt-call net_checks.nodes_addresses
  2023. **Example of system output:**
  2024. .. code-block:: bash
  2025. local:
  2026. |_
  2027. - cid01.domain.com
  2028. |_
  2029. |_
  2030. - pxe
  2031. - 10.200.177.91
  2032. |_
  2033. - control
  2034. - 10.200.178.91
  2035. |_
  2036. - cmn02.domain.com
  2037. |_
  2038. |_
  2039. - storage_access
  2040. - 10.200.181.67
  2041. |_
  2042. - pxe
  2043. - 10.200.177.67
  2044. |_
  2045. - control
  2046. - 10.200.178.67
  2047. |_
  2048. - cmp010.domain.com
  2049. |_
  2050. |_
  2051. - pxe
  2052. - 10.200.177.110
  2053. |_
  2054. - storage_access
  2055. - 10.200.181.110
  2056. |_
  2057. - control
  2058. - 10.200.178.110
  2059. |_
  2060. - vxlan
  2061. - 10.200.179.110
  2062. Verify full mesh connectivity
  2063. .. code-block:: bash
  2064. salt-call net_checks.ping_check
  2065. **Example of positive system output:**
  2066. .. code-block:: bash
  2067. ['PASSED']
  2068. [INFO ] ['PASSED']
  2069. local:
  2070. True
  2071. **Example of system output in case of failure:**
  2072. .. code-block:: bash
  2073. FAILED
  2074. [ERROR ] FAILED
  2075. ['control: 10.0.1.92 -> 10.0.1.224: Failed']
  2076. ['control: 10.0.1.93 -> 10.0.1.224: Failed']
  2077. ['control: 10.0.1.51 -> 10.0.1.224: Failed']
  2078. ['control: 10.0.1.102 -> 10.0.1.224: Failed']
  2079. ['control: 10.0.1.13 -> 10.0.1.224: Failed']
  2080. ['control: 10.0.1.81 -> 10.0.1.224: Failed']
  2081. local:
  2082. False
  2083. For this feature to work, please mark addresses with some role.
  2084. Otherwise 'default' role is assumed and mesh would consist of all
  2085. addresses on the environment.
  2086. Mesh mark is needed only for interfaces which are enabled and have
  2087. ip address assigned.
  2088. Checking dhcp pxe network meaningless, as it is used for salt
  2089. master vs minion communications, therefore treated as checked.
  2090. .. code-block:: yaml
  2091. parameters:
  2092. linux:
  2093. network:
  2094. interface:
  2095. ens3:
  2096. enabled: true
  2097. type: eth
  2098. proto: static
  2099. address: ${_param:deploy_address}
  2100. netmask: ${_param:deploy_network_netmask}
  2101. gateway: ${_param:deploy_network_gateway}
  2102. mesh: pxe
  2103. Check pillars for ip address duplicates
  2104. .. code-block:: bash
  2105. salt-call net_checks.verify_addresses
  2106. **Example of positive system output:**
  2107. .. code-block:: bash
  2108. ['PASSED']
  2109. [INFO ] ['PASSED']
  2110. local:
  2111. True
  2112. **Example of system output in case of failure:**
  2113. .. code-block:: bash
  2114. FAILED. Duplicates found
  2115. [ERROR ] FAILED. Duplicates found
  2116. ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
  2117. [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
  2118. local:
  2119. False
  2120. Generate csv report for the env
  2121. .. code-block:: bash
  2122. salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
  2123. | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
  2124. | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
  2125. **Example of system output:**
  2126. .. code-block:: bash
  2127. server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
  2128. cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
  2129. cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
  2130. cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
  2131. cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
  2132. cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
  2133. cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
  2134. cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
  2135. cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
  2136. cmp010.domain.com,one2,None,b4:96:91:10:5b:39,1,1500,f0:4b:3a:8f:75:40,exnfvaa18-20,548,ge-0/0/22
  2137. cmp010.domain.com,one3,None,b4:96:91:10:5b:3a,1,1500,f0:4b:3a:8f:75:40,exnfvaa18-20,547,ge-0/0/21
  2138. cmp010.domain.com,one4,10.200.177.110,b4:96:91:10:5b:3b,1,1500,f0:4b:3a:8f:75:40,exnfvaa18-20,546,ge-0/0/20
  2139. cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
  2140. cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
  2141. cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
  2142. ...
  2143. Usage
  2144. =====
  2145. Set MTU of the eth0 network interface to 1400:
  2146. .. code-block:: bash
  2147. ip link set dev eth0 mtu 1400
  2148. Read more
  2149. =========
  2150. * https://www.archlinux.org/
  2151. * http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
  2152. Documentation and Bugs
  2153. ======================
  2154. * http://salt-formulas.readthedocs.io/
  2155. Learn how to install and update salt-formulas.
  2156. * https://github.com/salt-formulas/salt-formula-linux/issues
  2157. In the unfortunate event that bugs are discovered, report the issue to the
  2158. appropriate issue tracker. Use the Github issue tracker for a specific salt
  2159. formula.
  2160. * https://launchpad.net/salt-formulas
  2161. For feature requests, bug reports, or blueprints affecting the entire
  2162. ecosystem, use the Launchpad salt-formulas project.
  2163. * https://launchpad.net/~salt-formulas-users
  2164. Join the salt-formulas-users team and subscribe to mailing list if required.
  2165. * https://github.com/salt-formulas/salt-formula-linux
  2166. Develop the salt-formulas projects in the master branch and then submit pull
  2167. requests against a specific formula.
  2168. * #salt-formulas @ irc.freenode.net
  2169. Use this IRC channel in case of any questions or feedback which is always
  2170. welcome.