index.rst 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. .. _engines:
  2. ============
  3. Salt Engines
  4. ============
  5. .. versionadded:: 2015.8.0
  6. Salt Engines are long-running, external system processes that leverage Salt.
  7. - Engines have access to Salt configuration, execution modules, and runners (``__opts__``, ``__salt__``, and ``__runners__``).
  8. - Engines are executed in a separate process that is monitored by Salt. If a Salt engine stops, it is restarted automatically.
  9. - Engines can run on the Salt master and on Salt minions.
  10. Salt engines enhance and replace the :ref:`external processes <ext-processes>` functionality.
  11. Configuration
  12. =============
  13. Salt engines are configured under an ``engines`` top-level section in your Salt master or Salt minion configuration. Provide a list of engines and parameters under this section.
  14. .. code-block:: yaml
  15. engines:
  16. - logstash:
  17. host: log.my_network.com
  18. port: 5959
  19. proto: tcp
  20. .. versionadded:: 3000
  21. Multiple copies of a particular Salt engine can be configured by including the ``engine_module`` parameter in the engine configuration.
  22. .. code-block:: yaml
  23. engines:
  24. - production_logstash:
  25. host: production_log.my_network.com
  26. port: 5959
  27. proto: tcp
  28. engine_module: logstash
  29. - develop_logstash:
  30. host: develop_log.my_network.com
  31. port: 5959
  32. proto: tcp
  33. engine_module: logstash
  34. Salt engines must be in the Salt path, or you can add the ``engines_dirs`` option in your Salt master configuration with a list of directories under which Salt attempts to find Salt engines. This option should be formatted as a list of directories to search, such as:
  35. .. code-block:: yaml
  36. engines_dirs:
  37. - /home/bob/engines
  38. Writing an Engine
  39. =================
  40. An example Salt engine, :blob:`salt/engines/test.py`, is available in the Salt source. To develop an engine, the only requirement is that your module implement the ``start()`` function.