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:
- /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