mirror of
https://github.com/geerlingguy/ansible-role-certbot.git
synced 2025-04-19 17:01:37 +02:00
Use copy module to persist domain list.
This commit is contained in:
parent
36609dac50
commit
45005e9bc2
@ -1,5 +1,5 @@
|
||||
---
|
||||
- name: Check if certificate exists or has been changed
|
||||
- name: Check if certificate exists or has been changed.
|
||||
import_tasks: test-cert-exists.yml
|
||||
|
||||
- name: Stop services to allow certbot to generate a cert.
|
||||
@ -13,14 +13,12 @@
|
||||
shell: "{{ certbot_create_command }}"
|
||||
when: not letsencrypt_cert_exists.stat.exists or letsencrypt_cert_updated
|
||||
|
||||
# TODO May use a more direct https://docs.ansible.com/ansible/latest/copy_module.html
|
||||
- name: Persist domain list to host
|
||||
lineinfile:
|
||||
path: /etc/letsencrypt/domains-{{ cert_item.domains | first }}
|
||||
line: "{{ cert_item.domains }}"
|
||||
state: present
|
||||
create: yes
|
||||
when: letsencrypt_cert_updated
|
||||
- name: Persist domain list to /etc/letsencrypt/domains-{{ cert_item.domains | first }}.
|
||||
copy:
|
||||
dest: /etc/letsencrypt/domains-{{ cert_item.domains | first }}
|
||||
# Add a space here because of https://github.com/ansible/ansible/issues/6077
|
||||
content: " {{ cert_item.domains }}\n"
|
||||
# when: not letsencrypt_cert_exists.stat.exists or letsencrypt_cert_updated
|
||||
|
||||
- name: Start services after cert has been generated.
|
||||
service:
|
||||
|
@ -7,7 +7,7 @@
|
||||
- name: Check if certificate domain list has changed.
|
||||
lineinfile:
|
||||
path: /etc/letsencrypt/domains-{{ cert_item.domains | first }}
|
||||
line: "{{ cert_item.domains }}"
|
||||
line: " {{ cert_item.domains }}"
|
||||
state: present
|
||||
create: yes
|
||||
check_mode: yes
|
||||
|
Loading…
x
Reference in New Issue
Block a user