ansible-nas/tasks/nginx.yml

38 lines
1.1 KiB
YAML
Raw Normal View History

---
- 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:
- "80:80"
- "443:443"
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