1
0

ssh_ext_alternatives.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. .. _ssh-ext-alternatives:
  2. ====================
  3. SSH Ext Alternatives
  4. ====================
  5. In the 2019.2.0 release the ``ssh_ext_alternatives`` feature was added.
  6. This allows salt-ssh to work across different supported python versions. You will
  7. need to ensure you have the following:
  8. - Salt is installed, with all required dependnecies for the Python version.
  9. - Everything needs to be importable from the respective Python environment.
  10. To enable using this feature you will need to edit the master configuration similar
  11. to below:
  12. .. code-block:: yaml
  13. ssh_ext_alternatives:
  14. 2019.2: # Namespace, can be anything.
  15. py-version: [2, 7] # Constraint to specific interpreter version
  16. path: /opt/2019.2/salt # Main Salt installation directory.
  17. dependencies: # List of dependencies and their installation paths
  18. jinja2: /opt/jinja2
  19. yaml: /opt/yaml
  20. tornado: /opt/tornado
  21. msgpack: /opt/msgpack
  22. certifi: /opt/certifi
  23. singledispatch: /opt/singledispatch.py
  24. singledispatch_helpers: /opt/singledispatch_helpers.py
  25. markupsafe: /opt/markupsafe
  26. backports_abc: /opt/backports_abc.py
  27. .. warning::
  28. When using Salt versions >= 3001 and Python 2 is your ``py-version``
  29. you need to use an older version of Salt that supports Python 2.
  30. For example, if using Salt-SSH version 3001 and you do not want
  31. to install Python 3 on your target host you can use ``ssh_ext_alternatives``'s
  32. ``path`` option. This option needs to point to a 2019.2.3 Salt installation directory
  33. on your Salt-SSH host, which still supports Python 2.
  34. auto_detect
  35. -----------
  36. In the 3001 release the ``auto_detect`` feature was added for ``ssh_ext_alternatives``.
  37. This allows salt-ssh to automatically detect the path to all of your dependencies and
  38. does not require you to define them under ``dependencies``.
  39. .. code-block:: yaml
  40. ssh_ext_alternatives:
  41. 2019.2: # Namespace, can be anything.
  42. py-version: [2, 7] # Constraint to specific interpreter version
  43. path: /opt/2019.2/salt # Main Salt installation directory.
  44. auto_detect: True # Auto detect dependencies
  45. py_bin: /usr/bin/python2.7 # Python binary path used to auto detect dependencies
  46. If ``py_bin`` is not set alongside ``auto_detect``, it will attempt to auto detect
  47. the dependnecies using the major version set in ``py-version``. For example if you
  48. have ``[2, 7]`` set as your ``py-version``, it will attempt to use the binary ``python2``.
  49. You can also use ``auto_detect`` and ``dependencies`` together.
  50. .. code-block:: yaml
  51. ssh_ext_alternatives:
  52. 2019.2: # Namespace, can be anything.
  53. py-version: [2, 7] # Constraint to specific interpreter version
  54. path: /opt/2019.2/salt # Main Salt installation directory.
  55. auto_detect: True # Auto detect dependencies
  56. py_bin: /usr/bin/python2.7 # Python binary path to auto detect dependencies
  57. dependencies: # List of dependencies and their installation paths
  58. jinja2: /opt/jinja2
  59. If a dependency is defined in the ``dependecies`` list ``ssh_ext_alternatives`` will use
  60. this dependency, instead of the path that ``auto_detect`` finds. For example, if you define
  61. ``/opt/jinja2`` under your ``dependencies`` for jinja2, it will not try to autodetect the
  62. file path to the jinja2 module, and will favor ``/opt/jinja2``.