From 9264828051504f456ecb579ad6a6f4b044a4b330 Mon Sep 17 00:00:00 2001 From: tanshu Date: Fri, 3 Apr 2020 10:42:58 +0530 Subject: [PATCH] Gitea: Only update nginx if conf files do not exist to prevent fucking up let's encrypt certificate and redirect. --- gitea/playbook.yml | 35 +++++++++++++++++++++++++---------- postgres/playbook.yml | 2 -- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/gitea/playbook.yml b/gitea/playbook.yml index 75df2ea..08811d6 100755 --- a/gitea/playbook.yml +++ b/gitea/playbook.yml @@ -40,15 +40,30 @@ - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro -# - name: Sets Nginx conf file for gitea -# 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 -# notify: Reload Nginx + - 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 diff --git a/postgres/playbook.yml b/postgres/playbook.yml index f4c0ea5..d5e4c75 100755 --- a/postgres/playbook.yml +++ b/postgres/playbook.yml @@ -24,8 +24,6 @@ POSTGRESQL_PASSWORD: "{{ pg_password }}" POSTGRESQL_DATABASE: 'postgres' PGDATA: '/var/lib/postgresql/data/pgdata' - exposed_ports: - - 5432 published_ports: - 5432:5432 volumes: