mirror of
https://github.com/geerlingguy/ansible-role-certbot.git
synced 2025-04-19 17:01:37 +02:00
Improve certificate existence check by removing bashisms
This commit is contained in:
parent
ed6fa4419a
commit
d350d9b14e
@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Get installed certificates.
|
- name: Get installed certificates.
|
||||||
shell: |
|
command: "{{ certbot_script }} certificates"
|
||||||
{{ certbot_script }} certificates | grep "Domains:" | awk '{ gsub(/ Domains: /,""); print }'
|
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: letsencrypt_certs
|
register: letsencrypt_certs
|
||||||
|
|
||||||
@ -13,4 +12,4 @@
|
|||||||
set_fact:
|
set_fact:
|
||||||
cert_exists: true
|
cert_exists: true
|
||||||
when: cert_item.domains | sort | difference(item) == []
|
when: cert_item.domains | sort | difference(item) == []
|
||||||
with_list: "{{ letsencrypt_certs.stdout_lines }}"
|
with_list: "{{ letsencrypt_certs.stdout_lines | select('match', '.*Domains:.*') | map('regex_replace', '^.*Domains: (.*)$', '\\1') }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user