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

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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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. To disable set autologin to `false`.
  106. Kernel
  107. ~~~~~~
  108. Install always up to date LTS kernel and headers from Ubuntu trusty:
  109. .. code-block:: yaml
  110. linux:
  111. system:
  112. kernel:
  113. type: generic
  114. lts: trusty
  115. headers: true
  116. Install specific kernel version and ensure all other kernel packages are
  117. not present. Also install extra modules and headers for this kernel:
  118. .. code-block:: yaml
  119. linux:
  120. system:
  121. kernel:
  122. type: generic
  123. extra: true
  124. headers: true
  125. version: 4.2.0-22
  126. Repositories
  127. ~~~~~~~~~~~~
  128. RedHat based Linux with additional OpenStack repo
  129. .. code-block:: yaml
  130. linux:
  131. system:
  132. ...
  133. repo:
  134. rdo-icehouse:
  135. enabled: true
  136. source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
  137. pgpcheck: 0
  138. Ensure system repository to use czech Debian mirror (``default: true``)
  139. Also pin it's packages with priority 900.
  140. .. code-block:: yaml
  141. linux:
  142. system:
  143. repo:
  144. debian:
  145. default: true
  146. source: "deb http://ftp.cz.debian.org/debian/ jessie main contrib non-free"
  147. # Import signing key from URL if needed
  148. key_url: "http://dummy.com/public.gpg"
  149. pin:
  150. - pin: 'origin "ftp.cz.debian.org"'
  151. priority: 900
  152. package: '*'
  153. rc.local example
  154. .. code-block:: yaml
  155. linux:
  156. system:
  157. rc:
  158. local: |
  159. #!/bin/sh -e
  160. #
  161. # rc.local
  162. #
  163. # This script is executed at the end of each multiuser runlevel.
  164. # Make sure that the script will "exit 0" on success or any other
  165. # value on error.
  166. #
  167. # In order to enable or disable this script just change the execution
  168. # bits.
  169. #
  170. # By default this script does nothing.
  171. exit 0
  172. Prompt
  173. ~~~~~~
  174. Setting prompt is implemented by creating ``/etc/profile.d/prompt.sh``. Every
  175. user can have different prompt.
  176. .. code-block:: yaml
  177. linux:
  178. system:
  179. prompt:
  180. 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\\]
  181. default: \\n\\D{%y/%m/%d %H:%M:%S} $(hostname -f)\\n[\\u@\\h:\\w]
  182. On Debian systems to set prompt system-wide it's necessary to remove setting
  183. PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from
  184. ``/etc/skel/.bashrc``). This formula will do this automatically, but will not
  185. touch existing user's ``~/.bashrc`` files except root.
  186. Message of the day
  187. ~~~~~~~~~~~~~~~~~~
  188. ``pam_motd`` from package ``update-motd`` is used for dynamic messages of the
  189. day. Setting custom motd will cleanup existing ones.
  190. .. code-block:: yaml
  191. linux:
  192. system:
  193. motd:
  194. - release: |
  195. #!/bin/sh
  196. [ -r /etc/lsb-release ] && . /etc/lsb-release
  197. if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
  198. # Fall back to using the very slow lsb_release utility
  199. DISTRIB_DESCRIPTION=$(lsb_release -s -d)
  200. fi
  201. printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
  202. - warning: |
  203. #!/bin/sh
  204. printf "This is [company name] network.\n"
  205. printf "Unauthorized access strictly prohibited.\n"
  206. Linux network
  207. -------------
  208. Linux with network manager
  209. .. code-block:: yaml
  210. linux:
  211. network:
  212. enabled: true
  213. network_manager: true
  214. Linux with default static network interfaces, default gateway interface and DNS servers
  215. .. code-block:: yaml
  216. linux:
  217. network:
  218. enabled: true
  219. interface:
  220. eth0:
  221. enabled: true
  222. type: eth
  223. address: 192.168.0.102
  224. netmask: 255.255.255.0
  225. gateway: 192.168.0.1
  226. name_servers:
  227. - 8.8.8.8
  228. - 8.8.4.4
  229. mtu: 1500
  230. Linux with bonded interfaces and disabled NetworkManager
  231. .. code-block:: yaml
  232. linux:
  233. network:
  234. enabled: true
  235. interface:
  236. eth0:
  237. type: eth
  238. ...
  239. eth1:
  240. type: eth
  241. ...
  242. bond0:
  243. enabled: true
  244. type: bond
  245. address: 192.168.0.102
  246. netmask: 255.255.255.0
  247. mtu: 1500
  248. use_in:
  249. - interface: ${linux:interface:eth0}
  250. - interface: ${linux:interface:eth0}
  251. network_manager:
  252. disable: true
  253. Linux with vlan interface_params
  254. .. code-block:: yaml
  255. linux:
  256. network:
  257. enabled: true
  258. interface:
  259. vlan69:
  260. type: vlan
  261. use_interfaces:
  262. - interface: ${linux:interface:bond0}
  263. Linux with wireless interface parameters
  264. .. code-block:: yaml
  265. linux:
  266. network:
  267. enabled: true
  268. gateway: 10.0.0.1
  269. default_interface: eth0
  270. interface:
  271. wlan0:
  272. type: eth
  273. wireless:
  274. essid: example
  275. key: example_key
  276. security: wpa
  277. priority: 1
  278. Linux networks with routes defined
  279. .. code-block:: yaml
  280. linux:
  281. network:
  282. enabled: true
  283. gateway: 10.0.0.1
  284. default_interface: eth0
  285. interface:
  286. eth0:
  287. type: eth
  288. route:
  289. default:
  290. address: 192.168.0.123
  291. netmask: 255.255.255.0
  292. gateway: 192.168.0.1
  293. Native Linux Bridges
  294. .. code-block:: yaml
  295. linux:
  296. network:
  297. interface:
  298. eth1:
  299. enabled: true
  300. type: eth
  301. proto: manual
  302. up_cmds:
  303. - ip address add 0/0 dev $IFACE
  304. - ip link set $IFACE up
  305. down_cmds:
  306. - ip link set $IFACE down
  307. br-ex:
  308. enabled: true
  309. type: bridge
  310. address: ${linux:network:host:public_local:address}
  311. netmask: 255.255.255.0
  312. use_interfaces:
  313. - eth1
  314. OpenVswitch Bridges
  315. .. code-block:: yaml
  316. linux:
  317. network:
  318. bridge: openvswitch
  319. interface:
  320. eth1:
  321. enabled: true
  322. type: eth
  323. proto: manual
  324. up_cmds:
  325. - ip address add 0/0 dev $IFACE
  326. - ip link set $IFACE up
  327. down_cmds:
  328. - ip link set $IFACE down
  329. br-ex:
  330. enabled: true
  331. type: bridge
  332. address: ${linux:network:host:public_local:address}
  333. netmask: 255.255.255.0
  334. use_interfaces:
  335. - eth1
  336. Linux with proxy
  337. .. code-block:: yaml
  338. linux:
  339. network:
  340. ...
  341. proxy:
  342. host: proxy.domain.com
  343. port: 3128
  344. Linux with hosts
  345. .. code-block:: yaml
  346. linux:
  347. network:
  348. ...
  349. host:
  350. node1:
  351. address: 192.168.10.200
  352. names:
  353. - node2.domain.com
  354. - service2.domain.com
  355. node2:
  356. address: 192.168.10.201
  357. names:
  358. - node2.domain.com
  359. - service2.domain.com
  360. Setup resolv.conf, nameservers, domain and search domains
  361. .. code-block:: yaml
  362. linux:
  363. network:
  364. resolv:
  365. dns:
  366. - 8.8.4.4
  367. - 8.8.8.8
  368. domain: my.example.com
  369. search:
  370. - my.example.com
  371. - example.com
  372. Linux storage pillars
  373. ---------------------
  374. Linux with mounted Samba
  375. .. code-block:: yaml
  376. linux:
  377. storage:
  378. enabled: true
  379. mount:
  380. samba1:
  381. - path: /media/myuser/public/
  382. - device: //192.168.0.1/storage
  383. - file_system: cifs
  384. - options: guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm
  385. Linux with file swap
  386. .. code-block:: yaml
  387. linux:
  388. storage:
  389. enabled: true
  390. swap:
  391. file:
  392. enabled: true
  393. engine: file
  394. device: /swapfile
  395. size: 1024
  396. Linux with partition swap
  397. .. code-block:: yaml
  398. linux:
  399. storage:
  400. enabled: true
  401. swap:
  402. partition:
  403. enabled: true
  404. engine: partition
  405. device: /dev/vg0/swap
  406. LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
  407. .. code-block:: yaml
  408. parameters:
  409. linux:
  410. storage:
  411. mount:
  412. data:
  413. device: /dev/vg1/data
  414. file_system: ext4
  415. path: /mnt/data
  416. lvm:
  417. vg1:
  418. enabled: true
  419. devices:
  420. - /dev/sdb
  421. volume:
  422. data:
  423. size: 40G
  424. mount: ${linux:storage:mount:data}
  425. Usage
  426. =====
  427. Set mtu of network interface eth0 to 1400
  428. .. code-block:: bash
  429. ip link set dev eth0 mtu 1400
  430. Read more
  431. =========
  432. * https://www.archlinux.org/
  433. * http://askubuntu.com/questions/175172/how-do-i-configure-proxies-in-ubuntu-server-or-minimal-cli-ubuntu