blob: bda276ea81e635412d47b266835665499783b4fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
---
- name: 'Ensure conf dir exists'
file:
path: '{{ item }}'
state: 'directory'
mode: '755'
loop:
- '{{ nginx_conf_root }}'
- '{{ nginx_static_html_root }}'
- '{{ nginx_certs_root }}'
- name: 'Copy the http nginx.conf files'
template:
src: 'http.nginx.conf.j2'
dest: '{{ nginx_conf_root }}/{{ item }}.conf'
mode: '644'
loop: '{{ nginx_website_domains }}'
- name: 'Copy the http nginx.conf for apps'
template:
src: 'app.nginx.conf.j2'
dest: '{{ nginx_conf_root }}/{{ item.app }}.conf'
mode: '644'
when: 'item.conf.access_domain is defined'
loop: '{{ nginx_apps_confs }}'
- name: 'Start the Nginx container'
community.docker.docker_container:
name: 'nginx'
image: 'nginx:alpine'
pull: true
state: 'started'
recreate: false
volumes:
# configs
- '{{ nginx_conf_root }}:/etc/nginx/conf.d/:ro'
# static pages html
- '{{ nginx_static_html_root }}:/var/www/:ro'
# ssl certs
- '{{ nginx_certs_root }}:/etc/letsencrypt/:ro'
network_mode: 'host'
restart_policy: 'unless-stopped'
|