Nextcloud: only update nginx if not already done

This commit is contained in:
tanshu 2020-04-03 12:19:19 +05:30
parent 9264828051
commit 2c77fdd5a7

View File

@ -58,14 +58,30 @@
volumes: volumes:
- /var/lib/nextcloud:/var/www/html:ro - /var/lib/nextcloud:/var/www/html:ro
# - name: Sets Nginx conf file for nextcloud - name: Check if Nginx conf file for gitea exists or not
# template: stat: path="/etc/nginx/sites-available/{{ http_conf }}"
# src: "files/nginx.conf.j2" register: status
# dest: "/etc/nginx/sites-available/{{ http_conf }}"
# - name: Enables new site - name: No need to reload Nginx
# file: debug: msg= {{ "No need to reload Nginx as sites-available entries have already been created" }}
# src: "/etc/nginx/sites-available/{{ http_conf }}"
# dest: "/etc/nginx/sites-enabled/{{ http_conf }}" - name: Sets Nginx conf file for gitea
# state: link 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