Saltstack Official Salt Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.7KB

  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.purged:
  37. - name: {{ salt_settings.python_cherrypy }}
  38. pip.installed:
  39. - name: cherrypy
  40. - require:
  41. - pkg: salt_api_cherrypy
  42. - pkg: pip_extensions
  43. {% endif %}
  44. {%- if 'rest_tornado' in cfg_master %}
  45. salt_api_tornado:
  46. pkg.purged:
  47. - name: {{ salt_settings.python_tornado }}
  48. pip.installed:
  49. - name: tornado
  50. - require:
  51. - pkg: salt_api_tornado
  52. - pkg: pip_extensions
  53. {% endif %}
  54. {%- else %} # if use_pip
  55. {% if 'rest_cherrypy' in cfg_master %}
  56. salt_api_cherrypy:
  57. pkg.installed:
  58. - name: {{ salt_settings.python_cherrypy }}
  59. {% endif %}
  60. {% if 'rest_tornado' in cfg_master %}
  61. salt_api_tornado:
  62. pkg.installed:
  63. - name: {{ salt_settings.python_tornado }}
  64. {% endif %}
  65. {%- endif %}