file_roots.rst 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. =========================
  2. File Server Configuration
  3. =========================
  4. The Salt file server is a high performance file server written in ZeroMQ. It
  5. manages large files quickly and with little overhead, and has been optimized
  6. to handle small files in an extremely efficient manner.
  7. The Salt file server is an environment aware file server. This means that
  8. files can be allocated within many root directories and accessed by
  9. specifying both the file path and the environment to search. The
  10. individual environments can span across multiple directory roots
  11. to create overlays and to allow for files to be organized in many flexible
  12. ways.
  13. Environments
  14. ============
  15. The Salt file server defaults to the mandatory ``base`` environment. This
  16. environment **MUST** be defined and is used to download files when no
  17. environment is specified.
  18. Environments allow for files and sls data to be logically separated, but
  19. environments are not isolated from each other. This allows for logical
  20. isolation of environments by the engineer using Salt, but also allows
  21. for information to be used in multiple environments.
  22. .. _file-roots-directory-overlay:
  23. Directory Overlay
  24. =================
  25. The ``environment`` setting is a list of directories to publish files from.
  26. These directories are searched in order to find the specified file and the
  27. first file found is returned.
  28. This means that directory data is prioritized based on the order in which they
  29. are listed. In the case of this ``file_roots`` configuration:
  30. .. code-block:: yaml
  31. file_roots:
  32. base:
  33. - /srv/salt/base
  34. - /srv/salt/failover
  35. If a file's URI is ``salt://httpd/httpd.conf``, it will first search for the
  36. file at ``/srv/salt/base/httpd/httpd.conf``. If the file is found there it
  37. will be returned. If the file is not found there, then
  38. ``/srv/salt/failover/httpd/httpd.conf`` will be used for the source.
  39. This allows for directories to be overlaid and prioritized based on the order
  40. they are defined in the configuration.
  41. It is also possible to have ``file_roots`` which supports multiple
  42. environments:
  43. .. code-block:: yaml
  44. file_roots:
  45. base:
  46. - /srv/salt/base
  47. dev:
  48. - /srv/salt/dev
  49. - /srv/salt/base
  50. prod:
  51. - /srv/salt/prod
  52. - /srv/salt/base
  53. This example ensures that each environment will check the associated
  54. environment directory for files first. If a file is not found in the
  55. appropriate directory, the system will default to using the base directory.
  56. Local File Server
  57. =================
  58. .. versionadded:: 0.9.8
  59. The file server can be rerouted to run from the minion. This is primarily to
  60. enable running Salt states without a Salt master. To use the local file server
  61. interface, copy the file server data to the minion and set the file_roots
  62. option on the minion to point to the directories copied from the master.
  63. Once the minion ``file_roots`` option has been set, change the ``file_client``
  64. option to local to make sure that the local file server interface is used.