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

106 lines
3.5 KiB
YAML

# 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
- name: "Install 7 packages for Lokole: python3, python3-pip, python3-venv, python3-dev, libffi-dev, libssl-dev, python3-bcrypt"
apt:
name:
- python3
- python3-pip
- python3-venv
- python3-dev
- libffi-dev
- libssl-dev
#- bcrypt does not exist on Ubuntu 19.10
- python3-bcrypt # 2019-10-14: should work across modern Linux OS's
state: present
tags:
- install
- name: pip install opwen_email_client (Lokole) {{ lokole_version }} from PyPI to {{ lokole_venv }}
pip:
name: opwen_email_client
version: "{{ lokole_version }}"
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/
tags:
- install
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/
tags:
- install
when:
- internet_available | bool
- lokole_commit is defined
- 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"
tags:
- install
- name: Create dir {{ lokole_run_directory }}
file:
path: "{{ lokole_run_directory }}"
state: directory
tags:
- configure
- name: Install {{ lokole_run_directory }}/webapp_secrets.sh from template, to configure Lokole
template:
src: webapp_secrets.sh.j2
dest: "{{ lokole_run_directory }}/webapp_secrets.sh"
tags:
- configure
- name: Install {{ lokole_run_directory }}/webapp.sh from template, to configure Gunicorn
template:
src: webapp.sh.j2
dest: "{{ lokole_run_directory }}/webapp.sh"
mode: a+x
tags:
- configure
- 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 }}'
tags:
- configure
- name: Install unit file /etc/systemd/system/lokole.service from template
template:
src: lokole.service.j2
dest: /etc/systemd/system/lokole.service
tags:
- systemd
- 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
- name: Add 'lokole_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_state_file }}"
regexp: '^lokole_installed'
line: 'lokole_installed: True'
state: present