1
0

salt.tex 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. \documentclass[landscape,a4paper,10pt]{article}
  2. \usepackage{multicol}
  3. \usepackage[landscape]{geometry}
  4. \usepackage{concmath}
  5. \usepackage[T1]{fontenc}
  6. \geometry{top=.5in,left=.5in,right=.5in,bottom=.5in}
  7. \pagestyle{empty}
  8. \setcounter{secnumdepth}{0}
  9. \setlength\columnseprule{.4pt}
  10. \setlength{\parindent}{0pt}
  11. \setlength{\parskip}{0pt plus 0.5ex}
  12. \begin{document}
  13. \begin{multicols}{3}
  14. \bfseries{\Huge{Salt States}}\\[-0.3cm]
  15. \line(1,0){125}\\
  16. \bfseries{\LARGE{top.sls}}
  17. The \texttt{top.sls} file is used to map what SLS modules get loaded onto what minions via the state system.\\
  18. It is located in the file defined in the \texttt{file_roots} variable of the
  19. salt master configuration file which is found in
  20. \texttt{CONFIG_DIR}/master.
  21. The file roots is defined like this by default.
  22. \begin{verbatim}
  23. file_roots:
  24. base:
  25. - /srv/salt
  26. \end{verbatim}
  27. Here is an example \texttt{top.sls} file which uses \texttt{pkg}, \texttt{file} and \texttt{service} states:
  28. \begin{verbatim}
  29. apache:
  30. pkg:
  31. - installed
  32. - version: 2.2.23
  33. service:
  34. - running
  35. - enable: True
  36. /var/www/index.html: # ID declaration
  37. file: # state declaration
  38. - managed # function
  39. - source: salt://webserver/index.html
  40. - user: root
  41. - group: root
  42. - mode: 644
  43. - require: # requisite declaration
  44. - pkg: apache # requisite reference
  45. \end{verbatim}
  46. \bfseries{\LARGE{file}}
  47. Manages files.
  48. FUNCTIONS
  49. \begin{itemize}
  50. \item \texttt{absent} -- verify that a file or directory is absent
  51. \item \texttt{accumulated} -- prepare accumulator which can be used for template in \texttt{file.managed}
  52. \item \texttt{append} -- put some text at the end of file
  53. \item \texttt{comment} -- comment out some lines
  54. \item \texttt{directory} -- ensure that a directory is present
  55. \item \texttt{exists} -- ensure that a directory or file is present
  56. \item \texttt{managed} -- this file is managed by the salt master and can be run through templating system
  57. \item \texttt{patch} -- apply a patch to a file
  58. \item \texttt{recurse} -- recurse through a subdirectory on master
  59. \item \texttt{rename} -- rename a file
  60. \item \texttt{sed} -- edit a file
  61. \item \texttt{symlink} -- create a symlink
  62. \item \texttt{touch} -- create an empty file or update the access and modification time
  63. \item \texttt{uncomment} -- uncomment lines in a file
  64. \end{itemize}
  65. \begin{verbatim}
  66. /etc/http/conf/http.conf:
  67. file.managed:
  68. - source: salt://apache/http.conf
  69. - user: root
  70. - group: root
  71. - mode: 644
  72. - template: jinja
  73. - context:
  74. custom_var: "override"
  75. - defaults:
  76. custom_var: "default value"
  77. other_var: 123
  78. \end{verbatim}
  79. \bfseries{\LARGE{pkg}}
  80. Manage software packages.
  81. FUNCTIONS
  82. \begin{itemize}
  83. \item \texttt{installed} -- verify if a package is installed
  84. \item \texttt{latest} -- verify that the package is the latest version
  85. \item \texttt{purged}
  86. \item \texttt{removed} -- verify if the package is removed
  87. \end{itemize}
  88. \begin{verbatim}
  89. httpd:
  90. pkg:
  91. - installed
  92. - repo: mycustomrepo
  93. - skip_verify: True
  94. - version: 2.0.6~ubuntu3
  95. \end{verbatim}
  96. \bfseries{\LARGE{service}}
  97. Manage system daemons/services.
  98. FUNCTIONS
  99. \begin{itemize}
  100. \item \texttt{dead}
  101. \item \texttt{disabled}
  102. \item \texttt{enabled}
  103. \item \texttt{mod\_watch}
  104. \item \texttt{running}
  105. \end{itemize}
  106. \begin{verbatim}
  107. apache:
  108. service:
  109. - running
  110. - name: httpd
  111. - enable: True
  112. - sig: httpd
  113. \end{verbatim}
  114. \bfseries{\LARGE{cmd}}
  115. Execution of arbitrary commands.
  116. FUNCTIONS
  117. \begin{itemize}
  118. \item \texttt{mod\_watch}
  119. \item \texttt{run}
  120. \item \texttt{script}
  121. \item \texttt{wait}
  122. \item \texttt{wait\_script}
  123. \end{itemize}
  124. \begin{verbatim}
  125. date > /tmp/salt-run:
  126. cmd:
  127. - run
  128. \end{verbatim}
  129. \bfseries{\LARGE{cron}}
  130. Manage cron jobs (scheduler).
  131. \begin{verbatim}
  132. date > /tmp/crontest:
  133. cron.present:
  134. - user: root
  135. - minute: 7
  136. - hour: 2
  137. \end{verbatim}
  138. FUNCTIONS
  139. \begin{itemize}
  140. \item \texttt{absent}
  141. \item \texttt{file} -- provides file.managed-like functionality (templating, etc.) for a pre-made crontab file, to be assigned to a given user
  142. \item \texttt{present}
  143. \end{itemize}
  144. \bfseries{\LARGE{user}}
  145. The user module is used to create and manage user settings, users can be set as either absent or present.
  146. \begin{verbatim}
  147. fred:
  148. user.present:
  149. - fullname: Fred Jones
  150. - shell: /bin/zsh
  151. - home: /home/fred
  152. - uid: 4000
  153. - gid: 4000
  154. - groups:
  155. - wheel
  156. - storage
  157. - games
  158. testuser:
  159. user.absent
  160. \end{verbatim}
  161. FUNCTIONS
  162. \bfseries{\LARGE{group}}
  163. The group module is used to create and manage unix group settings, groups can be either present or absent.
  164. FUNCTIONS
  165. \begin{itemize}
  166. \item \texttt{present}
  167. \item \texttt{absent}
  168. \end{itemize}
  169. \begin{verbatim}
  170. cheese:
  171. group.present:
  172. - gid: 7648
  173. - system: True
  174. \end{verbatim}
  175. \bfseries{\LARGE{git}}
  176. Interaction with Git repositories.
  177. \begin{verbatim}
  178. https://github.com/saltstack/salt.git:
  179. git.latest:
  180. - rev: develop
  181. - target: /tmp/salt
  182. \end{verbatim}
  183. \bfseries{\LARGE{host}}
  184. Management of addresses and names in hosts file.
  185. \begin{verbatim}
  186. salt-master:
  187. host.present:
  188. - ip: 192.168.0.42
  189. \end{verbatim}
  190. \bfseries{\LARGE{kmod}}
  191. Loading and unloading of kernel modules.
  192. \begin{verbatim}
  193. kvm_amd:
  194. kmod.present
  195. pcspkr:
  196. kmod.absent
  197. \end{verbatim}
  198. \bfseries{\LARGE{mount}}
  199. Mounting of filesystems.
  200. \begin{verbatim}
  201. /mnt/sdb:
  202. mount.mounted:
  203. - device: /dev/sdb1
  204. - fstype: ext4
  205. - mkmnt: True
  206. - opts:
  207. - defaults
  208. \end{verbatim}
  209. \bfseries{\LARGE{sysctl}}
  210. Configuration of the Linux kernel using sysctl.
  211. \begin{verbatim}
  212. vm.swappiness:
  213. sysctl.present:
  214. - value: 20
  215. \end{verbatim}
  216. \end{multicols}
  217. \end{document}