From fce600d56ce889f5cc11dca5b5986f08263b8899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Wed, 13 Feb 2019 10:36:04 +0100 Subject: [PATCH] Moving nginx volumes to bind volumes. --- roles/docker/defaults/main.yml | 3 +++ roles/docker/tasks/services/nginx-proxy.yml | 27 ++++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 3670b6b..0c58763 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -1,3 +1,6 @@ +nginx: + volume_folder: "{{ volume_root_folder }}/nginx" + ldap: domain: "ldap.{{ base_domain }}" diff --git a/roles/docker/tasks/services/nginx-proxy.yml b/roles/docker/tasks/services/nginx-proxy.yml index a97edd2..7e8ff41 100644 --- a/roles/docker/tasks/services/nginx-proxy.yml +++ b/roles/docker/tasks/services/nginx-proxy.yml @@ -1,8 +1,10 @@ --- -- docker_volume: - name: "{{ volume }}" - with_items: +- name: create nginx-proxy volume folders + file: + name: "{{ nginx.volume_folder }}/{{ volume }}" + state: directory + loop: - conf - vhost - html @@ -22,11 +24,11 @@ - "80:80" - "443:443" volumes: - - conf:/etc/nginx/conf.d - - vhost:/etc/nginx/vhost.d - - html:/usr/share/nginx/html - - dhparam:/etc/nginx/dhparam - - certs:/etc/nginx/certs:ro + - "{{ nginx.volume_folder }}/conf:/etc/nginx/conf.d" + - "{{ nginx.volume_folder }}/vhost:/etc/nginx/vhost.d" + - "{{ nginx.volume_folder }}/html:/usr/share/nginx/html" + - "{{ nginx.volume_folder }}/dhparam:/etc/nginx/dhparam" + - "{{ nginx.volume_folder }}/certs:/etc/nginx/certs:ro" - /var/run/docker.sock:/tmp/docker.sock:ro - name: nginx letsencrypt container @@ -35,10 +37,11 @@ image: jrcs/letsencrypt-nginx-proxy-companion restart_policy: always volumes: - - vhost:/etc/nginx/vhost.d - - html:/usr/share/nginx/html - - dhparam:/etc/nginx/dhparam:ro - - certs:/etc/nginx/certs + - "{{ nginx.volume_folder }}/vhost:/etc/nginx/vhost.d" + - "{{ nginx.volume_folder }}/html:/usr/share/nginx/html" + - "{{ nginx.volume_folder }}/dhparam:/etc/nginx/dhparam:ro" + - "{{ nginx.volume_folder }}/certs:/etc/nginx/certs" - /var/run/docker.sock:/var/run/docker.sock:ro env: NGINX_PROXY_CONTAINER: nginx-proxy +