- name: Install dependencies apt: pkg: - nginx - certbot - python3-certbot-nginx - name: Query lets encrypt certificate shell: 'letsencrypt certonly -n --nginx -m {{ letsencrypt_email|default("me@chapoline.me") }} --expand --agree-tos -d {{ item.name }} {% for a in item.alias %} -d {{a}}{% endfor %}' ignore_errors: true notify: Restart nginx - name: Create a few symbolic links file: src: "{{ item2.src }}" dest: "{{ item2.dest }}" state: link force: true loop: - src: "/etc/letsencrypt/live/{{ item.name }}/privkey.pem" dest: "/etc/ssl/private/{{ item.name }}.key" - src: "/etc/letsencrypt/live/{{ item.name }}/cert.pem" dest: "/etc/ssl/private/{{ item.name }}.crt" - src: "/etc/letsencrypt/live/{{ item.name }}/fullchain.pem" dest: "/etc/ssl/private/{{ item.name }}.chain.crt" loop_control: loop_var: item2 notify: Restart nginx