New version of salt-formula from Saltstack
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

40 lines
1008B

  1. {%- from "salt/map.jinja" import api with context %}
  2. {%- if api.get('enabled', False) %}
  3. salt_api_packages:
  4. pkg.installed:
  5. - names: {{ api.pkgs }}
  6. /etc/salt/master.d/_api.conf:
  7. file.managed:
  8. - source: salt://salt/files/_api.conf
  9. - user: root
  10. - template: jinja
  11. - require:
  12. - pkg: salt_api_packages
  13. - watch_in:
  14. - service: salt_api_service
  15. {%- if api.get('ssl', {}).authority is defined %}
  16. {%- set cert_file = "/etc/ssl/certs/" + api.ssl.get('name', grains.id) + ".crt" %}
  17. {%- set ca_file = "/etc/ssl/certs/ca-" + api.ssl.authority + ".crt" %}
  18. salt_api_init_tls:
  19. cmd.run:
  20. - name: "cat {{ cert_file }} {{ ca_file }} > /etc/ssl/certs/{{ api.ssl.get('name', grains.id) }}-chain.crt"
  21. - creates: /etc/ssl/certs/{{ api.ssl.get('name', grains.id) }}-chain.crt
  22. - watch_in:
  23. - service: salt_api_service
  24. {%- endif %}
  25. salt_api_service:
  26. service.running:
  27. - name: salt-api
  28. - require:
  29. - pkg: salt_api_packages
  30. - watch:
  31. - file: /etc/salt/master.d/_api.conf
  32. {%- endif %}