1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/lokole/tasks/install.yml

113 lines
3.1 KiB
YAML
Raw Normal View History

2018-07-08 01:31:08 +00:00
- name: Install packages required by Lokole
2018-07-08 01:21:42 +00:00
package:
name: "{{ item }}"
state: present
with_items:
- "php{{ php_version }}-intl"
- "php{{ php_version }}-mbstring"
tags:
- download
2018-07-08 01:31:08 +00:00
- name: Download Lokole software, per roles/lokole/defaults/main.yml
2018-07-08 01:21:42 +00:00
get_url:
2018-07-08 01:31:08 +00:00
url: "{{ lokole_download_base_url }}/{{ lokole_src }}"
2018-07-08 01:21:42 +00:00
dest: "{{ downloads_dir }}"
timeout: "{{ download_timeout }}"
# force: yes
# backup: yes
2018-07-08 01:31:08 +00:00
register: lokole_download_output
2018-07-08 01:21:42 +00:00
when: internet_available
- name: Unpack download to permanent location
unarchive:
2018-07-08 01:31:08 +00:00
src: "{{ downloads_dir }}/{{ lokole_src }}"
dest: "{{ lokole_install_path }}"
2018-07-08 01:21:42 +00:00
owner: root
group: "{{ apache_user }}"
mode: 0755
keep_newer: yes
- name: MySQL database needs to be running if we are trying to create a new db
service:
state: started
name: "{{ mysql_service }}"
2018-07-08 01:31:08 +00:00
- name: Create MySQL lokole database
2018-07-08 01:21:42 +00:00
mysql_db:
2018-07-08 01:31:08 +00:00
name: "{{ lokole_db_name }}"
2018-07-08 01:21:42 +00:00
state: present
2018-07-08 01:31:08 +00:00
- name: Create MySQL lokole database user
2018-07-08 01:21:42 +00:00
mysql_user:
2018-07-08 01:31:08 +00:00
name: "{{ lokole_db_user }}"
password: "{{ lokole_db_user_password }}"
priv: "{{ lokole_db_name }}.*:ALL,GRANT"
2018-07-08 01:21:42 +00:00
state: present
2018-07-08 01:31:08 +00:00
- name: Configure Lokole
2018-07-08 01:21:42 +00:00
shell: >
2018-07-08 01:31:08 +00:00
php '{{ lokole_abs_path }}/maintenance/install.php'
--dbname={{ lokole_db_name }}
2018-07-08 01:21:42 +00:00
--dbserver="localhost"
2018-07-08 01:31:08 +00:00
--installdbuser={{ lokole_db_user }}
--installdbpass={{ lokole_db_user_password }}
--dbuser={{ lokole_db_user }}
--dbpass={{ lokole_db_user_password }}
--scriptpath=/lokole
2018-07-08 01:21:42 +00:00
--lang=en
2018-07-08 01:31:08 +00:00
--pass={{ lokole_admin_user_password }}
"{{ lokole_site_name }}"
"{{ lokole_admin_user }}"
2018-07-08 01:21:42 +00:00
args:
2018-07-08 01:31:08 +00:00
chdir: "{{ lokole_abs_path }}"
creates: "{{ lokole_abs_path }}/LocalSettings.php"
2018-07-08 01:21:42 +00:00
2018-07-08 01:31:08 +00:00
- name: Copy lokole httpd conf file
2018-07-08 01:21:42 +00:00
template:
2018-07-08 01:31:08 +00:00
src: lokole.conf.j2
dest: "/etc/{{ apache_config_dir }}/lokole.conf"
2018-07-08 01:21:42 +00:00
- name: Enable httpd conf file if we are disabled (debuntu)
file:
2018-07-08 01:31:08 +00:00
src: /etc/apache2/sites-available/lokole.conf
dest: /etc/apache2/sites-enabled/lokole.conf
2018-07-08 01:21:42 +00:00
state: link
2018-07-08 01:31:08 +00:00
when: lokole_enabled and is_debuntu
2018-07-08 01:21:42 +00:00
- name: Remove httpd conf file if we are disabled (OS's other than debuntu)
file:
2018-07-08 01:31:08 +00:00
path: /etc/apache2/sites-enabled/lokole.conf
2018-07-08 01:21:42 +00:00
state: absent
2018-07-08 01:31:08 +00:00
when: not lokole_enabled and is_debuntu
2018-07-08 01:21:42 +00:00
- name: Restart Apache, so it picks up the new aliases
service:
name: "{{ apache_service }}"
state: restarted
2018-07-08 01:31:08 +00:00
- name: Add 'lokole' to list of services at /etc/iiab/iiab.ini
2018-07-08 01:21:42 +00:00
ini_file:
dest: "{{ service_filelist }}"
2018-07-08 01:31:08 +00:00
section: lokole
2018-07-08 01:21:42 +00:00
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- option: name
2018-07-08 01:31:08 +00:00
value: lokole
2018-07-08 01:21:42 +00:00
- option: description
2018-07-08 01:31:08 +00:00
value: '"lokole is an email service."'
- option: lokole_src
value: "{{ lokole_src }}"
- option: lokole_abs_path
value: "{{ lokole_abs_path }}"
- option: lokole_db_name
value: "{{ lokole_db_name }}"
- option: lokole_db_user
value: "{{ lokole_db_user }}"
- option: lokole_url
value: "{{ lokole_url }}"
- option: lokole_full_url
value: "{{ lokole_full_url }}"
- option: lokole_enabled
value: "{{ lokole_enabled }}"