Saltstack Official Linux Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 9 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. =====
  2. Linux
  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, sowe 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. Linux with package, latest version
  46. .. code-block:: yaml
  47. linux:
  48. system:
  49. ...
  50. package:
  51. package-name:
  52. version: latest
  53. Linux with package from certail repo, version with no upgrades
  54. .. code-block:: yaml
  55. linux:
  56. system:
  57. ...
  58. package:
  59. package-name:
  60. version: 2132.323
  61. repo: 'custom-repo'
  62. hold: true
  63. Linux with package from certail repo, version with no GPG verification
  64. .. code-block:: yaml
  65. linux:
  66. system:
  67. ...
  68. package:
  69. package-name:
  70. version: 2132.323
  71. repo: 'custom-repo'
  72. verify: false
  73. Linux with cron jobs
  74. .. code-block:: yaml
  75. linux:
  76. system:
  77. ...
  78. job:
  79. cmd1:
  80. command: '/cmd/to/run'
  81. enabled: true
  82. user: 'root'
  83. hour: 2
  84. minute: 0
  85. Linux security limits (limit sensu user memory usage to max 1GB):
  86. .. code-block:: yaml
  87. linux:
  88. system:
  89. ...
  90. limit:
  91. sensu:
  92. enabled: true
  93. domain: sensu
  94. limits:
  95. - type: hard
  96. item: as
  97. value: 1000000
  98. Enable autologin on tty1 (may work only for Ubuntu 14.04):
  99. .. code-block:: yaml
  100. linux:
  101. system:
  102. console:
  103. tty1:
  104. autologin: root
  105. # Enable serial console
  106. ttyS0:
  107. autologin: root
  108. rate: 115200
  109. term: xterm
  110. To disable set autologin to `false`.
  111. Set ``policy-rc.d`` on Debian-based systems. Action can be any available
  112. command in ``while true`` loop and ``case`` context.
  113. Following will disallow dpkg to stop/start services for cassandra package automatically:
  114. .. code-block:: yaml
  115. linux:
  116. system:
  117. policyrcd:
  118. - package: cassandra
  119. action: exit 101
  120. - package: '*'
  121. action: switch
  122. Set system locales:
  123. .. code-block:: yaml
  124. linux:
  125. system:
  126. locale:
  127. en_US.UTF-8:
  128. default: true
  129. "cs_CZ.UTF-8 UTF-8":
  130. enabled: true
  131. Kernel
  132. ~~~~~~
  133. Install always up to date LTS kernel and headers from Ubuntu trusty:
  134. .. code-block:: yaml
  135. linux:
  136. system:
  137. kernel:
  138. type: generic
  139. lts: trusty
  140. headers: true
  141. Install specific kernel version and ensure all other kernel packages are
  142. not present. Also install extra modules and headers for this kernel:
  143. .. code-block:: yaml
  144. linux:
  145. system:
  146. kernel:
  147. type: generic
  148. extra: true
  149. headers: true
  150. version: 4.2.0-22
  151. Systcl kernel parameters
  152. .. code-block:: yaml
  153. linux:
  154. system:
  155. kernel:
  156. sysctl:
  157. net.ipv4.tcp_keepalive_intvl: 3
  158. net.ipv4.tcp_keepalive_time: 30
  159. net.ipv4.tcp_keepalive_probes: 8
  160. CPU
  161. ~~~
  162. Disable ondemand cpu mode service:
  163. .. code-block:: yaml
  164. linux:
  165. system:
  166. cpu:
  167. governor: performance
  168. Huge Pages
  169. ~~~~~~~~~~~~
  170. Huge Pages give a performance boost to applications that intensively deal
  171. with memory allocation/deallocation by decreasing memory fragmentation.
  172. .. code-block:: yaml
  173. linux:
  174. system:
  175. kernel:
  176. hugepages:
  177. small:
  178. size: 2M
  179. count: 107520
  180. mount_point: /mnt/hugepages_2MB
  181. mount: false/true # default false
  182. large:
  183. default: true # default automatically mounted
  184. size: 1G
  185. count: 210
  186. mount_point: /mnt/hugepages_1GB
  187. Note: not recommended to use both pagesizes in concurrently.
  188. Intel SR-IOV
  189. ~~~~~~~~~~~~
  190. 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.
  191. .. code-block:: yaml
  192. linux:
  193. system:
  194. kernel:
  195. sriov: True
  196. unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
  197. rc:
  198. local: |
  199. #!/bin/sh -e
  200. # Enable 7 VF on eth1
  201. echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
  202. exit 0
  203. Repositories
  204. ~~~~~~~~~~~~
  205. RedHat based Linux with additional OpenStack repo
  206. .. code-block:: yaml
  207. linux:
  208. system:
  209. ...
  210. repo:
  211. rdo-icehouse:
  212. enabled: true
  213. source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
  214. pgpcheck: 0
  215. Ensure system repository to use czech Debian mirror (``default: true``)
  216. Also pin it's packages with priority 900.
  217. .. code-block:: yaml
  218. linux:
  219. system:
  220. repo:
  221. debian:
  222. default: true
  223. source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
  224. # Import signing key from URL if needed
  225. key_url: "http://dummy.com/public.gpg"
  226. pin:
  227. - pin: 'origin "ftp.cz.debian.org"'
  228. priority: 900
  229. package: '*'
  230. rc.local example
  231. .. code-block:: yaml
  232. linux:
  233. system:
  234. rc:
  235. local: |
  236. #!/bin/sh -e
  237. #
  238. # rc.local
  239. #
  240. # This script is executed at the end of each multiuser runlevel.
  241. # Make sure that the script will "exit 0" on success or any other
  242. # value on error.
  243. #
  244. # In order to enable or disable this script just change the execution
  245. # bits.
  246. #
  247. # By default this script does nothing.
  248. exit 0
  249. Prompt
  250. ~~~~~~
  251. Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every
  252. user can have different prompt.
  253. .. code-block:: yaml
  254. linux:
  255. system:
  256. prompt:
  257. 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\\]
  258. default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
  259. On Debian systems to set prompt system-wide it's necessary to remove setting
  260. PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from
  261. ``/etc/skel/.bashrc``). This formula will do this automatically, but will not
  262. touch existing user's ``~/.bashrc`` files except root.
  263. Bash
  264. ~~~~
  265. Fix bash configuration to preserve history across sessions (like ZSH does by
  266. default).
  267. .. code-block:: yaml
  268. linux:
  269. system:
  270. bash:
  271. preserve_history: true
  272. Message of the day
  273. ~~~~~~~~~~~~~~~~~~
  274. ``pam_motd`` from package ``update-motd`` is used for dynamic messages of the
  275. day. Setting custom motd will cleanup existing ones.
  276. .. code-block:: yaml
  277. linux:
  278. system:
  279. motd:
  280. - release: |
  281. #!/bin/sh
  282. [ -r /etc/lsb-release ] && . /etc/lsb-release
  283. if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
  284. # Fall back to using the very slow lsb_release utility
  285. DISTRIB_DESCRIPTION=$(lsb_release -s -d)
  286. fi
  287. printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
  288. - warning: |
  289. #!/bin/sh
  290. printf "This is [company name] network.\n"
  291. printf "Unauthorized access strictly prohibited.\n"
  292. RHEL / CentOS
  293. ^^^^^^^^^^^^^
  294. Unfortunately ``update-motd`` is currently not available for RHEL so there's
  295. no native support for dynamic motd.
  296. You can still set static one, only pillar structure differs:
  297. .. code-block:: yaml
  298. linux:
  299. system:
  300. motd: |
  301. This is [company name] network.
  302. Unauthorized access strictly prohibited.
  303. Haveged
  304. ~~~~~~~
  305. If you are running headless server and are low on entropy, it may be a good
  306. idea to setup Haveged.
  307. .. code-block:: yaml
  308. linux:
  309. system:
  310. haveged:
  311. enabled: true
  312. Linux network
  313. -------------
  314. Linux with network manager
  315. .. code-block:: yaml
  316. linux:
  317. network:
  318. enabled: true
  319. network_manager: true
  320. Linux with default static network interfaces, default gateway interface and DNS servers
  321. .. code-block:: yaml
  322. linux:
  323. network:
  324. enabled: true
  325. interface:
  326. eth0:
  327. enabled: true
  328. type: eth
  329. address: 192.168.0.102
  330. netmask: 255.255.255.0
  331. gateway: 192.168.0.1
  332. name_servers:
  333. - 8.8.8.8
  334. - 8.8.4.4
  335. mtu: 1500
  336. Linux with bonded interfaces and disabled NetworkManager
  337. .. code-block:: yaml
  338. linux:
  339. network:
  340. enabled: true
  341. interface:
  342. eth0:
  343. type: eth
  344. ...
  345. eth1:
  346. type: eth
  347. ...
  348. bond0:
  349. enabled: true
  350. type: bond
  351. address: 192.168.0.102
  352. netmask: 255.255.255.0
  353. mtu: 1500
  354. use_in:
  355. - interface: ${linux:interface:eth0}
  356. - interface: ${linux:interface:eth0}
  357. network_manager:
  358. disable: true
  359. Linux with vlan interface_params
  360. .. code-block:: yaml
  361. linux:
  362. network:
  363. enabled: true
  364. interface:
  365. vlan69:
  366. type: vlan
  367. use_interfaces:
  368. - interface: ${linux:interface:bond0}
  369. Linux with wireless interface parameters
  370. .. code-block:: yaml
  371. linux:
  372. network:
  373. enabled: true
  374. gateway: 10.0.0.1
  375. default_interface: eth0
  376. interface:
  377. wlan0:
  378. type: eth
  379. wireless:
  380. essid: example
  381. key: example_key
  382. security: wpa
  383. priority: 1
  384. Linux networks with routes defined
  385. .. code-block:: yaml
  386. linux:
  387. network:
  388. enabled: true
  389. gateway: 10.0.0.1
  390. default_interface: eth0
  391. interface:
  392. eth0:
  393. type: eth
  394. route:
  395. default:
  396. address: 192.168.0.123
  397. netmask: 255.255.255.0
  398. gateway: 192.168.0.1
  399. Native Linux Bridges
  400. .. code-block:: yaml
  401. linux:
  402. network:
  403. interface:
  404. eth1:
  405. enabled: true
  406. type: eth
  407. proto: manual
  408. up_cmds:
  409. - ip address add 0/0 dev $IFACE
  410. - ip link set $IFACE up
  411. down_cmds:
  412. - ip link set $IFACE down
  413. br-ex:
  414. enabled: true
  415. type: bridge
  416. address: ${linux:network:host:public_local:address}
  417. netmask: 255.255.255.0
  418. use_interfaces:
  419. - eth1
  420. OpenVswitch Bridges
  421. .. code-block:: yaml
  422. linux:
  423. network:
  424. bridge: openvswitch
  425. interface:
  426. eth1:
  427. enabled: true
  428. type: eth
  429. proto: manual
  430. up_cmds:
  431. - ip address add 0/0 dev $IFACE
  432. - ip link set $IFACE up
  433. down_cmds:
  434. - ip link set $IFACE down
  435. br-ex:
  436. enabled: true
  437. type: bridge
  438. address: ${linux:network:host:public_local:address}
  439. netmask: 255.255.255.0
  440. use_interfaces:
  441. - eth1
  442. Linux with proxy
  443. .. code-block:: yaml
  444. linux:
  445. network:
  446. ...
  447. proxy:
  448. host: proxy.domain.com
  449. port: 3128
  450. Linux with hosts
  451. Parameter purge_hosts will enforce whole /etc/hosts file, removing entries
  452. that are not defined in model except defaults for both IPv4 and IPv6 localhost
  453. and hostname + fqdn.
  454. It's good to use this option if you want to ensure /etc/hosts is always in a
  455. clean state however it's not enabled by default for safety.
  456. .. code-block:: yaml
  457. linux:
  458. network:
  459. ...
  460. purge_hosts: true
  461. host:
  462. # No need to define this one if purge_hosts is true
  463. hostname:
  464. address: 127.0.1.1
  465. names:
  466. - ${linux:network:fqdn}
  467. - ${linux:network:hostname}
  468. node1:
  469. address: 192.168.10.200
  470. names:
  471. - node2.domain.com
  472. - service2.domain.com
  473. node2:
  474. address: 192.168.10.201
  475. names:
  476. - node2.domain.com
  477. - service2.domain.com
  478. Setup resolv.conf, nameservers, domain and search domains
  479. .. code-block:: yaml
  480. linux:
  481. network:
  482. resolv:
  483. dns:
  484. - 8.8.4.4
  485. - 8.8.8.8
  486. domain: my.example.com
  487. search:
  488. - my.example.com
  489. - example.com
  490. options:
  491. - ndots:5
  492. - timeout:2
  493. - attempts:2
  494. Linux storage pillars
  495. ---------------------
  496. Linux with mounted Samba
  497. .. code-block:: yaml
  498. linux:
  499. storage:
  500. enabled: true
  501. mount:
  502. samba1:
  503. - enabled: true
  504. - path: /media/myuser/public/
  505. - device: //192.168.0.1/storage
  506. - file_system: cifs
  507. - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
  508. Linux with file swap
  509. .. code-block:: yaml
  510. linux:
  511. storage:
  512. enabled: true
  513. swap:
  514. file:
  515. enabled: true
  516. engine: file
  517. device: /swapfile
  518. size: 1024
  519. Linux with partition swap
  520. .. code-block:: yaml
  521. linux:
  522. storage:
  523. enabled: true
  524. swap:
  525. partition:
  526. enabled: true
  527. engine: partition
  528. device: /dev/vg0/swap
  529. LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
  530. .. code-block:: yaml
  531. parameters:
  532. linux:
  533. storage:
  534. mount:
  535. data:
  536. enabled: true
  537. device: /dev/vg1/data
  538. file_system: ext4
  539. path: /mnt/data
  540. lvm:
  541. vg1:
  542. enabled: true
  543. devices:
  544. - /dev/sdb
  545. volume:
  546. data:
  547. size: 40G
  548. mount: ${linux:storage:mount:data}
  549. Multipath with Fujitsu Eternus DXL
  550. .. code-block:: yaml
  551. parameters:
  552. linux:
  553. storage:
  554. multipath:
  555. enabled: true
  556. blacklist_devices:
  557. - /dev/sda
  558. - /dev/sdb
  559. backends:
  560. - fujitsu_eternus_dxl
  561. Multipath with Hitachi VSP 1000
  562. .. code-block:: yaml
  563. parameters:
  564. linux:
  565. storage:
  566. multipath:
  567. enabled: true
  568. blacklist_devices:
  569. - /dev/sda
  570. - /dev/sdb
  571. backends:
  572. - hitachi_vsp1000
  573. Multipath with IBM Storwize
  574. .. code-block:: yaml
  575. parameters:
  576. linux:
  577. storage:
  578. multipath:
  579. enabled: true
  580. blacklist_devices:
  581. - /dev/sda
  582. - /dev/sdb
  583. backends:
  584. - ibm_storwize
  585. Multipath with multiple backends
  586. .. code-block:: yaml
  587. parameters:
  588. linux:
  589. storage:
  590. multipath:
  591. enabled: true
  592. blacklist_devices:
  593. - /dev/sda
  594. - /dev/sdb
  595. - /dev/sdc
  596. - /dev/sdd
  597. backends:
  598. - ibm_storwize
  599. - fujitsu_eternus_dxl
  600. - hitachi_vsp1000
  601. Disabled multipath (the default setup)
  602. .. code-block:: yaml
  603. parameters:
  604. linux:
  605. storage:
  606. multipath:
  607. enabled: false
  608. Linux with local loopback device
  609. .. code-block:: yaml
  610. linux:
  611. storage:
  612. loopback:
  613. disk1:
  614. file: /srv/disk1
  615. size: 50G
  616. External config generation
  617. --------------------------
  618. You are able to use config support metadata between formulas and only generate
  619. config files for external use, eg. docker, etc.
  620. .. code-block:: yaml
  621. parameters:
  622. linux:
  623. system:
  624. config:
  625. pillar:
  626. jenkins:
  627. master:
  628. home: /srv/volumes/jenkins
  629. approved_scripts:
  630. - method java.net.URL openConnection
  631. credentials:
  632. - type: username_password
  633. scope: global
  634. id: test
  635. desc: Testing credentials
  636. username: test
  637. password: test
  638. Usage
  639. =====
  640. Set mtu of network interface eth0 to 1400
  641. .. code-block:: bash
  642. ip link set dev eth0 mtu 1400
  643. Read more
  644. =========
  645. * https://www.archlinux.org/
  646. * http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu
  647. Documentation and Bugs
  648. ======================
  649. To learn how to install and update salt-formulas, consult the documentation
  650. available online at:
  651. http://salt-formulas.readthedocs.io/
  652. In the unfortunate event that bugs are discovered, they should be reported to
  653. the appropriate issue tracker. Use Github issue tracker for specific salt
  654. formula:
  655. https://github.com/salt-formulas/salt-formula-linux/issues
  656. For feature requests, bug reports or blueprints affecting entire ecosystem,
  657. use Launchpad salt-formulas project:
  658. https://launchpad.net/salt-formulas
  659. You can also join salt-formulas-users team and subscribe to mailing list:
  660. https://launchpad.net/~salt-formulas-users
  661. Developers wishing to work on the salt-formulas projects should always base
  662. their work on master branch and submit pull request against specific formula.
  663. https://github.com/salt-formulas/salt-formula-linux
  664. Any questions or feedback is always welcome so feel free to join our IRC
  665. channel:
  666. #salt-formulas @ irc.freenode.net