state.rst 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. .. _proxy-minion-states:
  2. .. versionadded:: 2015.8.2
  3. ===================
  4. Proxy Minion States
  5. ===================
  6. Salt proxy state can be used to deploy, configure and run
  7. a ``salt-proxy`` instance on your minion. Configure proxy settings
  8. on the master side and the state configures and runs ``salt-proxy``
  9. on the remote end.
  10. 1. On your salt-master, ensure that pillar is configured properly. Select an ID
  11. for your proxy (in this example we will name the proxy 'p8000').
  12. In your pillar topfile, place an entry for your proxy:
  13. .. code-block:: yaml
  14. base:
  15. 'p8000':
  16. - p8000
  17. This says that Salt's pillar should load some values for the proxy ``p8000``
  18. from the file /srv/pillar/p8000.sls (if you have not changed your default pillar_roots)
  19. 2. In the pillar root for your base environment, create this file:
  20. .. code-block:: yaml
  21. p8000.sls
  22. ---------
  23. proxy:
  24. # set proxytype for your proxymodule
  25. proxytype: ssh_sample
  26. host: saltyVM
  27. username: salt
  28. password: badpass
  29. 3. Create the following state in your state tree
  30. (let's name it salt_proxy.sls)
  31. .. code-block:: yaml
  32. salt-proxy-configure:
  33. salt_proxy.configure_proxy:
  34. - proxyname: p8000
  35. - start: True # start the process if it isn't running
  36. 4. Make sure your salt-master and salt-minion are running.
  37. 5. Run the state salt_proxy on the minion where you want to run ``salt-proxy``
  38. Example using ``state.sls`` to configure and run ``salt-proxy``
  39. .. code-block:: bash
  40. # salt device_minion state.sls salt_proxy
  41. This starts salt-proxy on ``device_minion``
  42. 6. Accept your proxy's key on your salt-master
  43. .. code-block:: bash
  44. salt-key -y -a p8000
  45. The following keys are going to be accepted:
  46. Unaccepted Keys:
  47. p8000
  48. Key for minion p8000 accepted.
  49. 7. Now you should be able to run commands on your proxy.
  50. .. code-block:: bash
  51. salt p8000 pkg.list_pkgs