copr/certbot: better restoration
Certbot expects that the files in live/ directory are symlinks.
This commit is contained in:
parent
43ee0392b4
commit
af11469b14
1 changed files with 46 additions and 1 deletions
|
@ -65,10 +65,40 @@
|
||||||
- letsencrypt.backup_to is defined
|
- letsencrypt.backup_to is defined
|
||||||
- item.content is defined
|
- item.content is defined
|
||||||
|
|
||||||
|
- name: create the archive directory
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "{{ le_source_path }}/../archive"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
# this is readable by anyone, per certbot defaults
|
||||||
|
mode: 0755
|
||||||
|
loop: "{{ backed_up_certificates.results }}"
|
||||||
|
tags:
|
||||||
|
- certbot
|
||||||
|
when:
|
||||||
|
- letsencrypt.backup_to is defined
|
||||||
|
- item.content is defined
|
||||||
|
|
||||||
|
- name: create the archive host directorY
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "{{ le_source_path }}/../archive/{{ item.item.0.item.key }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
# this is readable by anyone, per certbot defaults
|
||||||
|
mode: 0755
|
||||||
|
loop: "{{ backed_up_certificates.results }}"
|
||||||
|
tags:
|
||||||
|
- certbot
|
||||||
|
when:
|
||||||
|
- letsencrypt.backup_to is defined
|
||||||
|
- item.content is defined
|
||||||
|
|
||||||
- name: restore the backed up certificates
|
- name: restore the backed up certificates
|
||||||
copy:
|
copy:
|
||||||
content: "{{ item.content | b64decode }}"
|
content: "{{ item.content | b64decode }}"
|
||||||
dest: "{{ le_source_path }}/{{ item.item.0.item.key }}/{{ item.item.1 }}"
|
dest: "{{ le_source_path }}/../archive/{{ item.item.0.item.key }}/restored{{ item.item.1 }}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
@ -80,6 +110,21 @@
|
||||||
- item.content is defined
|
- item.content is defined
|
||||||
register: some_cert_restored
|
register: some_cert_restored
|
||||||
|
|
||||||
|
- name: restore the cert symlinks
|
||||||
|
file:
|
||||||
|
state: symlink
|
||||||
|
src: "../archive/restored{{ item.item.1 }}"
|
||||||
|
dest: "{{ le_source_path }}/{{ item.item.0.item.key }}/{{ item.item.1 }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
loop: "{{ backed_up_certificates.results }}"
|
||||||
|
tags:
|
||||||
|
- certbot
|
||||||
|
when:
|
||||||
|
- letsencrypt.backup_to is defined
|
||||||
|
- item.content is defined
|
||||||
|
register: some_cert_restored
|
||||||
|
|
||||||
- name: initialize certbot configuration
|
- name: initialize certbot configuration
|
||||||
shell: |
|
shell: |
|
||||||
certbot certonly --standalone \
|
certbot certonly --standalone \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue