2022-11-26 08:15:18 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: create nginx-proxy volume folders
|
2022-11-26 08:52:41 +00:00
|
|
|
ansible.builtin.file:
|
|
|
|
name: '{{ services.nginx_proxy.volume_folder }}/{{ volume }}'
|
2022-11-26 08:15:18 +00:00
|
|
|
state: directory
|
|
|
|
loop:
|
|
|
|
- conf
|
|
|
|
- vhost
|
|
|
|
- html
|
|
|
|
- dhparam
|
|
|
|
- certs
|
|
|
|
loop_control:
|
|
|
|
loop_var: volume
|
|
|
|
|
|
|
|
- name: nginx proxy container
|
2022-11-26 08:52:41 +00:00
|
|
|
community.docker.docker_container:
|
2022-11-26 08:15:18 +00:00
|
|
|
name: nginx-proxy
|
|
|
|
image: nginxproxy/nginx-proxy:{{ services.nginx_proxy.version }}
|
|
|
|
restart_policy: always
|
|
|
|
networks:
|
|
|
|
- name: external_services
|
|
|
|
published_ports:
|
2022-11-26 08:52:41 +00:00
|
|
|
- 80:80
|
|
|
|
- 443:443
|
2022-11-26 08:15:18 +00:00
|
|
|
volumes:
|
2022-11-26 08:52:41 +00:00
|
|
|
- '{{ services.nginx_proxy.volume_folder }}/conf:/etc/nginx/conf.d'
|
|
|
|
- '{{ services.nginx_proxy.volume_folder }}/vhost:/etc/nginx/vhost.d'
|
|
|
|
- '{{ services.nginx_proxy.volume_folder }}/html:/usr/share/nginx/html'
|
|
|
|
- '{{ services.nginx_proxy.volume_folder }}/dhparam:/etc/nginx/dhparam'
|
|
|
|
- '{{ services.nginx_proxy.volume_folder }}/certs:/etc/nginx/certs:ro'
|
2022-11-26 08:15:18 +00:00
|
|
|
- /var/run/docker.sock:/tmp/docker.sock:ro
|
|
|
|
|
|
|
|
- name: nginx letsencrypt container
|
2022-11-26 08:52:41 +00:00
|
|
|
community.docker.docker_container:
|
2022-11-26 08:15:18 +00:00
|
|
|
name: nginx-proxy-le
|
|
|
|
image: nginxproxy/acme-companion:{{ services.nginx_acme_companion.version }}
|
|
|
|
restart_policy: always
|
|
|
|
volumes:
|
2022-11-26 08:52:41 +00:00
|
|
|
- '{{ services.nginx_proxy.volume_folder }}/vhost:/etc/nginx/vhost.d'
|
|
|
|
- '{{ services.nginx_proxy.volume_folder }}/html:/usr/share/nginx/html'
|
|
|
|
- '{{ services.nginx_proxy.volume_folder }}/dhparam:/etc/nginx/dhparam:ro'
|
|
|
|
- '{{ services.nginx_proxy.volume_folder }}/certs:/etc/nginx/certs'
|
2022-11-26 08:15:18 +00:00
|
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
|
|
env:
|
|
|
|
NGINX_PROXY_CONTAINER: nginx-proxy
|
|
|
|
when: letsencrypt_enabled
|