New version of salt-formula from Saltstack
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.

12345678910111213141516171819202122232425262728293031323334353637383940
  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 %}