Postgres: changed image to the :alpine

All: Check if nginx config exists before updating. This is to prevent overwriting of certbot-auto certificates and redirect
This commit is contained in:
tanshu 2020-04-03 13:01:44 +05:30
parent 2c77fdd5a7
commit 518871ff16
5 changed files with 29 additions and 20 deletions

View File

@ -27,12 +27,21 @@
volumes: volumes:
- /var/lib/bitwarden/data:/data/ - /var/lib/bitwarden/data:/data/
- name: Sets Nginx conf file for bitwarden - name: Check if Nginx conf file exists
stat: path="/etc/nginx/sites-available/{{ http_conf }}"
register: status
- name: No need to reload Nginx
debug: msg= {{ "No need to reload Nginx as sites-available entries have already been created" }}
- name: Set Nginx conf file
when: status.stat.exists == false
template: template:
src: "files/nginx.conf.j2" src: "files/nginx.conf.j2"
dest: "/etc/nginx/sites-available/{{ http_conf }}" dest: "/etc/nginx/sites-available/{{ http_conf }}"
- name: Enables new site - name: Enable new site
when: status.stat.exists == false
file: file:
src: "/etc/nginx/sites-available/{{ http_conf }}" src: "/etc/nginx/sites-available/{{ http_conf }}"
dest: "/etc/nginx/sites-enabled/{{ http_conf }}" dest: "/etc/nginx/sites-enabled/{{ http_conf }}"
@ -45,7 +54,3 @@
name: nginx name: nginx
state: reloaded state: reloaded
- name: Restart Nginx
service:
name: nginx
state: restarted

View File

@ -40,20 +40,20 @@
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
- name: Check if Nginx conf file for gitea exists or not - name: Check if Nginx conf file exists
stat: path="/etc/nginx/sites-available/{{ http_conf }}" stat: path="/etc/nginx/sites-available/{{ http_conf }}"
register: status register: status
- name: No need to reload Nginx - name: No need to reload Nginx
debug: msg= {{ "No need to reload Nginx as sites-available entries have already been created" }} debug: msg= {{ "No need to reload Nginx as sites-available entries have already been created" }}
- name: Sets Nginx conf file for gitea - name: Set Nginx conf file
when: status.stat.exists == false when: status.stat.exists == false
template: template:
src: "files/nginx.conf.j2" src: "files/nginx.conf.j2"
dest: "/etc/nginx/sites-available/{{ http_conf }}" dest: "/etc/nginx/sites-available/{{ http_conf }}"
- name: Enables new site - name: Enable new site
when: status.stat.exists == false when: status.stat.exists == false
file: file:
src: "/etc/nginx/sites-available/{{ http_conf }}" src: "/etc/nginx/sites-available/{{ http_conf }}"

View File

@ -44,7 +44,6 @@
- "9000:9000" - "9000:9000"
volumes: volumes:
- /var/lib/nextcloud:/var/www/html - /var/lib/nextcloud:/var/www/html
- /dev/urandom:/dev/urandom:ro
- name: Create webserver container - name: Create webserver container
docker_container: docker_container:
@ -58,20 +57,20 @@
volumes: volumes:
- /var/lib/nextcloud:/var/www/html:ro - /var/lib/nextcloud:/var/www/html:ro
- name: Check if Nginx conf file for gitea exists or not - name: Check if Nginx conf file exists
stat: path="/etc/nginx/sites-available/{{ http_conf }}" stat: path="/etc/nginx/sites-available/{{ http_conf }}"
register: status register: status
- name: No need to reload Nginx - name: No need to reload Nginx
debug: msg= {{ "No need to reload Nginx as sites-available entries have already been created" }} debug: msg= {{ "No need to reload Nginx as sites-available entries have already been created" }}
- name: Sets Nginx conf file for gitea - name: Set Nginx conf file
when: status.stat.exists == false when: status.stat.exists == false
template: template:
src: "files/nginx.conf.j2" src: "files/nginx.conf.j2"
dest: "/etc/nginx/sites-available/{{ http_conf }}" dest: "/etc/nginx/sites-available/{{ http_conf }}"
- name: Enables new site - name: Enable new site
when: status.stat.exists == false when: status.stat.exists == false
file: file:
src: "/etc/nginx/sites-available/{{ http_conf }}" src: "/etc/nginx/sites-available/{{ http_conf }}"

View File

@ -1,6 +1,6 @@
--- ---
postgres_name: postgres postgres_name: postgres
postgres_image: postgres postgres_image: postgres:alpine
pg_user: postgres pg_user: postgres
pg_password: '123456' pg_password: '123456'
data_location: /var/lib/postgresql/data data_location: /var/lib/postgresql/data

View File

@ -24,12 +24,21 @@
volumes: volumes:
- /var/lib/trilium:/root/trilium-data - /var/lib/trilium:/root/trilium-data
- name: Sets Nginx conf file for trilium - name: Check if Nginx conf file exists
stat: path="/etc/nginx/sites-available/{{ http_conf }}"
register: status
- name: No need to reload Nginx
debug: msg= {{ "No need to reload Nginx as sites-available entries have already been created" }}
- name: Set Nginx conf file
when: status.stat.exists == false
template: template:
src: "files/nginx.conf.j2" src: "files/nginx.conf.j2"
dest: "/etc/nginx/sites-available/{{ http_conf }}" dest: "/etc/nginx/sites-available/{{ http_conf }}"
- name: Enables new site - name: Enable new site
when: status.stat.exists == false
file: file:
src: "/etc/nginx/sites-available/{{ http_conf }}" src: "/etc/nginx/sites-available/{{ http_conf }}"
dest: "/etc/nginx/sites-enabled/{{ http_conf }}" dest: "/etc/nginx/sites-enabled/{{ http_conf }}"
@ -42,7 +51,3 @@
name: nginx name: nginx
state: reloaded state: reloaded
- name: Restart Nginx
service:
name: nginx
state: restarted