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

Update main.yml

This commit is contained in:
A Holt 2017-12-08 06:49:41 -05:00 committed by GitHub
parent 09808e1e8b
commit f1c049a6e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,11 +3,13 @@
- 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 }}
creates={{ downloads_dir }}/elgg-{{ elgg_version }}.zip args:
creates: "{{ downloads_dir }}/elgg-{{ elgg_version }}.zip"
when: internet_available when: internet_available
- name: Determine if software is already expanded - name: Determine if software is already expanded
stat: path=/opt/elgg-{{ elgg_version }}/index.php stat:
path: "/opt/elgg-{{ elgg_version }}/index.php"
register: elgg register: elgg
# use unzip and shell until unarchive works again # use unzip and shell until unarchive works again
@ -19,106 +21,133 @@
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
file: src=./elgg-{{ elgg_version }} file:
dest=/opt/elgg src: "./elgg-{{ elgg_version }}"
owner={{ apache_user }} dest: /opt/elgg
group={{ apache_user }} owner: "{{ apache_user }}"
state=link group: "{{ apache_user }}"
force=true state: link
force: true
# use template to fix up settings in engine/settings.php with our variables substituted # use template to fix up settings in engine/settings.php with our variables substituted
# into engine/settings.example.php # into engine/settings.example.php
# note this will overwrite any manual settings # note this will overwrite any manual settings
- name: Substitute our parameters in engine/settings.example.php - name: Substitute our parameters in engine/settings.example.php
template: src="settings.php.j2" template:
dest="/opt/{{ elgg_xx }}/elgg-config/settings.php" src: "settings.php.j2"
owner={{ apache_user }} dest: "/opt/{{ elgg_xx }}/elgg-config/settings.php"
group={{ apache_user }} owner: "{{ apache_user }}"
group: "{{ apache_user }}"
# The name of this file changed from 1.9 to 1.10. # The name of this file changed from 1.9 to 1.10.
- name: Copy default .htaccess to the root directory of Elgg tree - name: Copy default .htaccess to the root directory of Elgg tree
copy: src="/opt/{{ elgg_xx }}/vendor/elgg/elgg/install/config/htaccess.dist" copy:
dest="/opt/{{ elgg_xx }}/.htaccess" src: "/opt/{{ elgg_xx }}/vendor/elgg/elgg/install/config/htaccess.dist"
mode=0644 dest: "/opt/{{ elgg_xx }}/.htaccess"
owner={{ apache_user }} mode: 0644
group={{ apache_user }} owner: "{{ apache_user }}"
group: "{{ apache_user }}"
#regexp='^#RewriteBase' #regexp='^#RewriteBase'
- name: Modify .htaccess to have RewriteBase as our directory - name: Modify .htaccess to have RewriteBase as our directory
lineinfile: backup=no lineinfile:
dest="/opt/{{ elgg_xx }}/.htaccess" backup: no
state=present dest: "/opt/{{ elgg_xx }}/.htaccess"
insertafter='^#RewriteBase' state: present
line="RewriteBase {{ elgg_url }}/" insertafter: '^#RewriteBase'
line: "RewriteBase {{ elgg_url }}/"
- name: Change permissions on engine directory so Apache can write - name: Change permissions on engine directory so Apache can write
file: path=/opt/elgg/engine/ owner={{ apache_user }} mode=0755 state=directory file:
path: /opt/elgg/engine/
owner: "{{ apache_user }}"
mode: 0755
state: directory
- name: Create an upload directory that Apache can write in or Elgg - name: Create an upload directory that Apache can write in or Elgg
file: path={{ elgg_upload_path }} state=directory owner={{ apache_user }} file:
path: "{{ elgg_upload_path }}"
state: directory
owner: "{{ apache_user }}"
- name: Change ownership - name: Change ownership
file: path=/opt/elgg-{{ elgg_version }} file:
owner={{ apache_user }} path: "/opt/elgg-{{ elgg_version }}"
group={{ apache_user }} owner: "{{ apache_user }}"
recurse=yes group: "{{ apache_user }}"
state=directory recurse: yes
state: directory
- name: Create a MySQL database for Elgg - can be run more than once - name: Create a MySQL database for Elgg - can be run more than once
mysql_db: name={{ dbname }} mysql_db:
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 a user to access the Elgg database - can be run more than once
mysql_user: name={{ dbuser }} host={{ item }} password={{ dbpassword }} priv={{ dbname }}.*:ALL mysql_user:
name: "{{ dbuser }}"
host: "{{ item }}"
password: "{{ dbpassword }}"
priv: "{{ dbname }}.*:ALL"
with_items: with_items:
- 127.0.0.1 - 127.0.0.1
- ::1 - ::1
- localhost - localhost
- name: Create file to load database - name: Create file to load database
template: src=elggdb.sql.j2 template:
dest=/tmp/elggdb.sql src: "elggdb.sql.j2"
dest: "/tmp/elggdb.sql"
# elggdb.sql obtained with mysqldump --skip-add-drop-table elggdb > 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 # 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 dump
mysql_db: name={{ dbname }} mysql_db:
state=import name: "{{ dbname }}"
target=/tmp/elggdb.sql state: import
target: /tmp/elggdb.sql
when: create_elgg_database.changed when: create_elgg_database.changed
- name: Remove database dump after load - name: Remove database dump after load
file: name=/tmp/elggdb.sql state=absent file:
name: /tmp/elggdb.sql
state: absent
- name: Install config file for Elgg in Apache - name: Install config file for Elgg in Apache
template: src=elgg.conf dest=/etc/{{ apache_config_dir }}/elgg.conf template:
src: elgg.conf
dest: "/etc/{{ apache_config_dir }}/elgg.conf"
- name: Enable Elgg for debuntu (will already be enabled above for redhat) - name: Enable Elgg for debuntu (will already be enabled above for redhat)
file: path=/etc/apache2/sites-enabled/elgg.conf file:
src=/etc/apache2/sites-available/elgg.conf src: /etc/apache2/sites-available/elgg.conf
state=link dest: /etc/apache2/sites-enabled/elgg.conf
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: Disable Elgg - remove config file for Elgg in Apache (debuntu)
file: path=/etc/apache2/sites-enabled/elgg.conf file:
state=absent path: /etc/apache2/sites-enabled/elgg.conf
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: Disable Elgg - remove config file for Elgg in Apache (redhat)
file: dest=/etc/{{ apache_config_dir }}/elgg.conf file:
state=absent dest: "/etc/{{ apache_config_dir }}/elgg.conf"
state: absent
when: not elgg_enabled and is_redhat when: not elgg_enabled and is_redhat
- name: Add 'elgg' to service list - name: Add 'elgg' to list of services at /etc/iiab/iiab.ini
ini_file: dest='{{ service_filelist }}' ini_file:
dest: "{{ service_filelist }}"
section=elgg section=elgg
option='{{ item.option }}' option: "{{ item.option }}"
value='{{ item.value }}' value= "{{ item.value }}"
with_items: with_items:
- option: name - option: name
value: elgg-social-netwoking value: Elgg
- option: description - option: description
value: '"Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications."' value: '"Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications."'
- option: path - option: path
@ -127,4 +156,6 @@
value: "{{ elgg_enabled }}" value: "{{ elgg_enabled }}"
- name: Restart Apache, so it picks up the new aliases - name: Restart Apache, so it picks up the new aliases
service: name={{ apache_service }} state=restarted service:
name: "{{ apache_service }}"
state: restarted