1
0
Fork 0
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:
root 2020-01-12 12:12:49 -05:00
parent ef93b30370
commit fff83cd5fb
22 changed files with 223 additions and 271 deletions

View file

@ -1,41 +1,39 @@
- name: Create symlink elgg.conf from sites-enabled to sites-available (debuntu, not nec for redhat)
file:
src: /etc/apache2/sites-available/elgg.conf
path: /etc/apache2/sites-enabled/elgg.conf
state: link
when: elgg_enabled and is_debuntu
# Apache
- name: Remove symlink /etc/apache2/sites-enabled/elgg.conf (debuntu)
file:
path: /etc/apache2/sites-enabled/elgg.conf
state: absent
when: not elgg_enabled and is_debuntu
- name: Enable http://box{{ elgg_url }} via Apache # http://box/elgg
command: a2ensite elgg.conf
when: apache_install and elgg_enabled
- name: Remove Apache's elgg.conf (redhat)
file:
dest: "/etc/{{ apache_config_dir }}/elgg.conf"
state: absent
when: not elgg_enabled and is_redhat
- name: Disable http://box{{ elgg_url }} via Apache # http://box/elgg
command: a2dissite elgg.conf
when: apache_install and not elgg_enabled
- name: Install {{ nginx_config_dir }}/elgg-nginx.conf from template
template:
src: elgg-nginx.conf
dest: "{{ nginx_config_dir }}/elgg-nginx.conf"
when: elgg_enabled and nginx_enabled
- name: Restart Apache ({{ apache_service }}) to enable/disable http://box/elgg
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
name: "{{ apache_service }}"
daemon_reload: yes
state: restarted
when: apache_enabled
when: apache_enabled | bool
- name: Restart nginx to enable/disable http://box/elgg
# NGINX
- name: "SHIM: Enable http://box{{ elgg_url }} via NGINX, by installing {{ nginx_config_dir }}/elgg-nginx.conf from template" # http://box/elgg
template:
src: elgg-nginx.conf.j2
dest: "{{ nginx_config_dir }}/elgg-nginx.conf"
when: nginx_install and elgg_enabled
- name: "SHIM: Disable http://box{{ elgg_url }} via NGINX, by removing {{ nginx_config_dir }}/elgg-nginx.conf" # http://box/elgg
file:
path: "{{ nginx_config_dir }}/elgg-nginx.conf"
state: absent
when: nginx_install and not elgg_enabled
- name: Restart 'nginx' systemd service
systemd:
name: nginx
daemon_reload: yes
state: restarted
when: nginx_enabled
when: nginx_enabled | bool
- name: Add 'elgg' variable values to {{ iiab_ini_file }}
ini_file:

View file

@ -53,7 +53,7 @@
group: "{{ apache_user }}"
#regexp='^#RewriteBase'
- name: Change .htaccess to include RewriteBase for http://box/elgg
- name: Change .htaccess to include RewriteBase for http://box{{ elgg_url }} # http://box/elgg
lineinfile:
backup: no
path: "/opt/{{ elgg_xx }}/.htaccess"
@ -82,7 +82,7 @@
state: directory
owner: "{{ apache_user }}"
- name: Install /etc/{{ apache_config_dir }}/elgg.conf from template, for http://box/elgg
- name: Install /etc/{{ apache_config_dir }}/elgg.conf from template, for http://box{{ elgg_url }} # http://box/elgg
template:
src: elgg.conf
dest: "/etc/{{ apache_config_dir }}/elgg.conf"
@ -92,5 +92,3 @@
dest: "{{ iiab_state_file }}"
regexp: '^elgg_installed'
line: 'elgg_installed: True'
state: present

View file

@ -3,7 +3,7 @@
name: "{{ dbname }}"
register: create_elgg_database
- name: Create user/password to access Elgg database - can be run more than once
- name: Create MySQL user {{ dbuser }} and password to access Elgg database - can be run more than once
mysql_user:
name: "{{ dbuser }}"
host: "{{ item }}"
@ -16,8 +16,8 @@
- name: Create /tmp/elggdb.sql from template, to load database
template:
src: "elggdb.sql.j2"
dest: "/tmp/elggdb.sql"
src: elggdb.sql.j2
dest: /tmp/elggdb.sql
# elggdb.sql obtained with mysqldump --skip-add-drop-table elggdb > elggdb.sql
# tar up a mysqldump of freshly installed database and use it in the install to avoid the startup
@ -28,7 +28,7 @@
name: "{{ dbname }}"
state: import
target: /tmp/elggdb.sql
when: create_elgg_database.changed
when: create_elgg_database.changed | bool
- name: Remove database dump /tmp/elggdb.sql
file:

View file

@ -1,3 +0,0 @@
location /elgg {
proxy_pass http://127.0.0.1:{{ apache_port }}/elgg;
}

View file

@ -0,0 +1,3 @@
location {{ elgg_url }}/ {
proxy_pass http://127.0.0.1:{{ apache_port }}{{ elgg_url }}/;
}

View file

@ -541,7 +541,7 @@ CREATE TABLE `elgg_sites_entity` (
LOCK TABLES `elgg_sites_entity` WRITE;
/*!40000 ALTER TABLE `elgg_sites_entity` DISABLE KEYS */;
INSERT INTO `elgg_sites_entity` VALUES (1,'My New Community','','http://box/elgg/');
INSERT INTO `elgg_sites_entity` VALUES (1,'My New Community','','http://box{{ elgg_url }}/');
/*!40000 ALTER TABLE `elgg_sites_entity` ENABLE KEYS */;
UNLOCK TABLES;