Saltstack Official Salt Formula
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

api.sls 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!jinja|yaml
  2. {% from "salt/map.jinja" import salt_settings with context %}
  3. {%- set cfg_salt = pillar.get('salt', {}) %}
  4. {%- set cfg_master = cfg_salt.get('master', {}) %}
  5. {%- set use_pip = salt['pillar.get']('salt:api:use_pip', False) %}
  6. include:
  7. - salt.master
  8. {%- if use_pip %}
  9. - pip.extensions
  10. {%- endif %}
  11. salt_api_install:
  12. pkg.installed:
  13. - name: {{ salt_settings['salt_api'] }}
  14. service.running:
  15. - name: {{ salt_settings.get('api_service', 'salt-api') }}
  16. - require:
  17. {%- if use_pip %}
  18. {%- if 'rest_cherrypy' in cfg_master %}
  19. - pip: salt_api_cherrypy
  20. {%- elif 'rest_tornado' in cfg_master %}
  21. - pip: salt_api_tornado
  22. {%- endif %}
  23. {%- else %} # if use_pip
  24. {%- if 'rest_cherrypy' in cfg_master %}
  25. - pkg: salt_api_cherrypy
  26. {%- elif 'rest_tornado' in cfg_master %}
  27. - pkg: salt_api_tornado
  28. {%- endif %}
  29. {%- endif %}
  30. - watch:
  31. - pkg: salt-master
  32. - file: salt-master
  33. {%- if use_pip %}
  34. {%- if 'rest_cherrypy' in cfg_master %}
  35. salt_api_cherrypy:
  36. pkg:
  37. - purged
  38. - name: {{ salt_settings['python_cherrypy'] }}
  39. pip:
  40. - installed
  41. - name: cherrypy
  42. - require:
  43. - pkg: salt_api_cherrypy
  44. - pkg: pip_extensions
  45. {% endif %}
  46. {%- if 'rest_tornado' in cfg_master %}
  47. salt_api_tornado:
  48. pkg:
  49. - purged
  50. - name: {{ salt_settings['python_tornado'] }}
  51. pip:
  52. - installed
  53. - name: tornado
  54. - require:
  55. - pkg: salt_api_tornado
  56. - pkg: pip_extensions
  57. {% endif %}
  58. {%- else %} # if use_pip
  59. {% if 'rest_cherrypy' in cfg_master %}
  60. salt_api_cherrypy:
  61. pkg:
  62. - installed
  63. - name: {{ salt_settings['python_cherrypy'] }}
  64. {% endif %}
  65. {% if 'rest_tornado' in cfg_master %}
  66. salt_api_tornado:
  67. pkg:
  68. - installed
  69. - name: {{ salt_settings['python_tornado'] }}
  70. {% endif %}
  71. {%- endif %}