configure nginx via nginx_config variable

This commit is contained in:
Mauro Torrez 2019-10-02 09:36:15 -03:00
parent 8354403c41
commit 8297d853e9

View File

@ -28,6 +28,7 @@
login_port: "{{ mariadb_port }}"
login_user: root
login_password: "{{ mariadb_root_password }}"
when: roundcube_db_engine in ('mariadb','mysql')
- name: create nextcloud db user
mysql_user:
@ -40,6 +41,7 @@
login_port: "{{ mariadb_port }}"
login_user: root
login_password: "{{ mariadb_root_password }}"
when: roundcube_db_engine in ('mariadb','mysql')
- name: start nextcloud container
docker_container:
@ -82,27 +84,21 @@
MAIL_FROM_ADDRESS: "{{ nextcloud_mail_from_address }}"
MAIL_DOMAIN: "{{ nextcloud_mail_domain }}"
networks:
- name: "{{ docker_network_name }}"
- name: "{{ docker_network }}"
ports:
- name: template nginx config
copy:
content: |
location {{ nextcloud_web_root }} {
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://{{ nextcloud_container }}:9000;
}
dest: "{{ nginx_mountpoint_location }}/nextcloud.conf"
register: ngconf
- name: restart frontend
docker_container:
name: "{{ nginx_container }}"
restart: yes
when: ngconf is changed
- name: export nginx config
set_fact:
nginx_config: >-
{{ nginx_config | default({}) | combine({
nextcloud_domain: {
"locations": {
nextcloud_web_root.rstrip('/')+'/': {
"proxy_pass": "http://{}:9000/".format(nextcloud_container)
}
}
}
}) }}
- name: inspect nextcloud volume
docker_volume_info: