1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #1260 from holta/elgg-warnings

Clean roles/elgg/tasks/main.yml to remove warnings
This commit is contained in:
A Holt 2018-10-28 16:12:23 -04:00 committed by GitHub
commit eb00877951
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +1,14 @@
# Assume we only get here if elgg_install: True # Assume we only get here if elgg_install: True
# Assume mysql is running # Assume MySQL is running
- name: Download current version from our site - name: Download current version from our site
shell: wget {{ iiab_download_url }}/elgg-{{ elgg_version }}.zip -c -P {{ downloads_dir }} #shell: wget {{ iiab_download_url }}/elgg-{{ elgg_version }}.zip -c -P {{ downloads_dir }}
args: #args:
creates: "{{ downloads_dir }}/elgg-{{ elgg_version }}.zip" # creates: "{{ downloads_dir }}/elgg-{{ elgg_version }}.zip"
get_url:
url: "{{ iiab_download_url }}/elgg-{{ elgg_version }}.zip"
dest: "{{ downloads_dir }}"
timeout: "{{ download_timeout }}"
when: internet_available when: internet_available
- name: Determine if software is already expanded - name: Determine if software is already expanded
@ -12,12 +16,15 @@
path: "/opt/elgg-{{ elgg_version }}/index.php" path: "/opt/elgg-{{ elgg_version }}/index.php"
register: elgg register: elgg
# use unzip and shell until unarchive works again
# unarchive: dest=/opt/
# src={{ downloads_dir }}/elgg-{{ elgg_version }}.zip
- name: Expand it to our location unless already done - name: Expand it to our location unless already done
shell: "/usr/bin/unzip -o {{ downloads_dir }}/elgg-{{ elgg_version }}.zip -d /opt" #shell: "/usr/bin/unzip -o {{ downloads_dir }}/elgg-{{ elgg_version }}.zip -d /opt"
unarchive:
#remote_src: yes
#src: "{{ iiab_download_url }}/elgg-{{ elgg_version }}.zip"
src: "{{ downloads_dir }}/elgg-{{ elgg_version }}.zip"
dest: /opt
owner: "{{ apache_user }}"
group: "{{ apache_user }}"
when: elgg.stat.exists is defined and not elgg.stat.exists when: elgg.stat.exists is defined and not elgg.stat.exists
- name: Create a link to the versioned elgg-* folder - name: Create a link to the versioned elgg-* folder
@ -29,9 +36,7 @@
state: link state: link
force: true force: true
# Use template to fix up settings in elgg-config/settings.php with our variables substituted. - name: 'Install /opt/elgg/elgg-config/settings.php from template (WARNING: overwrites manual settings!)'
# Note this will overwrite any manual settings.
- name: Substitute our parameters in /opt/elgg/elgg-config/settings.php
template: template:
src: "settings.php.j2" src: "settings.php.j2"
dest: "/opt/{{ elgg_xx }}/elgg-config/settings.php" dest: "/opt/{{ elgg_xx }}/elgg-config/settings.php"
@ -69,7 +74,7 @@
state: directory state: directory
owner: "{{ apache_user }}" owner: "{{ apache_user }}"
- name: Change ownership - name: Change ownership (likely not nec, unarchive & all do this above)
file: file:
path: "/opt/elgg-{{ elgg_version }}" path: "/opt/elgg-{{ elgg_version }}"
owner: "{{ apache_user }}" owner: "{{ apache_user }}"
@ -82,7 +87,7 @@
name: "{{ dbname }}" name: "{{ dbname }}"
register: create_elgg_database register: create_elgg_database
- name: Create a user to access the Elgg database - can be run more than once - name: Create user/password to access Elgg database - can be run more than once
mysql_user: mysql_user:
name: "{{ dbuser }}" name: "{{ dbuser }}"
host: "{{ item }}" host: "{{ item }}"
@ -93,7 +98,7 @@
- ::1 - ::1
- localhost - localhost
- name: Create file to load database - name: Create /tmp/elggdb.sql from template, to load database
template: template:
src: "elggdb.sql.j2" src: "elggdb.sql.j2"
dest: "/tmp/elggdb.sql" dest: "/tmp/elggdb.sql"
@ -102,42 +107,47 @@
# tar up a mysqldump of freshly installed database and use it in the install to avoid the startup # tar up a mysqldump of freshly installed database and use it in the install to avoid the startup
# form, which worries me a lot. (/var/lib/mysql/elggdb) # form, which worries me a lot. (/var/lib/mysql/elggdb)
- name: Load Elgg database dump - name: Load Elgg database from /tmp/elggdb.sql
mysql_db: mysql_db:
name: "{{ dbname }}" name: "{{ dbname }}"
state: import state: import
target: /tmp/elggdb.sql target: /tmp/elggdb.sql
when: create_elgg_database.changed when: create_elgg_database.changed
- name: Remove database dump after load - name: Remove database dump /tmp/elggdb.sql
file: file:
name: /tmp/elggdb.sql name: /tmp/elggdb.sql
state: absent state: absent
- name: Install config file for Elgg in Apache - name: Install Apache's elgg.conf from template, for http://box/elgg
template: template:
src: elgg.conf src: elgg.conf
dest: "/etc/{{ apache_config_dir }}/elgg.conf" dest: "/etc/{{ apache_config_dir }}/elgg.conf"
- name: Enable Elgg for debuntu (will already be enabled above for redhat) - name: Create symlink elgg.conf from sites-enabled to sites-available (debuntu, not nec for redhat)
file: file:
src: /etc/apache2/sites-available/elgg.conf src: /etc/apache2/sites-available/elgg.conf
dest: /etc/apache2/sites-enabled/elgg.conf path: /etc/apache2/sites-enabled/elgg.conf
state: link state: link
when: elgg_enabled and is_debuntu when: elgg_enabled and is_debuntu
- name: Disable Elgg - remove config file for Elgg in Apache (debuntu) - name: Remove symlink elgg.conf from sites-enabled (debuntu)
file: file:
path: /etc/apache2/sites-enabled/elgg.conf path: /etc/apache2/sites-enabled/elgg.conf
state: absent state: absent
when: not elgg_enabled and is_debuntu when: not elgg_enabled and is_debuntu
- name: Disable Elgg - remove config file for Elgg in Apache (redhat) - name: Remove Apache's elgg.conf (redhat)
file: file:
dest: "/etc/{{ apache_config_dir }}/elgg.conf" dest: "/etc/{{ apache_config_dir }}/elgg.conf"
state: absent state: absent
when: not elgg_enabled and is_redhat when: not elgg_enabled and is_redhat
- name: Restart Apache, to enable/disable http://box/elgg
service:
name: "{{ apache_service }}"
state: restarted
- name: Add 'elgg' to list of services at {{ iiab_ini_file }} - name: Add 'elgg' to list of services at {{ iiab_ini_file }}
ini_file: ini_file:
dest: "{{ iiab_ini_file }}" dest: "{{ iiab_ini_file }}"
@ -153,8 +163,3 @@
value: /opt/elgg value: /opt/elgg
- option: enabled - option: enabled
value: "{{ elgg_enabled }}" value: "{{ elgg_enabled }}"
- name: Restart Apache, so it picks up the new aliases
service:
name: "{{ apache_service }}"
state: restarted