Brak opisu
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.

letsencrypt.yml 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. - name: Add group name ssl-cert for SSL certificates
  2. group:
  3. name: ssl-cert
  4. state: present
  5. - name: Download LetsEncrypt release
  6. git: repo=https://github.com/letsencrypt/letsencrypt
  7. dest=/root/letsencrypt
  8. version=master
  9. force=yes
  10. - name: Create directory for LetsEncrypt configuration and certificates
  11. file: state=directory path=/etc/letsencrypt group=root owner=root
  12. - name: Configure LetsEncrypt
  13. template:
  14. src=etc_letsencrypt_cli.conf.j2
  15. dest=/etc/letsencrypt/cli.conf
  16. owner=root
  17. group=root
  18. - name: Install LetsEncrypt package dependencies
  19. command: /root/letsencrypt/letsencrypt-auto --help
  20. register: le_deps_result
  21. changed_when: "'Bootstrapping dependencies' in le_deps_result.stdout"
  22. - name: Create directory for pre-renewal scripts
  23. file: state=directory path=/etc/letsencrypt/prerenew group=root owner=root
  24. - name: Create directory for post-renewal scripts
  25. file: state=directory path=/etc/letsencrypt/postrenew group=root owner=root
  26. - name: Create pre-renew hook to stop apache
  27. copy:
  28. content: "#!/bin/bash\n\nservice apache2 stop\n"
  29. dest: /etc/letsencrypt/prerenew/apache
  30. owner: root
  31. group: root
  32. mode: 0755
  33. - name: Create post-renew hook to start apache
  34. copy:
  35. content: "#!/bin/bash\n\nservice apache2 start\n"
  36. dest: /etc/letsencrypt/postrenew/apache
  37. owner: root
  38. group: root
  39. mode: 0755
  40. - name: Install crontab entry for LetsEncrypt
  41. copy:
  42. src: etc_cron-daily_letsencrypt-renew
  43. dest: /etc/cron.daily/letsencrypt-renew
  44. owner: root
  45. group: root
  46. mode: 0755
  47. - name: Create live directory for LetsEncrypt cron job
  48. file: state=directory path=/etc/letsencrypt/live group=ssl-cert owner=root
  49. - name: Get an SSL certificate for {{ virtual_domains | json_query('[*].name') | join(' ') }} from Let's Encrypt
  50. script: letsencrypt-gencert {{ virtual_domains | json_query('[*].name') | join(' ') }} creates=/etc/letsencrypt/live/{{ domain }}/privkey.pem
  51. - name: Modify permissions to allow ssl-cert group access to archive
  52. file: path=/etc/letsencrypt/archive owner=root group=ssl-cert mode=0750 recurse=yes
  53. - name: Modify permissions to allow ssl-cert group access to live
  54. file: path=/etc/letsencrypt/live owner=root group=ssl-cert mode=0750 recurse=yes