Saltstack Official Linux Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

README.rst 61KB

9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
8 år sedan
8 år sedan
8 år sedan
8 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
9 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613
  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. 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 hased 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. Thay 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. pgpcheck: 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 bonded interfaces and disabled ``NetworkManager``:
  1087. .. code-block:: yaml
  1088. linux:
  1089. network:
  1090. enabled: true
  1091. interface:
  1092. eth0:
  1093. type: eth
  1094. ...
  1095. eth1:
  1096. type: eth
  1097. ...
  1098. bond0:
  1099. enabled: true
  1100. type: bond
  1101. address: 192.168.0.102
  1102. netmask: 255.255.255.0
  1103. mtu: 1500
  1104. use_in:
  1105. - interface: ${linux:interface:eth0}
  1106. - interface: ${linux:interface:eth0}
  1107. network_manager:
  1108. disable: true
  1109. Linux with VLAN ``interface_params``:
  1110. .. code-block:: yaml
  1111. linux:
  1112. network:
  1113. enabled: true
  1114. interface:
  1115. vlan69:
  1116. type: vlan
  1117. use_interfaces:
  1118. - interface: ${linux:interface:bond0}
  1119. Linux with wireless interface parameters:
  1120. .. code-block:: yaml
  1121. linux:
  1122. network:
  1123. enabled: true
  1124. gateway: 10.0.0.1
  1125. default_interface: eth0
  1126. interface:
  1127. wlan0:
  1128. type: eth
  1129. wireless:
  1130. essid: example
  1131. key: example_key
  1132. security: wpa
  1133. priority: 1
  1134. Linux networks with routes defined:
  1135. .. code-block:: yaml
  1136. linux:
  1137. network:
  1138. enabled: true
  1139. gateway: 10.0.0.1
  1140. default_interface: eth0
  1141. interface:
  1142. eth0:
  1143. type: eth
  1144. route:
  1145. default:
  1146. address: 192.168.0.123
  1147. netmask: 255.255.255.0
  1148. gateway: 192.168.0.1
  1149. Native Linux Bridges:
  1150. .. code-block:: yaml
  1151. linux:
  1152. network:
  1153. interface:
  1154. eth1:
  1155. enabled: true
  1156. type: eth
  1157. proto: manual
  1158. up_cmds:
  1159. - ip address add 0/0 dev $IFACE
  1160. - ip link set $IFACE up
  1161. down_cmds:
  1162. - ip link set $IFACE down
  1163. br-ex:
  1164. enabled: true
  1165. type: bridge
  1166. address: ${linux:network:host:public_local:address}
  1167. netmask: 255.255.255.0
  1168. use_interfaces:
  1169. - eth1
  1170. Open vSwitch Bridges:
  1171. .. code-block:: yaml
  1172. linux:
  1173. network:
  1174. bridge: openvswitch
  1175. interface:
  1176. eth1:
  1177. enabled: true
  1178. type: eth
  1179. proto: manual
  1180. up_cmds:
  1181. - ip address add 0/0 dev $IFACE
  1182. - ip link set $IFACE up
  1183. down_cmds:
  1184. - ip link set $IFACE down
  1185. br-ex:
  1186. enabled: true
  1187. type: bridge
  1188. address: ${linux:network:host:public_local:address}
  1189. netmask: 255.255.255.0
  1190. use_interfaces:
  1191. - eth1
  1192. br-prv:
  1193. enabled: true
  1194. type: ovs_bridge
  1195. mtu: 65000
  1196. br-ens7:
  1197. enabled: true
  1198. name: br-ens7
  1199. type: ovs_bridge
  1200. proto: manual
  1201. mtu: 9000
  1202. use_interfaces:
  1203. - ens7
  1204. patch-br-ens7-br-prv:
  1205. enabled: true
  1206. name: ens7-prv
  1207. ovs_type: ovs_port
  1208. type: ovs_port
  1209. bridge: br-ens7
  1210. port_type: patch
  1211. peer: prv-ens7
  1212. tag: 109 # [] to unset a tag
  1213. mtu: 65000
  1214. patch-br-prv-br-ens7:
  1215. enabled: true
  1216. name: prv-ens7
  1217. bridge: br-prv
  1218. ovs_type: ovs_port
  1219. type: ovs_port
  1220. port_type: patch
  1221. peer: ens7-prv
  1222. tag: 109
  1223. mtu: 65000
  1224. ens7:
  1225. enabled: true
  1226. name: ens7
  1227. proto: manual
  1228. ovs_port_type: OVSPort
  1229. type: ovs_port
  1230. ovs_bridge: br-ens7
  1231. bridge: br-ens7
  1232. Debian manual proto interfaces
  1233. When you are changing interface proto from static in up state
  1234. to manual, you may need to flush ip addresses. For example,
  1235. if you want to use the interface and the ip on the bridge.
  1236. This can be done by setting the ``ipflush_onchange`` to true.
  1237. .. code-block:: yaml
  1238. linux:
  1239. network:
  1240. interface:
  1241. eth1:
  1242. enabled: true
  1243. type: eth
  1244. proto: manual
  1245. mtu: 9100
  1246. ipflush_onchange: true
  1247. Debian static proto interfaces
  1248. When you are changing interface proto from dhcp in up state to
  1249. static, you may need to flush ip addresses and restart interface
  1250. to assign ip address from a managed file. For example, if you wantto
  1251. use the interface and the ip on the bridge. This can be done by
  1252. setting the ``ipflush_onchange`` with combination ``restart_on_ipflush``
  1253. param set to true.
  1254. .. code-block:: yaml
  1255. linux:
  1256. network:
  1257. interface:
  1258. eth1:
  1259. enabled: true
  1260. type: eth
  1261. proto: static
  1262. address: 10.1.0.22
  1263. netmask: 255.255.255.0
  1264. ipflush_onchange: true
  1265. restart_on_ipflush: true
  1266. Concatinating and removing interface files
  1267. Debian based distributions have ``/etc/network/interfaces.d/``
  1268. directory, where you can store configuration of network
  1269. interfaces in separate files. You can concatinate the files
  1270. to the defined destination when needed, this operation removes
  1271. the file from the ``/etc/network/interfaces.d/``. If you just need
  1272. to remove iface files, you can use the ``remove_iface_files`` key.
  1273. .. code-block:: yaml
  1274. linux:
  1275. network:
  1276. concat_iface_files:
  1277. - src: '/etc/network/interfaces.d/50-cloud-init.cfg'
  1278. dst: '/etc/network/interfaces'
  1279. remove_iface_files:
  1280. - '/etc/network/interfaces.d/90-custom.cfg'
  1281. Configure DHCP client
  1282. None of the keys is mandatory, include only those you really need.
  1283. For full list of available options under send, supersede, prepend,
  1284. append refer to dhcp-options(5).
  1285. .. code-block:: yaml
  1286. linux:
  1287. network:
  1288. dhclient:
  1289. enabled: true
  1290. backoff_cutoff: 15
  1291. initial_interval: 10
  1292. reboot: 10
  1293. retry: 60
  1294. select_timeout: 0
  1295. timeout: 120
  1296. send:
  1297. - option: host-name
  1298. declaration: "= gethostname()"
  1299. supersede:
  1300. - option: host-name
  1301. declaration: "spaceship"
  1302. - option: domain-name
  1303. declaration: "domain.home"
  1304. #- option: arp-cache-timeout
  1305. # declaration: 20
  1306. prepend:
  1307. - option: domain-name-servers
  1308. declaration:
  1309. - 8.8.8.8
  1310. - 8.8.4.4
  1311. - option: domain-search
  1312. declaration:
  1313. - example.com
  1314. - eng.example.com
  1315. #append:
  1316. #- option: domain-name-servers
  1317. # declaration: 127.0.0.1
  1318. # ip or subnet to reject dhcp offer from
  1319. reject:
  1320. - 192.33.137.209
  1321. - 10.0.2.0/24
  1322. request:
  1323. - subnet-mask
  1324. - broadcast-address
  1325. - time-offset
  1326. - routers
  1327. - domain-name
  1328. - domain-name-servers
  1329. - domain-search
  1330. - host-name
  1331. - dhcp6.name-servers
  1332. - dhcp6.domain-search
  1333. - dhcp6.fqdn
  1334. - dhcp6.sntp-servers
  1335. - netbios-name-servers
  1336. - netbios-scope
  1337. - interface-mtu
  1338. - rfc3442-classless-static-routes
  1339. - ntp-servers
  1340. require:
  1341. - subnet-mask
  1342. - domain-name-servers
  1343. # if per interface configuration required add below
  1344. interface:
  1345. ens2:
  1346. initial_interval: 11
  1347. reject:
  1348. - 192.33.137.210
  1349. ens3:
  1350. initial_interval: 12
  1351. reject:
  1352. - 192.33.137.211
  1353. Linux network systemd settings:
  1354. .. code-block:: yaml
  1355. linux:
  1356. network:
  1357. ...
  1358. systemd:
  1359. link:
  1360. 10-iface-dmz:
  1361. Match:
  1362. MACAddress: c8:5b:67:fa:1a:af
  1363. OriginalName: eth0
  1364. Link:
  1365. Name: dmz0
  1366. netdev:
  1367. 20-bridge-dmz:
  1368. match:
  1369. name: dmz0
  1370. network:
  1371. mescription: bridge
  1372. bridge: br-dmz0
  1373. network:
  1374. # works with lowercase, keys are by default capitalized
  1375. 40-dhcp:
  1376. match:
  1377. name: '*'
  1378. network:
  1379. DHCP: yes
  1380. Configure global environment variables
  1381. Use ``/etc/environment`` for static system wide variable assignment
  1382. after boot. Variable expansion is frequently not supported.
  1383. .. code-block:: yaml
  1384. linux:
  1385. system:
  1386. env:
  1387. BOB_VARIABLE: Alice
  1388. ...
  1389. BOB_PATH:
  1390. - /srv/alice/bin
  1391. - /srv/bob/bin
  1392. ...
  1393. ftp_proxy: none
  1394. http_proxy: http://global-http-proxy.host.local:8080
  1395. https_proxy: ${linux:system:proxy:https}
  1396. no_proxy:
  1397. - 192.168.0.80
  1398. - 192.168.1.80
  1399. - .domain.com
  1400. - .local
  1401. ...
  1402. # NOTE: global defaults proxy configuration.
  1403. proxy:
  1404. ftp: ftp://proxy.host.local:2121
  1405. http: http://proxy.host.local:3142
  1406. https: https://proxy.host.local:3143
  1407. noproxy:
  1408. - .domain.com
  1409. - .local
  1410. Configure the ``profile.d`` scripts
  1411. The ``profile.d`` scripts are being sourced during ``.sh`` execution
  1412. and support variable expansion in opposite to /etc/environment global
  1413. settings in ``/etc/environment``.
  1414. .. code-block:: yaml
  1415. linux:
  1416. system:
  1417. profile:
  1418. locales: |
  1419. export LANG=C
  1420. export LC_ALL=C
  1421. ...
  1422. vi_flavors.sh: |
  1423. export PAGER=view
  1424. export EDITOR=vim
  1425. alias vi=vim
  1426. shell_locales.sh: |
  1427. export LANG=en_US
  1428. export LC_ALL=en_US.UTF-8
  1429. shell_proxies.sh: |
  1430. export FTP_PROXY=ftp://127.0.3.3:2121
  1431. export NO_PROXY='.local'
  1432. Configure login.defs parameters
  1433. -------------------------------
  1434. .. code-block:: yaml
  1435. linux:
  1436. system:
  1437. login_defs:
  1438. <opt_name>:
  1439. enabled: true
  1440. value: <opt_value>
  1441. <opt_name> is a configurational option defined in 'man login.defs'.
  1442. <opt_name> is case sensitive, should be UPPERCASE only!
  1443. Linux with hosts
  1444. Parameter ``purge_hosts`` will enforce whole ``/etc/hosts file``,
  1445. removing entries that are not defined in model except defaults
  1446. for both IPv4 and IPv6 localhost and hostname as well as FQDN.
  1447. We recommend using this option to verify that ``/etc/hosts``
  1448. is always in a clean state. However it is not enabled by default
  1449. for security reasons.
  1450. .. code-block:: yaml
  1451. linux:
  1452. network:
  1453. purge_hosts: true
  1454. host:
  1455. # No need to define this one if purge_hosts is true
  1456. hostname:
  1457. address: 127.0.1.1
  1458. names:
  1459. - ${linux:network:fqdn}
  1460. - ${linux:network:hostname}
  1461. node1:
  1462. address: 192.168.10.200
  1463. names:
  1464. - node2.domain.com
  1465. - service2.domain.com
  1466. node2:
  1467. address: 192.168.10.201
  1468. names:
  1469. - node2.domain.com
  1470. - service2.domain.com
  1471. Linux with hosts collected from mine
  1472. All DNS records defined within infrastrucuture
  1473. are passed to the local hosts records or any DNS server. Only
  1474. hosts with the ``grain`` parameter set to ``true`` will be propagated
  1475. to the mine.
  1476. .. code-block:: yaml
  1477. linux:
  1478. network:
  1479. purge_hosts: true
  1480. mine_dns_records: true
  1481. host:
  1482. node1:
  1483. address: 192.168.10.200
  1484. grain: true
  1485. names:
  1486. - node2.domain.com
  1487. - service2.domain.com
  1488. Set up ``resolv.conf``, nameservers, domain and search domains:
  1489. .. code-block:: yaml
  1490. linux:
  1491. network:
  1492. resolv:
  1493. dns:
  1494. - 8.8.4.4
  1495. - 8.8.8.8
  1496. domain: my.example.com
  1497. search:
  1498. - my.example.com
  1499. - example.com
  1500. options:
  1501. - ndots: 5
  1502. - timeout: 2
  1503. - attempts: 2
  1504. Set up custom TX queue length for tap interfaces:
  1505. .. code-block:: yaml
  1506. linux:
  1507. network:
  1508. tap_custom_txqueuelen: 10000
  1509. Open vSwitch native bond:
  1510. .. code-block:: yaml
  1511. bond1:
  1512. enabled: true
  1513. type: ovs_bond
  1514. mode: balance-slb
  1515. bridge: br-ex
  1516. slaves: eno3 eno4
  1517. DPDK OVS interfaces
  1518. **DPDK OVS NIC**
  1519. .. code-block:: yaml
  1520. linux:
  1521. network:
  1522. bridge: openvswitch
  1523. dpdk:
  1524. enabled: true
  1525. driver: uio/vfio
  1526. openvswitch:
  1527. pmd_cpu_mask: "0x6"
  1528. dpdk_socket_mem: "1024,1024"
  1529. dpdk_lcore_mask: "0x400"
  1530. memory_channels: 2
  1531. interface:
  1532. dpkd0:
  1533. name: ${_param:dpdk_nic}
  1534. pci: 0000:06:00.0
  1535. driver: igb_uio/vfio-pci
  1536. enabled: true
  1537. type: dpdk_ovs_port
  1538. n_rxq: 2
  1539. pmd_rxq_affinity: "0:1,1:2"
  1540. bridge: br-prv
  1541. mtu: 9000
  1542. br-prv:
  1543. enabled: true
  1544. type: dpdk_ovs_bridge
  1545. **DPDK OVS Bond**
  1546. .. code-block:: yaml
  1547. linux:
  1548. network:
  1549. bridge: openvswitch
  1550. dpdk:
  1551. enabled: true
  1552. driver: uio/vfio
  1553. openvswitch:
  1554. pmd_cpu_mask: "0x6"
  1555. dpdk_socket_mem: "1024,1024"
  1556. dpdk_lcore_mask: "0x400"
  1557. memory_channels: 2
  1558. interface:
  1559. dpdk_second_nic:
  1560. name: ${_param:primary_second_nic}
  1561. pci: 0000:06:00.0
  1562. driver: igb_uio/vfio-pci
  1563. bond: dpdkbond0
  1564. enabled: true
  1565. type: dpdk_ovs_port
  1566. n_rxq: 2
  1567. pmd_rxq_affinity: "0:1,1:2"
  1568. mtu: 9000
  1569. dpdk_first_nic:
  1570. name: ${_param:primary_first_nic}
  1571. pci: 0000:05:00.0
  1572. driver: igb_uio/vfio-pci
  1573. bond: dpdkbond0
  1574. enabled: true
  1575. type: dpdk_ovs_port
  1576. n_rxq: 2
  1577. pmd_rxq_affinity: "0:1,1:2"
  1578. mtu: 9000
  1579. dpdkbond0:
  1580. enabled: true
  1581. bridge: br-prv
  1582. type: dpdk_ovs_bond
  1583. mode: active-backup
  1584. br-prv:
  1585. enabled: true
  1586. type: dpdk_ovs_bridge
  1587. **DPDK OVS LACP Bond with vlan tag**
  1588. .. code-block:: yaml
  1589. linux:
  1590. network:
  1591. bridge: openvswitch
  1592. dpdk:
  1593. enabled: true
  1594. driver: uio
  1595. openvswitch:
  1596. pmd_cpu_mask: "0x6"
  1597. dpdk_socket_mem: "1024,1024"
  1598. dpdk_lcore_mask: "0x400"
  1599. memory_channels: "2"
  1600. interface:
  1601. eth3:
  1602. enabled: true
  1603. type: eth
  1604. proto: manual
  1605. name: ${_param:tenant_first_nic}
  1606. eth4:
  1607. enabled: true
  1608. type: eth
  1609. proto: manual
  1610. name: ${_param:tenant_second_nic}
  1611. dpdk0:
  1612. name: ${_param:tenant_first_nic}
  1613. pci: "0000:81:00.0"
  1614. driver: igb_uio
  1615. bond: bond1
  1616. enabled: true
  1617. type: dpdk_ovs_port
  1618. n_rxq: 2
  1619. dpdk1:
  1620. name: ${_param:tenant_second_nic}
  1621. pci: "0000:81:00.1"
  1622. driver: igb_uio
  1623. bond: bond1
  1624. enabled: true
  1625. type: dpdk_ovs_port
  1626. n_rxq: 2
  1627. bond1:
  1628. enabled: true
  1629. bridge: br-prv
  1630. type: dpdk_ovs_bond
  1631. mode: balance-slb
  1632. br-prv:
  1633. enabled: true
  1634. type: dpdk_ovs_bridge
  1635. tag: ${_param:tenant_vlan}
  1636. address: ${_param:tenant_address}
  1637. netmask: ${_param:tenant_network_netmask}
  1638. **DPDK OVS bridge for VXLAN**
  1639. If VXLAN is used as tenant segmentation, IP address must
  1640. be set on ``br-prv``.
  1641. .. code-block:: yaml
  1642. linux:
  1643. network:
  1644. ...
  1645. interface:
  1646. br-prv:
  1647. enabled: true
  1648. type: dpdk_ovs_bridge
  1649. address: 192.168.50.0
  1650. netmask: 255.255.255.0
  1651. tag: 101
  1652. mtu: 9000
  1653. **DPDK OVS bridge with Linux network interface**
  1654. .. code-block:: yaml
  1655. linux:
  1656. network:
  1657. ...
  1658. interface:
  1659. eth0:
  1660. type: eth
  1661. ovs_bridge: br-prv
  1662. ...
  1663. br-prv:
  1664. enabled: true
  1665. type: dpdk_ovs_bridge
  1666. ...
  1667. Linux storage
  1668. -------------
  1669. Linux with mounted Samba:
  1670. .. code-block:: yaml
  1671. linux:
  1672. storage:
  1673. enabled: true
  1674. mount:
  1675. samba1:
  1676. - enabled: true
  1677. - path: /media/myuser/public/
  1678. - device: //192.168.0.1/storage
  1679. - file_system: cifs
  1680. - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
  1681. NFS mount:
  1682. .. code-block:: yaml
  1683. linux:
  1684. storage:
  1685. enabled: true
  1686. mount:
  1687. nfs_glance:
  1688. enabled: true
  1689. path: /var/lib/glance/images
  1690. device: 172.16.10.110:/var/nfs/glance
  1691. file_system: nfs
  1692. opts: rw,sync
  1693. File swap configuration:
  1694. .. code-block:: yaml
  1695. linux:
  1696. storage:
  1697. enabled: true
  1698. swap:
  1699. file:
  1700. enabled: true
  1701. engine: file
  1702. device: /swapfile
  1703. size: 1024
  1704. Partition swap configuration:
  1705. .. code-block:: yaml
  1706. linux:
  1707. storage:
  1708. enabled: true
  1709. swap:
  1710. partition:
  1711. enabled: true
  1712. engine: partition
  1713. device: /dev/vg0/swap
  1714. LVM group ``vg1`` with one device and ``data`` volume mounted
  1715. into ``/mnt/data``.
  1716. .. code-block:: yaml
  1717. parameters:
  1718. linux:
  1719. storage:
  1720. mount:
  1721. data:
  1722. enabled: true
  1723. device: /dev/vg1/data
  1724. file_system: ext4
  1725. path: /mnt/data
  1726. lvm:
  1727. vg1:
  1728. enabled: true
  1729. devices:
  1730. - /dev/sdb
  1731. volume:
  1732. data:
  1733. size: 40G
  1734. mount: ${linux:storage:mount:data}
  1735. Create partitions on disk. Specify size in MB. It expects empty
  1736. disk without any existing partitions.
  1737. Set ``startsector=1`` if you want to start partitions from ``2048``.
  1738. .. code-block:: yaml
  1739. linux:
  1740. storage:
  1741. disk:
  1742. first_drive:
  1743. startsector: 1
  1744. name: /dev/loop1
  1745. type: gpt
  1746. partitions:
  1747. - size: 200 #size in MB
  1748. type: fat32
  1749. - size: 300 #size in MB
  1750. mkfs: True
  1751. type: xfs
  1752. /dev/vda1:
  1753. partitions:
  1754. - size: 5
  1755. type: ext2
  1756. - size: 10
  1757. type: ext4
  1758. Multipath with Fujitsu Eternus DXL:
  1759. .. code-block:: yaml
  1760. parameters:
  1761. linux:
  1762. storage:
  1763. multipath:
  1764. enabled: true
  1765. blacklist_devices:
  1766. - /dev/sda
  1767. - /dev/sdb
  1768. backends:
  1769. - fujitsu_eternus_dxl
  1770. Multipath with Hitachi VSP 1000:
  1771. .. code-block:: yaml
  1772. parameters:
  1773. linux:
  1774. storage:
  1775. multipath:
  1776. enabled: true
  1777. blacklist_devices:
  1778. - /dev/sda
  1779. - /dev/sdb
  1780. backends:
  1781. - hitachi_vsp1000
  1782. Multipath with IBM Storwize:
  1783. .. code-block:: yaml
  1784. parameters:
  1785. linux:
  1786. storage:
  1787. multipath:
  1788. enabled: true
  1789. blacklist_devices:
  1790. - /dev/sda
  1791. - /dev/sdb
  1792. backends:
  1793. - ibm_storwize
  1794. Multipath with multiple backends:
  1795. .. code-block:: yaml
  1796. parameters:
  1797. linux:
  1798. storage:
  1799. multipath:
  1800. enabled: true
  1801. blacklist_devices:
  1802. - /dev/sda
  1803. - /dev/sdb
  1804. - /dev/sdc
  1805. - /dev/sdd
  1806. backends:
  1807. - ibm_storwize
  1808. - fujitsu_eternus_dxl
  1809. - hitachi_vsp1000
  1810. PAM LDAP integration:
  1811. .. code-block:: yaml
  1812. parameters:
  1813. linux:
  1814. system:
  1815. auth:
  1816. enabled: true
  1817. mkhomedir:
  1818. enabled: true
  1819. umask: 0027
  1820. ldap:
  1821. enabled: true
  1822. binddn: cn=bind,ou=service_users,dc=example,dc=com
  1823. bindpw: secret
  1824. uri: ldap://127.0.0.1
  1825. base: ou=users,dc=example,dc=com
  1826. ldap_version: 3
  1827. pagesize: 65536
  1828. referrals: off
  1829. filter:
  1830. passwd: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
  1831. shadow: (&(&(objectClass=person)(uidNumber=*))(unixHomeDirectory=*))
  1832. group: (&(objectClass=group)(gidNumber=*))
  1833. PAM duo 2FA integration
  1834. .. code-block:: yaml
  1835. parameters:
  1836. linux:
  1837. system:
  1838. auth:
  1839. enabled: true
  1840. duo:
  1841. enabled: true
  1842. duo_host: localhost
  1843. duo_ikey: DUO-INTEGRATION-KEY
  1844. duo_skey: DUO-SECRET-KEY
  1845. duo package version may be specified (optional)
  1846. .. code-block:: yaml
  1847. linux:
  1848. system:
  1849. package:
  1850. duo-unix:
  1851. version: 1.10.1-0
  1852. Disabled multipath (the default setup):
  1853. .. code-block:: yaml
  1854. parameters:
  1855. linux:
  1856. storage:
  1857. multipath:
  1858. enabled: false
  1859. Linux with local loopback device:
  1860. .. code-block:: yaml
  1861. linux:
  1862. storage:
  1863. loopback:
  1864. disk1:
  1865. file: /srv/disk1
  1866. size: 50G
  1867. External config generation
  1868. --------------------------
  1869. You are able to use config support metadata between formulas
  1870. and only generate configuration files for external use, for example, Docker, and so on.
  1871. .. code-block:: yaml
  1872. parameters:
  1873. linux:
  1874. system:
  1875. config:
  1876. pillar:
  1877. jenkins:
  1878. master:
  1879. home: /srv/volumes/jenkins
  1880. approved_scripts:
  1881. - method java.net.URL openConnection
  1882. credentials:
  1883. - type: username_password
  1884. scope: global
  1885. id: test
  1886. desc: Testing credentials
  1887. username: test
  1888. password: test
  1889. Netconsole Remote Kernel Logging
  1890. --------------------------------
  1891. Netconsole logger can be configured for the configfs-enabled kernels
  1892. (``CONFIG_NETCONSOLE_DYNAMIC`` must be enabled). The configuration
  1893. applies both in runtime (if network is already configured),
  1894. and on-boot after an interface initialization.
  1895. .. note::
  1896. * Receiver can be located only on the same L3 domain
  1897. (or you need to configure gateway MAC manually).
  1898. * The Receiver MAC is detected only on configuration time.
  1899. * Using broadcast MAC is not recommended.
  1900. .. code-block:: yaml
  1901. parameters:
  1902. linux:
  1903. system:
  1904. netconsole:
  1905. enabled: true
  1906. port: 514 (optional)
  1907. loglevel: debug (optional)
  1908. target:
  1909. 192.168.0.1:
  1910. interface: bond0
  1911. mac: "ff:ff:ff:ff:ff:ff" (optional)
  1912. Check network params on the environment
  1913. ---------------------------------------
  1914. Grab nics and nics states
  1915. .. code-block:: bash
  1916. salt osd001\* net_checks.get_nics
  1917. **Example of system output:**
  1918. .. code-block:: bash
  1919. osd001.domain.com:
  1920. |_
  1921. - bond0
  1922. - None
  1923. - 1e:c8:64:42:23:b9
  1924. - 0
  1925. - 1500
  1926. |_
  1927. - bond1
  1928. - None
  1929. - 3c:fd:fe:27:3b:00
  1930. - 1
  1931. - 9100
  1932. |_
  1933. - fourty1
  1934. - None
  1935. - 3c:fd:fe:27:3b:00
  1936. - 1
  1937. - 9100
  1938. |_
  1939. - fourty2
  1940. - None
  1941. - 3c:fd:fe:27:3b:02
  1942. - 1
  1943. - 9100
  1944. Grab 10G nics PCI addresses for hugepages setup
  1945. .. code-block:: bash
  1946. salt cmp001\* net_checks.get_ten_pci
  1947. **Example of system output:**
  1948. .. code-block:: bash
  1949. cmp001.domain.com:
  1950. |_
  1951. - ten1
  1952. - 0000:19:00.0
  1953. |_
  1954. - ten2
  1955. - 0000:19:00.1
  1956. |_
  1957. - ten3
  1958. - 0000:19:00.2
  1959. |_
  1960. - ten4
  1961. - 0000:19:00.3
  1962. Grab ip address for an interface
  1963. .. code-block:: bash
  1964. salt cmp001\* net_checks.get_ip iface=one4
  1965. **Example of system output:**
  1966. .. code-block:: bash
  1967. cmp001.domain.com:
  1968. 10.200.177.101
  1969. Grab ip addresses map
  1970. .. code-block:: bash
  1971. salt-call net_checks.nodes_addresses
  1972. **Example of system output:**
  1973. .. code-block:: bash
  1974. local:
  1975. |_
  1976. - cid01.domain.com
  1977. |_
  1978. |_
  1979. - pxe
  1980. - 10.200.177.91
  1981. |_
  1982. - control
  1983. - 10.200.178.91
  1984. |_
  1985. - cmn02.domain.com
  1986. |_
  1987. |_
  1988. - storage_access
  1989. - 10.200.181.67
  1990. |_
  1991. - pxe
  1992. - 10.200.177.67
  1993. |_
  1994. - control
  1995. - 10.200.178.67
  1996. |_
  1997. - cmp010.domain.com
  1998. |_
  1999. |_
  2000. - pxe
  2001. - 10.200.177.110
  2002. |_
  2003. - storage_access
  2004. - 10.200.181.110
  2005. |_
  2006. - control
  2007. - 10.200.178.110
  2008. |_
  2009. - vxlan
  2010. - 10.200.179.110
  2011. Verify full mesh connectivity
  2012. .. code-block:: bash
  2013. salt-call net_checks.ping_check
  2014. **Example of positive system output:**
  2015. .. code-block:: bash
  2016. ['PASSED']
  2017. [INFO ] ['PASSED']
  2018. local:
  2019. True
  2020. **Example of system output in case of failure:**
  2021. .. code-block:: bash
  2022. FAILED
  2023. [ERROR ] FAILED
  2024. ['control: 10.0.1.92 -> 10.0.1.224: Failed']
  2025. ['control: 10.0.1.93 -> 10.0.1.224: Failed']
  2026. ['control: 10.0.1.51 -> 10.0.1.224: Failed']
  2027. ['control: 10.0.1.102 -> 10.0.1.224: Failed']
  2028. ['control: 10.0.1.13 -> 10.0.1.224: Failed']
  2029. ['control: 10.0.1.81 -> 10.0.1.224: Failed']
  2030. local:
  2031. False
  2032. For this feature to work, please mark addresses with some role.
  2033. Otherwise 'default' role is assumed and mesh would consist of all
  2034. addresses on the environment.
  2035. Mesh mark is needed only for interfaces which are enabled and have
  2036. ip address assigned.
  2037. Checking dhcp pxe network meaningless, as it is used for salt
  2038. master vs minion communications, therefore treated as checked.
  2039. .. code-block:: yaml
  2040. parameters:
  2041. linux:
  2042. network:
  2043. interface:
  2044. ens3:
  2045. enabled: true
  2046. type: eth
  2047. proto: static
  2048. address: ${_param:deploy_address}
  2049. netmask: ${_param:deploy_network_netmask}
  2050. gateway: ${_param:deploy_network_gateway}
  2051. mesh: pxe
  2052. Check pillars for ip address duplicates
  2053. .. code-block:: bash
  2054. salt-call net_checks.verify_addresses
  2055. **Example of positive system output:**
  2056. .. code-block:: bash
  2057. ['PASSED']
  2058. [INFO ] ['PASSED']
  2059. local:
  2060. True
  2061. **Example of system output in case of failure:**
  2062. .. code-block:: bash
  2063. FAILED. Duplicates found
  2064. [ERROR ] FAILED. Duplicates found
  2065. ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
  2066. [ERROR ] ['gtw01.domain.com', 'gtw02.domain.com', '10.0.1.224']
  2067. local:
  2068. False
  2069. Generate csv report for the env
  2070. .. code-block:: bash
  2071. salt -C 'kvm* or cmp* or osd*' net_checks.get_nics_csv \
  2072. | grep '^\ ' | sed 's/\ *//g' | grep -Ev ^server \
  2073. | sed '1 i\server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr'
  2074. **Example of system output:**
  2075. .. code-block:: bash
  2076. server,nic_name,ip_addr,mac_addr,link,mtu,chassis_id,chassis_name,port_mac,port_descr
  2077. cmp010.domain.com,bond0,None,b4:96:91:10:5b:3a,1,1500,,,,
  2078. cmp010.domain.com,bond0.21,10.200.178.110,b4:96:91:10:5b:3a,1,1500,,,,
  2079. cmp010.domain.com,bond0.22,10.200.179.110,b4:96:91:10:5b:3a,1,1500,,,,
  2080. cmp010.domain.com,bond1,None,3c:fd:fe:34:ad:22,0,1500,,,,
  2081. cmp010.domain.com,bond1.24,10.200.181.110,3c:fd:fe:34:ad:22,0,1500,,,,
  2082. cmp010.domain.com,fourty5,None,3c:fd:fe:34:ad:20,0,9000,,,,
  2083. cmp010.domain.com,fourty6,None,3c:fd:fe:34:ad:22,0,9000,,,,
  2084. cmp010.domain.com,one1,None,b4:96:91:10:5b:38,0,1500,,,,
  2085. 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
  2086. 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
  2087. 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
  2088. cmp011.domain.com,bond0,None,b4:96:91:13:6c:aa,1,1500,,,,
  2089. cmp011.domain.com,bond0.21,10.200.178.111,b4:96:91:13:6c:aa,1,1500,,,,
  2090. cmp011.domain.com,bond0.22,10.200.179.111,b4:96:91:13:6c:aa,1,1500,,,,
  2091. ...
  2092. Usage
  2093. =====
  2094. Set MTU of the eth0 network interface to 1400:
  2095. .. code-block:: bash
  2096. ip link set dev eth0 mtu 1400
  2097. Read more
  2098. =========
  2099. * https://www.archlinux.org/
  2100. * http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
  2101. Documentation and Bugs
  2102. ======================
  2103. * http://salt-formulas.readthedocs.io/
  2104. Learn how to install and update salt-formulas.
  2105. * https://github.com/salt-formulas/salt-formula-linux/issues
  2106. In the unfortunate event that bugs are discovered, report the issue to the
  2107. appropriate issue tracker. Use the Github issue tracker for a specific salt
  2108. formula.
  2109. * https://launchpad.net/salt-formulas
  2110. For feature requests, bug reports, or blueprints affecting the entire
  2111. ecosystem, use the Launchpad salt-formulas project.
  2112. * https://launchpad.net/~salt-formulas-users
  2113. Join the salt-formulas-users team and subscribe to mailing list if required.
  2114. * https://github.com/salt-formulas/salt-formula-linux
  2115. Develop the salt-formulas projects in the master branch and then submit pull
  2116. requests against a specific formula.
  2117. * #salt-formulas @ irc.freenode.net
  2118. Use this IRC channel in case of any questions or feedback which is always
  2119. welcome.