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 32KB

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