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.

32 lines
1.0KB

  1. ---
  2. - include_tasks: key.yml
  3. - include_tasks: csr.yml
  4. - name: check if the certificate will expire soon
  5. command: openssl x509 -checkend {{ 60*60*24*30 }} -noout -in {{certificate_file}}
  6. register: _certificate_checkend
  7. changed_when: _certificate_checkend.rc == 1
  8. failed_when: _certificate_checkend.rc > 1
  9. - name: self sign certificate
  10. command: openssl x509 -req
  11. -in "{{ certificate_signing_request_file }}"
  12. -signkey "{{ certificate_private_key_file }}"
  13. -extfile "{{ certificate_signing_request_config_file }}"
  14. -extensions certificate_extensions
  15. -out "{{ certificate_file }}"
  16. {{ certificate_private_key_password is defined | ternary('-passin env:PRIVATE_KEY_PASSWORD','') }}
  17. args:
  18. creates: "{{ certificate_file }}"
  19. environment:
  20. PRIVATE_KEY_PASSWORD: "{{ certificate_private_key_password | default('') }}"
  21. notify: certificate changed
  22. when: _certificate_checkend.rc == 1
  23. - name: link full certificate chain file
  24. file:
  25. src: "{{ certificate_file }}"
  26. dest: "{{ certificate_fullchain_file }}"
  27. state: link