Saltstack Official Linux 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.

certificate.sls 983B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled %}
  3. {%- if system.ca_certificates is defined %}
  4. linux_system_ca_certificates:
  5. pkg.installed:
  6. - name: ca-certificates
  7. {%- if system.ca_certificates is mapping %}
  8. {%- for name, cert in system.ca_certificates.items() %}
  9. {{ system.ca_certs_dir }}/{{ name }}.crt:
  10. file.managed:
  11. - contents_pillar: "linux:system:ca_certificates:{{ name }}"
  12. - watch_in:
  13. - cmd: update_certificates
  14. - require:
  15. - pkg: linux_system_ca_certificates
  16. {%- endfor %}
  17. {%- else %}
  18. {#- salt-pki way #}
  19. {%- for certificate in system.ca_certificates %}
  20. {{ system.ca_certs_dir }}/{{ certificate }}.crt:
  21. file.managed:
  22. - source: salt://pki/{{ certificate }}/{{ certificate }}-chain.cert.pem
  23. - watch_in:
  24. - cmd: update_certificates
  25. - require:
  26. - pkg: linux_system_ca_certificates
  27. {%- endfor %}
  28. {%- endif %}
  29. update_certificates:
  30. cmd.wait:
  31. - name: {{ system.ca_certs_bin }}
  32. {%- endif %}
  33. {%- endif %}