2018-10-02 22:03:56 +00:00
|
|
|
---
|
|
|
|
- name: Create Nginx Directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
with_items:
|
|
|
|
- "{{ nginx_data_directory }}"
|
|
|
|
- "{{ nginx_data_directory }}/certs"
|
|
|
|
- "{{ nginx_data_directory }}/html"
|
|
|
|
- "{{ nginx_data_directory }}/vhost.d"
|
|
|
|
|
|
|
|
- name: Nginx Docker Container
|
|
|
|
docker_container:
|
|
|
|
name: nginx-proxy
|
|
|
|
image: jwilder/nginx-proxy
|
|
|
|
pull: true
|
|
|
|
ports:
|
2020-01-05 21:47:40 +00:00
|
|
|
- "{{ nginx_port_http }}:80"
|
|
|
|
- "{{ nginx_port_https }}:443"
|
2018-10-02 22:03:56 +00:00
|
|
|
volumes:
|
|
|
|
- "{{ nginx_data_directory }}/certs:/etc/nginx/certs:ro"
|
|
|
|
- "{{ nginx_data_directory }}/vhost.d:/etc/nginx/vhost.d:rw"
|
|
|
|
- "{{ nginx_data_directory }}/html:/usr/share/nginx/html:rw"
|
|
|
|
- "/var/run/docker.sock:/tmp/docker.sock:ro"
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
memory: 1g
|
|
|
|
|
|
|
|
- name: Nginx Letsencrypt Container
|
|
|
|
docker_container:
|
|
|
|
name: letsencrypt-nginx-proxy-companion
|
|
|
|
image: jrcs/letsencrypt-nginx-proxy-companion
|
|
|
|
pull: true
|
|
|
|
volumes:
|
|
|
|
- "{{ nginx_data_directory }}/certs:/etc/nginx/certs:rw"
|
|
|
|
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
|
|
|
volumes_from: nginx-proxy
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
memory: 1g
|