mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Refine @jvonau\'s \'Move NGINX shims to roles\'
This commit is contained in:
parent
ef93b30370
commit
fff83cd5fb
22 changed files with 223 additions and 271 deletions
|
|
@ -1,47 +1,39 @@
|
|||
# This should go in computed_network.yml, but here for now
|
||||
#- name: Compute Nextcloud listen ip addr for nextcloud.conf
|
||||
# set_fact:
|
||||
# nextcloud_required_ip: "{{ ansible_default_ipv4.network }}/{{ ansible_default_ipv4.netmask }}"
|
||||
# when: ansible_default_ipv4.network is defined
|
||||
# Apache
|
||||
|
||||
- name: Create symlink nextcloud.conf from sites-enabled to sites-available for http://box/nextcloud (debuntu)
|
||||
file:
|
||||
src: "/etc/{{ apache_config_dir }}/nextcloud.conf"
|
||||
path: /etc/apache2/sites-enabled/nextcloud.conf
|
||||
state: link
|
||||
when: nextcloud_enabled and is_debuntu
|
||||
- name: Enable http://box{{ nextcloud_url }} via Apache # http://box/nextcloud
|
||||
command: a2ensite nextcloud.conf
|
||||
when: apache_install and nextcloud_enabled
|
||||
|
||||
- name: Remove symlink nextcloud.conf from /etc/apache2/sites-enabled if not nextcloud_enabled (debuntu)
|
||||
file:
|
||||
path: /etc/apache2/sites-enabled/nextcloud.conf
|
||||
state: absent
|
||||
when: not nextcloud_enabled and is_debuntu
|
||||
- name: Disable http://box{{ nextcloud_url }} via Apache # http://box/nextcloud
|
||||
command: a2dissite nextcloud.conf
|
||||
when: apache_install and not nextcloud_enabled
|
||||
|
||||
- name: Remove sites-available/nextcloud.conf if not nextcloud_enabled (redhat)
|
||||
file:
|
||||
path: "/etc/{{ apache_config_dir }}/nextcloud.conf"
|
||||
state: absent
|
||||
when: not nextcloud_enabled and is_redhat
|
||||
|
||||
- name: Install Nextcloud's nginx conf.d file from template
|
||||
template:
|
||||
src: nextcloud-nginx.conf
|
||||
dest: "{{ nginx_config_dir }}/nextcloud-nginx.conf"
|
||||
when: nextcloud_enabled and nginx_enabled
|
||||
|
||||
- name: Restart {{ apache_service }}, enabling/disabling http://box/nextcloud
|
||||
- name: Restart Apache systemd service ({{ apache_service }})
|
||||
systemd:
|
||||
name: "{{ apache_service }}"
|
||||
daemon-reload: yes
|
||||
state: restarted
|
||||
when: apache_enabled | bool
|
||||
|
||||
- name: Restart nginx enabling/disabling http://box/nextcloud
|
||||
# NGINX
|
||||
|
||||
- name: "SHIM: Enable http://box{{ nextcloud_url }} via NGINX, by installing {{ nginx_config_dir }}/nextcloud-nginx.conf from template" # http://box/nextcloud
|
||||
template:
|
||||
src: nextcloud-nginx.conf.j2
|
||||
dest: "{{ nginx_config_dir }}/nextcloud-nginx.conf"
|
||||
when: nginx_install and nextcloud_enabled
|
||||
|
||||
- name: "SHIM: Disable http://box{{ nextcloud_url }} via NGINX, by removing {{ nginx_config_dir }}/nextcloud-nginx.conf" # http://box/nextcloud
|
||||
file:
|
||||
path: "{{ nginx_config_dir }}/nextcloud-nginx.conf"
|
||||
state: absent
|
||||
when: nginx_install and not nextcloud_enabled
|
||||
|
||||
- name: Restart 'nginx' systemd service
|
||||
systemd:
|
||||
name: nginx
|
||||
daemon-reload: yes
|
||||
state: restarted
|
||||
when: nginx_enabled
|
||||
when: nginx_enabled | bool
|
||||
|
||||
|
||||
- name: Add 'nextcloud' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@
|
|||
#validate_certs: False # TEMPORARY ON/AFTER 2018-07-22 AS download.nextcloud.com CERT EXPIRED: https://github.com/iiab/iiab/issues/954
|
||||
#async: 1800
|
||||
#poll: 10
|
||||
tags:
|
||||
- download
|
||||
when: internet_available and not php_new
|
||||
#when: internet_available and nextcloud_force_install and (is_debian_9 or is_raspbian_9 or is_ubuntu_16)
|
||||
|
||||
|
|
@ -63,8 +61,6 @@
|
|||
#validate_certs: False # TEMPORARY ON/AFTER 2018-07-22 AS download.nextcloud.com CERT EXPIRED: https://github.com/iiab/iiab/issues/954
|
||||
#async: 1800
|
||||
#poll: 10
|
||||
tags:
|
||||
- download
|
||||
when: internet_available and php_new
|
||||
#when: internet_available and nextcloud_force_install and not (is_debian_9 or is_raspbian_9 or is_ubuntu_16)
|
||||
|
||||
|
|
@ -155,7 +151,7 @@
|
|||
dest: "{{ nextcloud_prefix }}/nextcloud/config/autoconfig.php"
|
||||
owner: "{{ apache_user }}"
|
||||
group: "{{ apache_user }}"
|
||||
mode: 0640
|
||||
mode: '0640'
|
||||
when: is_centos | bool
|
||||
|
||||
- name: chown -R {{ apache_user }}:{{ apache_user }} {{ nextcloud_prefix }}/nextcloud
|
||||
|
|
@ -171,20 +167,16 @@
|
|||
path: "{{ nextcloud_data_dir }}"
|
||||
owner: "{{ apache_user }}"
|
||||
group: "{{ apache_user }}"
|
||||
mode: 0750
|
||||
mode: '0750'
|
||||
state: directory
|
||||
|
||||
- name: Install Apache's nextcloud.conf from template, for http://box/nextcloud
|
||||
template:
|
||||
src: nextcloud.conf.j2
|
||||
dest: "/etc/{{ apache_config_dir }}/nextcloud.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: "Add 'nextcloud_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
||||
lineinfile:
|
||||
dest: "{{ iiab_state_file }}"
|
||||
regexp: '^nextcloud_installed'
|
||||
line: 'nextcloud_installed: True'
|
||||
state: present
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
location /nextcloud {
|
||||
proxy_pass http://127.0.0.1:{{ apache_port }}/nextcloud;
|
||||
location {{ nextcloud_url }} {
|
||||
proxy_pass http://127.0.0.1:{{ apache_port }}{{ nextcloud_url }};
|
||||
}
|
||||
|
||||
location ~ /nextcloud/.*\.php$ {
|
||||
location ~ {{ nextcloud_url }}/.*\.php$ {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass http://127.0.0.1:{{ apache_port }};
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue