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.

51 lines
1.3KB

  1. {% from 'icinga2/map.jinja' import icinga2 with context %}
  2. {% set fqdn = salt.grains.get('fqdn') %}
  3. # TODO: Import salt_settings same as other modules at Lexicon
  4. # for things like salt_settings.ca.host and
  5. # salt_settings.ca.policy
  6. include:
  7. - icinga2.pki
  8. # Get ca certificate from mine
  9. icinga2_node_ca_cert:
  10. file.symlink:
  11. - name: {{ icinga2.pki_dir }}/ca.crt
  12. - target: {{ icinga2.ca_trusted_root_cert }}
  13. - require:
  14. - file: icinga2_pki_dir
  15. icinga2_node_cert:
  16. x509.certificate_managed:
  17. - name: {{ icinga2.pki_dir }}/{{ fqdn }}.crt
  18. - ca_server: {{ salt_settings.ca.host }}
  19. - signing_policy: {{ salt_settings.ca.policy }}
  20. - public_key: {{ icinga2.pki_dir }}/{{ fqdn }}.key
  21. - CN: {{ fqdn }}
  22. - days_remaining: 30
  23. - backup: True
  24. - managed_private_key:
  25. name: {{ icinga2.pki_dir }}/{{ fqdn }}.key
  26. bits: 4096
  27. backup: True
  28. - require:
  29. - file: icinga2_pki_dir
  30. icinga2_node_key_perms:
  31. file.managed:
  32. - name: {{ icinga2.pki_dir }}/{{ fqdn }}.key
  33. - user: {{ icinga2.user }}
  34. - group: {{ icinga2.group }}
  35. - mode: 600
  36. - watch:
  37. - x509: icinga2_node_cert
  38. icinga2_node_cert_perms:
  39. file.managed:
  40. - name: {{ icinga2.pki_dir }}/{{ fqdn }}.crt
  41. - user: {{ icinga2.user }}
  42. - group: {{ icinga2.group }}
  43. - watch:
  44. - x509: icinga2_node_cert