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.

54 lines
1.1 KiB

  1. ---
  2. - name: install certbot
  3. apt:
  4. name: "{{ item }}"
  5. state: present
  6. update_cache: true
  7. cache_valid_time: 3600
  8. with_items:
  9. - certbot
  10. - sendmail-bin
  11. - cron
  12. - name: Shutdown webservers
  13. service:
  14. name: "{{ webserver_name }}"
  15. state: stopped
  16. ignore_errors: yes
  17. - name: request certificate
  18. command: >
  19. certbot
  20. certonly
  21. -a standalone
  22. --agree-tos
  23. --email roots@lists.lilik.it
  24. --preferred-challenges http
  25. -d {{ server_fqdn }}
  26. -d www.{{ server_fqdn }}
  27. -n
  28. args:
  29. creates: /etc/letsencrypt/live/{{ server_fqdn }}/cert.pem
  30. - name: Restart webservers
  31. service:
  32. name: "{{ webserver_name }}"
  33. state: started
  34. ignore_errors: yes
  35. - name: Add systemd timer for cert renewal
  36. template:
  37. src: certbot.timer
  38. dest: /etc/systemd/system/certbot.timer
  39. - name: Add systemd service for cert renewal
  40. template:
  41. src: certbot.service
  42. dest: /etc/systemd/system/certbot.service
  43. - name: Enable timer
  44. systemd:
  45. name: certbot.timer
  46. state: started
  47. enabled: true
  48. daemon_reload: true