New version of salt-formula from Saltstack
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 12KB

9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
8 yıl önce
8 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
8 yıl önce
9 yıl önce
8 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
8 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
8 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
9 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. ============
  2. Salt Formula
  3. ============
  4. Salt is a new approach to infrastructure management. Easy enough to get
  5. running in minutes, scalable enough to manage tens of thousands of servers,
  6. and fast enough to communicate with them in seconds.
  7. Salt delivers a dynamic communication bus for infrastructures that can be used
  8. for orchestration, remote execution, configuration management and much more.
  9. Sample Metadata
  10. ===============
  11. Salt master
  12. -----------
  13. Salt master with base formulas and pillar metadata backend
  14. .. literalinclude:: tests/pillar/master_single_pillar.sls
  15. :language: yaml
  16. Salt master with reclass ENC metadata backend
  17. .. literalinclude:: tests/pillar/master_single_reclass.sls
  18. :language: yaml
  19. Salt master with API
  20. .. literalinclude:: tests/pillar/master_api.sls
  21. :language: yaml
  22. Salt master with defined user ACLs
  23. .. literalinclude:: tests/pillar/master_acl.sls
  24. :language: yaml
  25. Salt master with preset minions
  26. .. code-block:: yaml
  27. salt:
  28. master:
  29. enabled: true
  30. minions:
  31. - name: 'node1.system.location.domain.com'
  32. Salt master with pip based installation (optional)
  33. .. code-block:: yaml
  34. salt:
  35. master:
  36. enabled: true
  37. ...
  38. source:
  39. engine: pip
  40. version: 2016.3.0rc2
  41. Install formula through system package management
  42. .. code-block:: yaml
  43. salt:
  44. master:
  45. enabled: true
  46. ...
  47. environment:
  48. prd:
  49. keystone:
  50. source: pkg
  51. name: salt-formula-keystone
  52. nova:
  53. source: pkg
  54. name: salt-formula-keystone
  55. version: 0.1+0~20160818133412.24~1.gbp6e1ebb
  56. postresql:
  57. source: pkg
  58. name: salt-formula-postgresql
  59. version: purged
  60. Formula keystone is installed latest version and the formulas without version are installed in one call to aptpkg module.
  61. If the version attribute is present sls iterates over formulas and take action to install specific version or remove it.
  62. The version attribute may have these values ``[latest|purged|removed|<VERSION>]``.
  63. Clone master branch of keystone formula as local feature branch
  64. .. code-block:: yaml
  65. salt:
  66. master:
  67. enabled: true
  68. ...
  69. environment:
  70. dev:
  71. formula:
  72. keystone:
  73. source: git
  74. address: git@github.com:openstack/salt-formula-keystone.git
  75. revision: master
  76. branch: feature
  77. Salt master with specified formula refs (for example for Gerrit review)
  78. .. code-block:: yaml
  79. salt:
  80. master:
  81. enabled: true
  82. ...
  83. environment:
  84. dev:
  85. formula:
  86. keystone:
  87. source: git
  88. address: https://git.openstack.org/openstack/salt-formula-keystone
  89. revision: refs/changes/56/123456/1
  90. Salt master with logging handlers
  91. .. code-block:: yaml
  92. salt:
  93. master:
  94. enabled: true
  95. handler:
  96. handler01:
  97. engine: udp
  98. bind:
  99. host: 127.0.0.1
  100. port: 9999
  101. minion:
  102. handler:
  103. handler01:
  104. engine: udp
  105. bind:
  106. host: 127.0.0.1
  107. port: 9999
  108. handler02:
  109. engine: zmq
  110. bind:
  111. host: 127.0.0.1
  112. port: 9999
  113. Salt engine definition for saltgraph metadata collector
  114. .. code-block:: yaml
  115. salt:
  116. master:
  117. engine:
  118. graph_metadata:
  119. engine: saltgraph
  120. host: 127.0.0.1
  121. port: 5432
  122. user: salt
  123. password: salt
  124. database: salt
  125. Salt engine definition for sending events from docker events
  126. .. code-block:: yaml
  127. salt:
  128. master:
  129. engine:
  130. docker_events:
  131. docker_url: unix://var/run/docker.sock
  132. Salt master peer setup for remote certificate signing
  133. .. code-block:: yaml
  134. salt:
  135. master:
  136. peer:
  137. ".*":
  138. - x509.sign_remote_certificate
  139. Configure verbosity of state output (used for `salt` command)
  140. .. code-block:: yaml
  141. salt:
  142. master:
  143. state_output: changes
  144. Salt synchronise node pillar and modules after start
  145. .. code-block:: yaml
  146. salt:
  147. master:
  148. reactor:
  149. salt/minion/*/start:
  150. - salt://salt/reactor/node_start.sls
  151. Trigger basic node install
  152. .. code-block:: yaml
  153. salt:
  154. master:
  155. reactor:
  156. salt/minion/install:
  157. - salt://salt/reactor/node_install.sls
  158. Sample event to trigger the node installation
  159. .. code-block:: bash
  160. salt-call event.send 'salt/minion/install'
  161. Run any defined orchestration pipeline
  162. .. code-block:: yaml
  163. salt:
  164. master:
  165. reactor:
  166. salt/orchestrate/start:
  167. - salt://salt/reactor/orchestrate_start.sls
  168. Event to trigger the orchestration pipeline
  169. .. code-block:: bash
  170. salt-call event.send 'salt/orchestrate/start' "{'orchestrate': 'salt/orchestrate/infra_install.sls'}"
  171. Synchronise modules and pillars on minion start.
  172. .. code-block:: yaml
  173. salt:
  174. master:
  175. reactor:
  176. 'salt/minion/*/start':
  177. - salt://salt/reactor/minion_start.sls
  178. Add and/or remove the minion key
  179. .. code-block:: yaml
  180. salt:
  181. master:
  182. reactor:
  183. salt/key/create:
  184. - salt://salt/reactor/key_create.sls
  185. salt/key/remove:
  186. - salt://salt/reactor/key_remove.sls
  187. Event to trigger the key creation
  188. .. code-block:: bash
  189. salt-call event.send 'salt/key/create' \
  190. > "{'node_id': 'id-of-minion', 'node_host': '172.16.10.100', 'orch_post_create': 'kubernetes.orchestrate.compute_install', 'post_create_pillar': {'node_name': 'id-of-minion'}}"
  191. .. note::
  192. You can add pass additional `orch_pre_create`, `orch_post_create`,
  193. `orch_pre_remove` or `orch_post_remove` parameters to the event to call
  194. extra orchestrate files. This can be useful for example for
  195. registering/unregistering nodes from the monitoring alarms or dashboards.
  196. The key creation event needs to be run from other machine than the one
  197. being registered.
  198. Event to trigger the key removal
  199. .. code-block:: bash
  200. salt-call event.send 'salt/key/remove'
  201. Salt syndic
  202. -----------
  203. The master of masters
  204. .. code-block:: yaml
  205. salt:
  206. master:
  207. enabled: true
  208. order_masters: True
  209. Lower syndicated master
  210. .. code-block:: yaml
  211. salt:
  212. syndic:
  213. enabled: true
  214. master:
  215. host: master-of-master-host
  216. timeout: 5
  217. Syndicated master with multiple master of masters
  218. .. code-block:: yaml
  219. salt:
  220. syndic:
  221. enabled: true
  222. masters:
  223. - host: master-of-master-host1
  224. - host: master-of-master-host2
  225. timeout: 5
  226. Salt-minion proxy
  227. -----------------
  228. Salt proxy pillar
  229. .. code-block:: yaml
  230. salt:
  231. minion:
  232. proxy_minion:
  233. master: localhost
  234. device:
  235. vsrx01.mydomain.local:
  236. enabled: true
  237. engine: napalm
  238. csr1000v.mydomain.local:
  239. enabled: true
  240. engine: napalm
  241. .. note:: This is pillar of the the real salt-minion
  242. Proxy pillar for IOS device
  243. .. code-block:: yaml
  244. proxy:
  245. proxytype: napalm
  246. driver: ios
  247. host: csr1000v.mydomain.local
  248. username: root
  249. passwd: r00tme
  250. .. note:: This is pillar of the node thats not able to run salt-minion itself
  251. Proxy pillar for JunOS device
  252. .. code-block:: yaml
  253. proxy:
  254. proxytype: napalm
  255. driver: junos
  256. host: vsrx01.mydomain.local
  257. username: root
  258. passwd: r00tme
  259. optional_args:
  260. config_format: set
  261. .. note:: This is pillar of the node thats not able to run salt-minion itself
  262. Salt SSH
  263. --------
  264. Salt SSH with sudoer using key
  265. .. literalinclude:: tests/pillar/master_ssh_minion_key.sls
  266. :language: yaml
  267. Salt SSH with sudoer using password
  268. .. literalinclude:: tests/pillar/master_ssh_minion_password.sls
  269. :language: yaml
  270. Salt SSH with root using password
  271. .. literalinclude:: tests/pillar/master_ssh_minion_root.sls
  272. :language: yaml
  273. Salt minion
  274. -----------
  275. Simplest Salt minion setup with central configuration node
  276. .. code-block:: yaml
  277. .. literalinclude:: tests/pillar/minion_master.sls
  278. :language: yaml
  279. Multi-master Salt minion setup
  280. .. literalinclude:: tests/pillar/minion_multi_master.sls
  281. :language: yaml
  282. Salt minion with salt mine options
  283. .. literalinclude:: tests/pillar/minion_mine.sls
  284. :language: yaml
  285. Salt minion with graphing dependencies
  286. .. literalinclude:: tests/pillar/minion_graph.sls
  287. :language: yaml
  288. Salt minion behind HTTP proxy
  289. .. code-block:: yaml
  290. salt:
  291. minion:
  292. proxy:
  293. host: 127.0.0.1
  294. port: 3128
  295. Salt minion to specify non-default HTTP backend. The default tornado backend
  296. does not respect HTTP proxy settings set as environment variables. This is
  297. useful for cases where you need to set no_proxy lists.
  298. .. code-block:: yaml
  299. salt:
  300. minion:
  301. backend: urllib2
  302. Salt minion with PKI certificate authority (CA)
  303. .. literalinclude:: tests/pillar/minion_pki_ca.sls
  304. :language: yaml
  305. Salt minion using PKI certificate
  306. .. literalinclude:: tests/pillar/minion_pki_cert.sls
  307. :language: yaml
  308. Salt minion trust CA certificates issued by salt CA on a specific host (ie: salt-master node)
  309. .. code-block:: yaml
  310. salt:
  311. minion:
  312. trusted_ca_minions:
  313. - cfg01
  314. Salt control (cloud/kvm/docker)
  315. -------------------------------
  316. Salt cloud with local OpenStack provider
  317. .. literalinclude:: tests/pillar/control_cloud_openstack.sls
  318. :language: yaml
  319. Salt cloud with Digital Ocean provider
  320. .. literalinclude:: tests/pillar/control_cloud_digitalocean.sls
  321. :language: yaml
  322. Salt virt with KVM cluster
  323. .. literalinclude:: tests/pillar/control_virt.sls
  324. :language: yaml
  325. Usage
  326. =====
  327. Working with salt-cloud
  328. .. code-block:: bash
  329. salt-cloud -m /path/to/map --assume-yes
  330. Debug LIBCLOUD for salt-cloud connection
  331. .. code-block:: bash
  332. export LIBCLOUD_DEBUG=/dev/stderr; salt-cloud --list-sizes provider_name --log-level all
  333. More Information
  334. ================
  335. * http://salt.readthedocs.org/en/latest/
  336. * https://github.com/DanielBryan/salt-state-graph
  337. * http://karlgrz.com/testing-salt-states-rapidly-with-docker/
  338. * https://mywushublog.com/2013/03/configuration-management-with-salt-stack/
  339. * http://russell.ballestrini.net/replace-the-nagios-scheduler-and-nrpe-with-salt-stack/
  340. * https://github.com/saltstack-formulas/salt-formula
  341. * http://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html
  342. salt-cloud
  343. ----------
  344. * http://www.blog.sandro-mathys.ch/2013/07/setting-user-password-when-launching.html
  345. * http://cloudinit.readthedocs.org/en/latest/topics/examples.html
  346. * http://salt-cloud.readthedocs.org/en/latest/topics/install/index.html
  347. * http://docs.saltstack.com/topics/cloud/digitalocean.html
  348. * http://salt-cloud.readthedocs.org/en/latest/topics/rackspace.html
  349. * http://salt-cloud.readthedocs.org/en/latest/topics/map.html
  350. * http://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html
  351. Documentation and Bugs
  352. ======================
  353. To learn how to install and update salt-formulas, consult the documentation
  354. available online at:
  355. http://salt-formulas.readthedocs.io/
  356. In the unfortunate event that bugs are discovered, they should be reported to
  357. the appropriate issue tracker. Use Github issue tracker for specific salt
  358. formula:
  359. https://github.com/salt-formulas/salt-formula-salt/issues
  360. For feature requests, bug reports or blueprints affecting entire ecosystem,
  361. use Launchpad salt-formulas project:
  362. https://launchpad.net/salt-formulas
  363. You can also join salt-formulas-users team and subscribe to mailing list:
  364. https://launchpad.net/~salt-formulas-users
  365. Developers wishing to work on the salt-formulas projects should always base
  366. their work on master branch and submit pull request against specific formula.
  367. https://github.com/salt-formulas/salt-formula-salt
  368. Any questions or feedback is always welcome so feel free to join our IRC
  369. channel:
  370. #salt-formulas @ irc.freenode.net