forked from data.coop/ansible
48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
---
|
|
|
|
- name: create nginx-proxy volume folders
|
|
file:
|
|
name: "{{ nginx.volume_folder }}/{{ volume }}"
|
|
state: directory
|
|
loop:
|
|
- conf
|
|
- vhost
|
|
- html
|
|
- dhparam
|
|
- certs
|
|
loop_control:
|
|
loop_var: volume
|
|
|
|
- name: nginx proxy container
|
|
docker_container:
|
|
name: nginx-proxy
|
|
image: nginxproxy/nginx-proxy:1.0-alpine
|
|
restart_policy: always
|
|
networks:
|
|
- name: external_services
|
|
published_ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- "{{ 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
|
|
docker_container:
|
|
name: nginx-proxy-le
|
|
image: nginxproxy/acme-companion:2.2
|
|
restart_policy: always
|
|
volumes:
|
|
- "{{ 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
|
|
|