add check to cert stuff

This commit is contained in:
Torma Kristóf 2022-04-14 23:28:13 +02:00
parent e425c703eb
commit e6a722704a

View File

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