non-interactive certbot shittery

This commit is contained in:
Torma Kristóf 2022-04-14 23:34:50 +02:00
parent 63ae9e9a6a
commit 464c9fecb1

View File

@ -32,29 +32,15 @@
state: restarted state: restarted
enabled: yes enabled: yes
- name: "Check if proxy domains have certificate available"
stat:
path: "/etc/letsencrypt/live/{{ item.domain }}"
register: "{{ item.domain }}_available"
with_items: "{{ proxy }}"
- name: "Check if statically served domains have certificate available"
stat:
path: "/etc/letsencrypt/live/{{ item.domain }}"
register: "{{ item.domain }}_available"
with_items: "{{ static }}"
- name: Generate certificate for all proxied domains - name: Generate certificate for all proxied domains
command: command:
cmd: certbot certonly --nginx -d {{item.domain}} cmd: certbot certonly --non-interactive --agree-tos -m tormakristof@tormakristof.eu --nginx -d {{item.domain}}
with_items: "{{ proxy }}" with_items: "{{ proxy }}"
when: not {{ item.domain }}_available.stat.exists
- name: Generate certificate for all static sites - name: Generate certificate for all static sites
command: command:
cmd: certbot certonly --nginx -d {{item.domain}} cmd: certbot certonly --non-interactive --agree-tos -m tormakristof@tormakristof.eu --nginx -d {{item.domain}}
with_items: "{{ static }}" with_items: "{{ static }}"
when: not {{ item.domain }}_available.stat.exists
- name: "Generate certbot script" - name: "Generate certbot script"
ansible.builtin.template: ansible.builtin.template: