range.rst 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. .. _targeting-range:
  2. ==========
  3. SECO Range
  4. ==========
  5. SECO range is a cluster-based metadata store developed and maintained by Yahoo!
  6. The Range project is hosted here:
  7. https://github.com/ytoolshed/range
  8. Learn more about range here:
  9. https://github.com/ytoolshed/range/wiki/
  10. Prerequisites
  11. =============
  12. To utilize range support in Salt, a range server is required. Setting up a
  13. range server is outside the scope of this document. Apache modules are included
  14. in the range distribution.
  15. With a working range server, cluster files must be defined. These files are
  16. written in YAML and define hosts contained inside a cluster. Full documentation
  17. on writing YAML range files is here:
  18. https://github.com/ytoolshed/range/wiki/%22yamlfile%22-module-file-spec
  19. Additionally, the Python seco range libraries must be installed on the salt
  20. master. One can verify that they have been installed correctly via the
  21. following command:
  22. .. code-block:: bash
  23. python -c 'import seco.range'
  24. If no errors are returned, range is installed successfully on the salt master.
  25. Preparing Salt
  26. ==============
  27. Range support must be enabled on the salt master by setting the hostname and
  28. port of the range server inside the master configuration file:
  29. .. code-block:: yaml
  30. range_server: my.range.server.com:80
  31. Following this, the master must be restarted for the change to have an effect.
  32. Targeting with Range
  33. ====================
  34. Once a cluster has been defined, it can be targeted with a salt command by
  35. using the ``-R`` or ``--range`` flags.
  36. For example, given the following range YAML file being served from a range
  37. server:
  38. .. code-block:: bash
  39. $ cat /etc/range/test.yaml
  40. CLUSTER: host1..100.test.com
  41. APPS:
  42. - frontend
  43. - backend
  44. - mysql
  45. One might target host1 through host100 in the test.com domain with Salt as follows:
  46. .. code-block:: bash
  47. salt --range %test:CLUSTER test.version
  48. The following salt command would target three hosts: ``frontend``, ``backend``, and ``mysql``:
  49. .. code-block:: bash
  50. salt --range %test:APPS test.version