|
|
|
@ -5,17 +5,14 @@ |
|
|
|
|
register: letsencrypt_cert_exists |
|
|
|
|
|
|
|
|
|
- name: Check if certificate has changed. |
|
|
|
|
command: grep -Fxq "{{ cert_item.domains }}" /etc/letsencrypt/domains-{{ cert_item.domains | first }} |
|
|
|
|
register: letsencrypt_cert_updated |
|
|
|
|
check_mode: no |
|
|
|
|
ignore_errors: yes |
|
|
|
|
changed_when: no |
|
|
|
|
lineinfile: |
|
|
|
|
path: /etc/letsencrypt/domains-{{ cert_item.domains | first }} |
|
|
|
|
line: "{{ cert_item.domains }}" |
|
|
|
|
state: present |
|
|
|
|
check_mode: yes |
|
|
|
|
register: letsencrypt_cert_contents |
|
|
|
|
when: letsencrypt_cert_exists.stat.exists |
|
|
|
|
|
|
|
|
|
- debug: |
|
|
|
|
msg: Not changed |
|
|
|
|
when: letsencrypt_cert_updated.rc == 0 |
|
|
|
|
|
|
|
|
|
- debug: |
|
|
|
|
msg: Changed |
|
|
|
|
when: letsencrypt_cert_updated.rc != 0 |
|
|
|
|
- set_fact: |
|
|
|
|
letsencrypt_cert_updated: "{{ (letsencrypt_cert_contents | changed) or (letsencrypt_cert_contents | failed) }}" |
|
|
|
|
when: letsencrypt_cert_exists.stat.exists |
|
|
|
|