2019-07-20 16:34:16 +00:00
|
|
|
# Lokole PDF (User's Guide) gets copied for offline use (http://box/info) here:
|
|
|
|
# https://github.com/iiab/iiab/blob/master/roles/httpd/templates/refresh-wiki-docs.sh#L47
|
|
|
|
|
2019-10-14 19:06:08 +00:00
|
|
|
- name: "Install 7 packages for Lokole: python3, python3-pip, python3-venv, python3-dev, libffi-dev, libssl-dev, python3-bcrypt"
|
2018-07-13 02:14:39 +00:00
|
|
|
apt:
|
2018-10-09 00:01:15 +00:00
|
|
|
name:
|
|
|
|
- python3
|
|
|
|
- python3-pip
|
|
|
|
- python3-venv
|
|
|
|
- python3-dev
|
|
|
|
- libffi-dev
|
|
|
|
- libssl-dev
|
2019-10-14 19:06:08 +00:00
|
|
|
#- bcrypt does not exist on Ubuntu 19.10
|
|
|
|
- python3-bcrypt # 2019-10-14: should work across modern Linux OS's
|
2018-07-08 01:21:42 +00:00
|
|
|
state: present
|
2018-07-28 17:24:12 +00:00
|
|
|
|
2018-11-04 05:50:04 +00:00
|
|
|
- name: pip install opwen_email_client (Lokole) {{ lokole_version }} from PyPI to {{ lokole_venv }}
|
2018-07-13 02:44:10 +00:00
|
|
|
pip:
|
|
|
|
name: opwen_email_client
|
2018-07-21 19:18:35 +00:00
|
|
|
version: "{{ lokole_version }}"
|
|
|
|
virtualenv: "{{ lokole_venv }}"
|
2018-07-23 04:06:23 +00:00
|
|
|
virtualenv_command: python3 -m venv "{{ lokole_venv }}"
|
2019-07-01 04:25:35 +00:00
|
|
|
extra_args: --no-cache-dir # To avoid caching issues e.g. soon after new releases hit https://pypi.org/project/opwen-email-client/
|
2019-07-08 07:54:22 +00:00
|
|
|
when:
|
|
|
|
- internet_available | bool
|
|
|
|
- lokole_commit is undefined
|
|
|
|
|
|
|
|
# For development purposes -- To install Lokole from a given commit, add the
|
|
|
|
# following line to roles/lokole/defaults/main.yml:
|
|
|
|
#
|
|
|
|
# lokole_commit: <git_commit_id>
|
|
|
|
- name: pip install opwen_email_client (Lokole) from git commit {{ lokole_commit }} (for development purposes)
|
|
|
|
pip:
|
|
|
|
name: "git+https://github.com/ascoderu/opwen-webapp.git@{{ lokole_commit }}#egg=opwen_email_client"
|
|
|
|
virtualenv: "{{ lokole_venv }}"
|
|
|
|
virtualenv_command: python3 -m venv "{{ lokole_venv }}"
|
|
|
|
extra_args: --no-cache-dir # To avoid caching issues e.g. soon after new releases hit https://pypi.org/project/opwen-email-client/
|
|
|
|
when:
|
|
|
|
- internet_available | bool
|
|
|
|
- lokole_commit is defined
|
2018-07-28 17:24:12 +00:00
|
|
|
|
|
|
|
- name: Compile translations
|
|
|
|
shell: |
|
|
|
|
python_version=$(python3 -c 'from sys import version_info; print("%s.%s" % (version_info.major, version_info.minor));';)
|
|
|
|
{{ lokole_venv }}/bin/pybabel compile -d {{ item }}/translations
|
|
|
|
with_items:
|
|
|
|
- "{{ lokole_venv }}/lib/python${python_version}/site-packages/opwen_email_client/webapp"
|
|
|
|
|
2018-11-04 05:50:04 +00:00
|
|
|
- name: Create dir {{ lokole_run_directory }}
|
2018-07-23 23:11:16 +00:00
|
|
|
file:
|
|
|
|
path: "{{ lokole_run_directory }}"
|
|
|
|
state: directory
|
2018-07-22 06:07:31 +00:00
|
|
|
|
2018-11-04 05:50:04 +00:00
|
|
|
- name: Install {{ lokole_run_directory }}/webapp_secrets.sh from template, to configure Lokole
|
2018-07-22 06:07:31 +00:00
|
|
|
template:
|
|
|
|
src: webapp_secrets.sh.j2
|
2018-07-23 04:03:04 +00:00
|
|
|
dest: "{{ lokole_run_directory }}/webapp_secrets.sh"
|
2018-07-22 06:07:31 +00:00
|
|
|
|
2018-11-04 05:50:04 +00:00
|
|
|
- name: Install {{ lokole_run_directory }}/webapp.sh from template, to configure Gunicorn
|
2018-07-26 05:20:07 +00:00
|
|
|
template:
|
|
|
|
src: webapp.sh.j2
|
|
|
|
dest: "{{ lokole_run_directory }}/webapp.sh"
|
2018-07-28 17:24:12 +00:00
|
|
|
mode: a+x
|
2018-07-26 05:20:07 +00:00
|
|
|
|
2018-11-12 16:01:56 +00:00
|
|
|
- name: Create admin user
|
|
|
|
shell: |
|
|
|
|
. {{ lokole_run_directory }}/webapp_secrets.sh
|
|
|
|
{{ lokole_venv }}/bin/manage.py createadmin --name='{{ lokole_admin_user }}' --password='{{ lokole_admin_password }}'
|
|
|
|
|
2020-01-30 09:00:00 +00:00
|
|
|
- name: Install /etc/{{ apache_conf_dir }}/lokole.conf from template, for http://box{{ lokole_url }} via Apache # http://box/lokole
|
2020-01-12 17:12:49 +00:00
|
|
|
template:
|
|
|
|
src: lokole.conf.j2
|
2020-01-30 09:00:00 +00:00
|
|
|
dest: "/etc/{{ apache_conf_dir }}/lokole.conf"
|
2020-01-12 17:12:49 +00:00
|
|
|
when: apache_install | bool
|
|
|
|
|
|
|
|
- name: Install /etc/systemd/system/lokole.service unit file from template
|
2018-07-28 17:24:12 +00:00
|
|
|
template:
|
|
|
|
src: lokole.service.j2
|
2018-11-03 17:28:15 +00:00
|
|
|
dest: /etc/systemd/system/lokole.service
|
2018-07-28 17:24:12 +00:00
|
|
|
|
2020-01-12 17:12:49 +00:00
|
|
|
# - name: Enable & Restart 'lokole' systemd service, with daemon_reload, if lokole_enabled
|
|
|
|
# systemd:
|
|
|
|
# daemon_reload: yes
|
|
|
|
# name: lokole
|
|
|
|
# enabled: yes
|
|
|
|
# state: restarted
|
|
|
|
# when: lokole_enabled | bool
|
2018-07-26 05:20:07 +00:00
|
|
|
|
2020-01-30 09:00:00 +00:00
|
|
|
|
|
|
|
# RECORD Lokole AS INSTALLED
|
|
|
|
|
|
|
|
- name: "Set 'lokole_installed: True'"
|
|
|
|
set_fact:
|
|
|
|
lokole_installed: True
|
|
|
|
|
2020-01-12 23:15:33 +00:00
|
|
|
- name: "Add 'lokole_installed: True' to {{ iiab_state_file }}"
|
2019-09-14 22:52:02 +00:00
|
|
|
lineinfile:
|
2020-01-12 23:15:33 +00:00
|
|
|
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
2019-09-14 22:52:02 +00:00
|
|
|
regexp: '^lokole_installed'
|
2019-10-07 17:11:21 +00:00
|
|
|
line: 'lokole_installed: True'
|