--- - name: Install nginx and certbot apt: name: - nginx - certbot - python3-certbot-nginx state: present update_cache: true - name: Remove default nginx site file: path: /etc/nginx/sites-enabled/default state: absent notify: Reload nginx - name: Deploy homekeeper nginx config template: src: homekeeper.conf.j2 dest: /etc/nginx/sites-available/homekeeper.conf mode: "0644" notify: Reload nginx - name: Enable homekeeper nginx site file: src: /etc/nginx/sites-available/homekeeper.conf dest: /etc/nginx/sites-enabled/homekeeper.conf state: link notify: Reload nginx - name: Obtain Let's Encrypt certificates command: > certbot --nginx -d {{ domain }} -d {{ gitea_domain }} --non-interactive --agree-tos -m {{ gitea_admin_email }} --redirect args: creates: /etc/letsencrypt/live/{{ domain }}/fullchain.pem notify: Reload nginx - name: Enable nginx service: name: nginx enabled: true state: started handlers: - name: Reload nginx service: name: nginx state: reloaded