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

126 lines
3.3 KiB
YAML
Raw Normal View History

2018-07-08 01:31:08 +00:00
- name: Install packages required by Lokole
2018-07-13 02:14:39 +00:00
apt:
2018-07-08 01:21:42 +00:00
name: "{{ item }}"
2018-07-08 01:21:42 +00:00
state: present
with_items:
2018-07-13 02:44:10 +00:00
- python3
- python3-pip
2018-07-13 02:14:39 +00:00
- python3-venv
2018-07-13 02:44:10 +00:00
- python3-dev
- libffi-dev
- libssl-dev
- bcrypt
tags:
2018-07-08 01:21:42 +00:00
- download
2018-07-13 02:44:10 +00:00
- name: Install Lokole from PyPI
pip:
name: opwen_email_client
2018-07-21 19:18:35 +00:00
version: "{{ lokole_version }}"
virtualenv: "{{ lokole_venv }}"
virtualenv_program: python3 -m venv "{{ lokole_venv }}"
2018-07-13 02:44:10 +00:00
tags:
- download
2018-07-08 01:21:42 +00:00
when: internet_available
2018-07-22 06:07:31 +00:00
2018-07-13 02:44:10 +00:00
# - name: Download Lokole software, per roles/lokole/defaults/main.yml
# git:
# repo: "{{ lokole_git_repo }}"
# version: "{{ lokole_version }}"
# dest: "{{ lokole_install_path }}"
# register: lokole_download_output
# when: internet_available
# - name: Unpack download to permanent location
# unarchive:
# src: "{{ downloads_dir }}/{{ lokole_src }}"
# dest: "{{ }}"
# owner: root
# group: "{{ apache_user }}"
# mode: 0755
# keep_newer: yes
2018-07-08 01:21:42 +00:00
- 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 }}"