diff --git a/defaults/main.yml b/defaults/main.yml index f1ddba5..3185f79 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,7 +1,7 @@ --- # domain, webroot -roundcube_domain: example.com -roundcube_web_root: / +roundcube_domain: default +roundcube_web_root: /roundcube # container roundcube_image: roundcube/roundcubemail diff --git a/tasks/main.yml b/tasks/main.yml index bd69f72..062a645 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -29,7 +29,7 @@ login_user: root login_password: "{{ mariadb_root_password }}" when: roundcube_db_type in ('mariadb','mysql') - + - name: create roundcube db user mysql_user: state: present @@ -66,23 +66,28 @@ - name: "{{ docker_network_name }}" ports: -- name: template nginx config - copy: - content: | - location {{ roundcube_web_root }} { +- name: template nginx domain config + when: roundcube_domain != 'default' + include_role: + name: nginx-docker + tasks_from: domain.yml + vars: + ng_domain_name: "{{ roundcube_domain }}" + +- name: template nginx location config + include_role: + name: nginx-docker + tasks_from: location.yml + vars: + ng_domain_name: "{{ roundcube_domain }}" + ng_location_name: "{{ roundcube_web_root }}" + ng_location_content: | proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://{{ roundcube_container }}; - } - dest: "{{ nginx_location_mountpoint }}/roundcube.conf" - register: ngconf -- name: restart frontend - docker_container: - name: "{{ nginx_container_name }}" - restart: yes - when: ngconf is changed +- meta: run_handlers - name: inspect roundcube volume docker_volume_info: