2017-12-08 09:46:16 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: move acme challenge conf if missplaced
|
|
|
|
command: mv /etc/nginx/letsencrypt.conf /etc/nginx/snippets/letsencrypt.conf
|
|
|
|
args:
|
|
|
|
removes: /etc/nginx/letsencrypt.conf
|
|
|
|
creates: /etc/nginx/snippets/letsencrypt.conf
|
|
|
|
|
2016-12-14 15:49:34 +01:00
|
|
|
- name: Copy acme challenge conf
|
|
|
|
template:
|
|
|
|
src: templates/nginx.conf.j2
|
2017-11-25 14:13:57 +01:00
|
|
|
dest: /etc/nginx/snippets/letsencrypt.conf
|
2016-12-14 15:49:34 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
2017-03-23 16:59:43 +01:00
|
|
|
mode: "0644"
|
2018-03-30 18:45:20 +02:00
|
|
|
|
|
|
|
- name: look for old path
|
|
|
|
command: grep -r /etc/nginx/letsencrypt.conf /etc/nginx
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
check_mode: no
|
|
|
|
register: grep_letsencrypt_old_path
|
|
|
|
|
|
|
|
- name: Keep a symlink for vhosts with old path
|
|
|
|
file:
|
|
|
|
src: /etc/nginx/snippets/letsencrypt.conf
|
|
|
|
dest: /etc/nginx/letsencrypt.conf
|
|
|
|
state: link
|
|
|
|
when: grep_letsencrypt_old_path.rc == 0
|
|
|
|
|
|
|
|
- name: Remove symlink if no vhost with old path
|
|
|
|
file:
|
|
|
|
dest: /etc/nginx/letsencrypt.conf
|
|
|
|
state: absent
|
|
|
|
when: grep_letsencrypt_old_path.rc == 1
|