Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

letsencrypt.yml 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. - name: Download LetsEncrypt release
  2. git: repo=https://github.com/letsencrypt/letsencrypt
  3. dest=/root/letsencrypt
  4. version=master
  5. force=yes
  6. - name: Create directory for LetsEncrypt configuration and certificates
  7. file: state=directory path=/etc/letsencrypt group=root owner=root
  8. - name: Configure LetsEncrypt
  9. template:
  10. src=etc_letsencrypt_cli.conf.j2
  11. dest=/etc/letsencrypt/cli.conf
  12. owner=root
  13. group=root
  14. - name: Install LetsEncrypt package dependencies
  15. command: /root/letsencrypt/letsencrypt-auto --help
  16. register: le_deps_result
  17. changed_when: "'Bootstrapping dependencies' in le_deps_result.stdout"
  18. - name: Create directory for pre-renewal scripts
  19. file: state=directory path=/etc/letsencrypt/prerenew group=root owner=root
  20. - name: Create directory for post-renewal scripts
  21. file: state=directory path=/etc/letsencrypt/postrenew group=root owner=root
  22. - name: Create pre-renew hook to stop apache
  23. copy:
  24. content: "#!/bin/bash\n\nservice apache2 stop\n"
  25. dest: /etc/letsencrypt/prerenew/apache
  26. owner: root
  27. group: root
  28. mode: 0755
  29. - name: Create post-renew hook to start apache
  30. copy:
  31. content: "#!/bin/bash\n\nservice apache2 start\n"
  32. dest: /etc/letsencrypt/postrenew/apache
  33. owner: root
  34. group: root
  35. mode: 0755
  36. - name: Install crontab entry for LetsEncrypt
  37. copy:
  38. src: etc_cron-daily_letsencrypt-renew
  39. dest: /etc/cron.daily/letsencrypt-renew
  40. owner: root
  41. group: root
  42. mode: 0755
  43. - name: Create live directory for LetsEncrypt cron job
  44. file: state=directory path=/etc/letsencrypt/live group=root owner=root
  45. - name: Get an SSL certificate for {{ domain }} from Let's Encrypt
  46. script: letsencrypt-gencert {{ domain }} creates=/etc/letsencrypt/live/{{ domain }}/privkey.pem
  47. when: ansible_ssh_user != "vagrant"
  48. - name: Modify permissions to allow ssl-cert group access
  49. file: path=/etc/letsencrypt/archive owner=root group=ssl-cert mode=0750
  50. when: ansible_ssh_user != "vagrant"
  51. ### Several steps to install a self-signed wildcard key to support offline testing
  52. - name: Create live directory for testing keys
  53. file: dest=/etc/letsencrypt/live/{{ domain }} state=directory
  54. owner=root group=root mode=0755
  55. when: ansible_ssh_user == "vagrant"
  56. - name: Copy SSL wildcard private key for testing
  57. copy: src=wildcard_private.key
  58. dest=/etc/letsencrypt/live/{{ domain }}/privkey.pem
  59. owner=root group=ssl-cert mode=0640
  60. when: ansible_ssh_user == "vagrant"
  61. - name: Copy SSL public certificate into place for testing
  62. copy: src=wildcard_public_cert.crt
  63. dest=/etc/letsencrypt/live/{{ domain }}/cert.pem
  64. group=root owner=root mode=0644
  65. register: certificate
  66. notify: restart apache
  67. when: ansible_ssh_user == "vagrant"
  68. - name: Copy SSL CA combined certificate into place for testing
  69. copy: src=wildcard_ca.pem
  70. dest=/etc/letsencrypt/live/{{ domain }}/chain.pem
  71. group=root owner=root mode=0644
  72. register: ca_certificate
  73. notify: restart apache
  74. when: ansible_ssh_user == "vagrant"
  75. - name: Create a combined SSL cert for testing
  76. shell: cat /etc/letsencrypt/live/{{ domain }}/cert.pem
  77. /etc/letsencrypt/live/{{ domain }}/chain.pem >
  78. /etc/letsencrypt/live/{{ domain }}/fullchain.pem
  79. when: private_key.changed or certificate.changed or ca_certificate.changed
  80. when: ansible_ssh_user == "vagrant"
  81. - name: Set permissions on combined SSL public cert
  82. file: name=/etc/letsencrypt/live/{{ domain }}/fullchain.pem mode=0644
  83. notify: restart apache
  84. when: ansible_ssh_user == "vagrant"
  85. ### Back to normal