Skip to content

Commit 80b081d

Browse files
committed
Improve certificate existence check by removing bashisms
1 parent 95c899b commit 80b081d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tasks/check-existence.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Get installed certificates.
33
shell: |
4-
{{ certbot_script }} certificates | grep "Domains:" | awk '{ gsub(/ Domains: /,""); print }'
4+
{{ certbot_script }} certificates
55
changed_when: false
66
register: letsencrypt_certs
77

@@ -13,4 +13,4 @@
1313
set_fact:
1414
cert_exists: true
1515
when: cert_item.domains | sort | difference(item) == []
16-
with_list: "{{ letsencrypt_certs.stdout_lines }}"
16+
with_list: "{{ letsencrypt_certs.stdout_lines | select('match', '.*Domains:.*') | map('regex_replace', '^.*Domains: (.*)$', '\\1') }}"

0 commit comments

Comments
 (0)