diff options
| author | Kumar Damani <me@kumardamani.net> | 2022-08-23 16:02:28 +0000 |
|---|---|---|
| committer | Kumar Damani <me@kumardamani.net> | 2022-09-07 20:15:37 +0000 |
| commit | c85806e3289b5e207d51d382f8dc75edad04404d (patch) | |
| tree | 244d2f1ad38320863fb60f695c88c97799be1171 /roles/nginx_docker/tasks | |
| parent | 4d34de2f5e757bfeae5738547aabb61d3d28a2f8 (diff) | |
switched to alpine initial commit
Diffstat (limited to 'roles/nginx_docker/tasks')
| -rw-r--r-- | roles/nginx_docker/tasks/main.yaml | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/roles/nginx_docker/tasks/main.yaml b/roles/nginx_docker/tasks/main.yaml new file mode 100644 index 0000000..bda276e --- /dev/null +++ b/roles/nginx_docker/tasks/main.yaml @@ -0,0 +1,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' |
