diff --git a/nextcloud/playbook.yml b/nextcloud/playbook.yml index cdecda8..da430d9 100755 --- a/nextcloud/playbook.yml +++ b/nextcloud/playbook.yml @@ -58,14 +58,30 @@ volumes: - /var/lib/nextcloud:/var/www/html:ro -# - name: Sets Nginx conf file for nextcloud -# template: -# src: "files/nginx.conf.j2" -# dest: "/etc/nginx/sites-available/{{ http_conf }}" + - name: Check if Nginx conf file for gitea exists or not + stat: path="/etc/nginx/sites-available/{{ http_conf }}" + register: status -# - name: Enables new site -# file: -# src: "/etc/nginx/sites-available/{{ http_conf }}" -# dest: "/etc/nginx/sites-enabled/{{ http_conf }}" -# state: link + - name: No need to reload Nginx + debug: msg= {{ "No need to reload Nginx as sites-available entries have already been created" }} + + - name: Sets Nginx conf file for gitea + when: status.stat.exists == false + template: + src: "files/nginx.conf.j2" + dest: "/etc/nginx/sites-available/{{ http_conf }}" + + - name: Enables new site + when: status.stat.exists == false + file: + src: "/etc/nginx/sites-available/{{ http_conf }}" + dest: "/etc/nginx/sites-enabled/{{ http_conf }}" + state: link + notify: Reload Nginx + + handlers: + - name: Reload Nginx + service: + name: nginx + state: reloaded