netter nging location definition

This commit is contained in:
Mauro Torrez 2019-09-06 00:44:48 -03:00
parent a9ff4f484b
commit 5d36d9edc5
2 changed files with 20 additions and 15 deletions

View File

@ -1,7 +1,7 @@
--- ---
# domain, webroot # domain, webroot
roundcube_domain: example.com roundcube_domain: default
roundcube_web_root: / roundcube_web_root: /roundcube
# container # container
roundcube_image: roundcube/roundcubemail roundcube_image: roundcube/roundcubemail

View File

@ -29,7 +29,7 @@
login_user: root login_user: root
login_password: "{{ mariadb_root_password }}" login_password: "{{ mariadb_root_password }}"
when: roundcube_db_type in ('mariadb','mysql') when: roundcube_db_type in ('mariadb','mysql')
- name: create roundcube db user - name: create roundcube db user
mysql_user: mysql_user:
state: present state: present
@ -66,23 +66,28 @@
- name: "{{ docker_network_name }}" - name: "{{ docker_network_name }}"
ports: ports:
- name: template nginx config - name: template nginx domain config
copy: when: roundcube_domain != 'default'
content: | include_role:
location {{ roundcube_web_root }} { 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 Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://{{ roundcube_container }}; proxy_pass http://{{ roundcube_container }};
}
dest: "{{ nginx_location_mountpoint }}/roundcube.conf"
register: ngconf
- name: restart frontend - meta: run_handlers
docker_container:
name: "{{ nginx_container_name }}"
restart: yes
when: ngconf is changed
- name: inspect roundcube volume - name: inspect roundcube volume
docker_volume_info: docker_volume_info: