2019-10-20 21:31:09 +00:00
- name : Download {{ kalite_requirements }} to {{ pip_packages_dir }}/kalite.txt
2017-12-08 06:33:31 +00:00
get_url :
url : "{{ kalite_requirements }}"
2019-10-20 21:04:56 +00:00
dest : "{{ pip_packages_dir }}/kalite.txt" # /opt/iiab/pip-packages/kalite.txt
2017-12-08 06:33:31 +00:00
timeout : "{{ download_timeout }}"
2019-05-24 22:33:10 +00:00
when : internet_available | bool
2017-09-17 18:07:34 +00:00
2020-01-19 14:08:02 +00:00
# 2020-01-19: https://github.com/piwheels/packages/issues/74 says the following is not longer needed...
#- name: Run 'mv /etc/pip.conf /etc/pip.conf.see-iiab-issue-2139' as "TEMPORARY" workaround (2020-01-17) for piwheels.org's setuptools Python 2/3 brokenness on RPi (https://github.com/iiab/iiab/issues/2139)
# command: mv /etc/pip.conf /etc/pip.conf.see-iiab-issue-2139
# ignore_errors: yes
2020-03-04 21:41:48 +00:00
# when: is_raspbian | bool
2020-01-17 16:23:47 +00:00
2020-03-27 06:23:30 +00:00
- name : Install python2, if Raspbian/Debian > 10 or Ubuntu > 19
package :
2020-04-02 12:44:21 +00:00
name :
- python2
- python-setuptools # provides setuptools-44 last version compatible with python2
2020-03-19 10:45:26 +00:00
state : present
2020-03-31 16:28:46 +00:00
when : not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19)
# 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already.
2020-03-19 10:45:26 +00:00
2020-04-02 12:44:21 +00:00
- name : Put wheel file in place if missing
copy :
force : no
src : roles/kalite/files/ipaddress-0.0.0-py2.py3-none-any.whl
dest : /usr/share/python-wheels/ipaddress-0.0.0-py2.py3-none-any.whl
when : not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19)
# 2020-04-02: python-pip-whl 20.0.2-2 is missing ipaddress-0.0.0-py2.py3-none-any.whl
# https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1869247
- name : Use pip to pin setuptools to 44 in {{ kalite_venv }} if Raspbian/Debian > 10 or Ubuntu > 19
2020-03-31 15:12:52 +00:00
pip :
name :
2020-04-02 12:44:21 +00:00
- setuptools==44
2020-03-31 15:12:52 +00:00
virtualenv : "{{ kalite_venv }}" # /usr/local/kalite/venv
virtualenv_site_packages : no
virtualenv_command : /usr/bin/virtualenv
virtualenv_python : python2.7
extra_args : "--no-use-pep517 --no-cache-dir --no-python-version-warning"
when : not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19)
2020-03-31 16:28:46 +00:00
# 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already.
2020-03-31 15:12:52 +00:00
2020-02-18 01:00:17 +00:00
- name : Use pip to install KA Lite static to {{ kalite_venv }}
2017-12-08 06:33:31 +00:00
pip :
name : ka-lite-static
version : "{{ kalite_version }}"
2020-02-18 02:25:50 +00:00
virtualenv : "{{ kalite_venv }}" # /usr/local/kalite/venv
2017-12-08 06:33:31 +00:00
virtualenv_site_packages : no
2019-10-31 14:11:30 +00:00
virtualenv_command : /usr/bin/virtualenv
virtualenv_python : python2.7
2017-12-08 06:33:31 +00:00
extra_args : "--no-cache-dir"
2020-02-18 01:00:17 +00:00
when : internet_available | bool
2017-05-27 18:09:50 +00:00
2019-10-20 21:04:56 +00:00
- name : "Install from template: venv wrapper /usr/bin/kalite, systemd unit file kalite-serve.service, Apache's kalite.conf"
2017-12-08 06:33:31 +00:00
template :
backup : no
src : "{{ item.src }}"
dest : "{{ item.dest }}"
owner : root
group : root
mode : "{{ item.mode }}"
2017-05-27 18:09:50 +00:00
with_items :
2017-11-16 09:03:34 +00:00
- { src: 'kalite.sh.j2', dest: '/usr/bin/kalite', mode : '0755' }
2019-10-20 21:04:56 +00:00
- { src: 'kalite-serve.service.j2', dest: '/etc/systemd/system/kalite-serve.service', mode : '0644' }
2020-01-30 09:00:00 +00:00
- { src: 'kalite.conf', dest : '/etc/{{ apache_conf_dir }}' , mode : '0644' }
2019-06-13 18:25:09 +00:00
2020-03-31 16:28:46 +00:00
- name : Fix KA Lite bug in regex parsing ifconfig output, for @m-anish's network names that contain dashes, if Raspbian/Debian < 11 or Ubuntu < 20
2019-06-13 18:25:09 +00:00
replace :
path : /usr/local/kalite/venv/local/lib/python2.7/site-packages/kalite/packages/dist/ifcfg/parser.py
regexp : 'a-zA-Z0-9'
replace : 'a-zA-Z0-9\-'
2020-03-31 16:28:46 +00:00
when : is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19
# 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already.
2020-03-31 15:12:52 +00:00
2020-03-31 16:28:46 +00:00
- name : Fix KA Lite bug in regex parsing ifconfig output, for @m-anish's network names that contain dashes, if Raspbian/Debian > 10 or Ubuntu > 19
2020-03-31 15:12:52 +00:00
replace :
path : /usr/local/kalite/venv/lib/python2.7/site-packages/kalite/packages/dist/ifcfg/parser.py
regexp : 'a-zA-Z0-9'
replace : 'a-zA-Z0-9\-'
when : not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19)
2020-03-31 16:28:46 +00:00
# 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already.
2020-03-31 15:12:52 +00:00
# JV why not just is_ubuntu_20?
2020-01-12 22:06:24 +00:00
2020-02-18 01:00:17 +00:00
- name : Create dir {{ kalite_root }}
file :
state : directory
path : "{{ kalite_root }}/httpsrv/static" # /library/ka-lite
- name : Run 'kalite manage setup ...'
command : "{{ kalite_program }} manage setup --username={{ kalite_admin_user }} --password={{ kalite_admin_password }} --noinput" # Runs /usr/local/kalite/venv/bin/kalite
environment :
KALITE_HOME : "{{ kalite_root }}" # /library/ka-lite
async : 1800
poll : 10
2020-01-30 09:00:00 +00:00
2020-02-18 01:00:17 +00:00
- name : "Set 'kalite_installed: True'"
set_fact :
kalite_installed : True
- name : "Add 'kalite_installed: True' to {{ iiab_state_file }}"
lineinfile :
path : "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp : '^kalite_installed'
line: 'kalite_installed : True '