Playbooks to a new Lilik
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.

45 lines
1.9 KiB

  1. - name: provision ssl host private key
  2. openssl_privatekey:
  3. path: "{{ item.server.ssl_certificate_key }}"
  4. - name: generate certificate signing request
  5. command: >
  6. openssl req
  7. -new
  8. -sha256
  9. -nodes
  10. -key {{ item.server.ssl_certificate_key }}
  11. -out {{ item.letsencrypt.ssl_csr | default(item.server.ssl_certificate~".csr") }}
  12. -subj "/C={{ item.letsencrypt.ssl_country | default(letsencrypt_ssl_country)
  13. }}/ST={{ item.letsencrypt.ssl_state | default(letsencrypt_ssl_state)
  14. }}/L{{ item.letsencrypt.ssl_loc | default(letsencrypt_ssl_loc)
  15. }}/O={{ item.letsencrypt.ssl_org | default(letsencrypt_ssl_org)
  16. }}/CN={{ item.letsencrypt.ssl_cn | default(item.server.server_name)
  17. }}/emailAddress={{ item.letsencrypt.ssl_email | default(letsencrypt_ssl_email) }}"
  18. - name: get challenge(s) from letsencrypt server
  19. letsencrypt:
  20. account_key: "{{ letsencrypt_account_key }}"
  21. csr: "{{ item.letsencrypt.ssl_csr | default(item.server.ssl_certificate~'.csr') }}"
  22. dest: "{{ item.server.ssl_certificate }}"
  23. acme_directory: "{{ letsencrypt_acme_dir | default(omit) }}"
  24. register: letsencrypt_challenge
  25. - name: store challenge(s) in local dir
  26. include: store_challenge.yaml
  27. when: letsencrypt_challenge|changed
  28. - pause:
  29. prompt: "LETSENCRYPT REMOTE VERIFICATION REQUIRED!. Perform any action to
  30. make server reachable from outside, then press ENTER to start
  31. verification"
  32. when: letsencrypt_challenge|changed and letsencrypt_pause|bool
  33. - name: get signed certificate(s) from letsencrypt server
  34. letsencrypt:
  35. account_key: "{{ letsencrypt_account_key }}"
  36. csr: "{{ item.letsencrypt.ssl_csr | default(item.server.ssl_certificate~'.csr') }}"
  37. dest: "{{ item.server.ssl_certificate }}"
  38. acme_directory: "{{ letsencrypt_acme_dir | default(omit) }}"
  39. data: "{{ letsencrypt_challenge }}"
  40. notify: restart nginx