main.yml 766 B

123456789101112131415161718192021222324252627
  1. ---
  2. - include: nginx.yml
  3. - include: acmetool.yml
  4. - name: Ensure nginx default secure config is up to date
  5. template:
  6. src: nginx_secure_default.conf.j2
  7. dest: /etc/nginx/sites-available/secure_default.conf
  8. - stat:
  9. path: "/var/lib/acme/live/{{ ansible_fqdn }}/privkey"
  10. become: yes
  11. register: default_key_file_stat
  12. - name: Let acmetool generate a key and a certificate
  13. become: yes
  14. when: not default_key_file_stat.stat.exists
  15. shell: /usr/bin/acmetool want --batch {{ ansible_fqdn }}
  16. notify: Restart nginx
  17. - name: Ensure secure default configuration for nginx is enabled
  18. become: yes
  19. file:
  20. state: link
  21. dest: /etc/nginx/sites-enabled/secure_default.conf
  22. src: /etc/nginx/sites-available/secure_default.conf
  23. notify: Reload nginx