From ce11c39ce4b33f4501d3cb4b16c6b36c0785fc1a Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Fri, 30 Mar 2018 18:45:20 +0200 Subject: [PATCH] evoacme: add a symlink for vhosts with old path --- evoacme/tasks/nginx.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/evoacme/tasks/nginx.yml b/evoacme/tasks/nginx.yml index e55374c8..44fc6656 100644 --- a/evoacme/tasks/nginx.yml +++ b/evoacme/tasks/nginx.yml @@ -13,3 +13,23 @@ owner: root group: root mode: "0644" + +- 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