From c85806e3289b5e207d51d382f8dc75edad04404d Mon Sep 17 00:00:00 2001 From: Kumar Damani Date: Tue, 23 Aug 2022 12:02:28 -0400 Subject: switched to alpine initial commit --- roles/nginx_docker/tasks/main.yaml | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 roles/nginx_docker/tasks/main.yaml (limited to 'roles/nginx_docker/tasks') 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' -- cgit v1.2.3