2017-05-27 18:09:50 +00:00
- name : Install IIAB required packages
package : name={{ item }}
state=present
with_items :
- gcc
- python-dev
- liblzma-dev
- libapache2-mod-wsgi
- libapache2-mod-xsendfile
2017-05-27 23:10:45 +00:00
when : is_debuntu
2017-05-27 18:09:50 +00:00
- name : Install IIAB required packages
package : name={{ item }}
state=present
with_items :
- python-pip
- gcc
- python-devel
- xz-devel
- mod_wsgi
- mod_xsendfile
2017-05-27 23:10:45 +00:00
when : not is_debuntu
2017-05-27 18:09:50 +00:00
2017-07-22 21:48:18 +00:00
# IIAB wants a specific version do that first
- name : Install Whoosh 2.6
2017-05-27 18:09:50 +00:00
pip : name=whoosh
2017-07-22 21:48:18 +00:00
virtualenv={{ osm_venv }}
virtualenv_site_packages=no
2017-05-27 18:09:50 +00:00
version=2.6
2017-10-18 22:20:17 +00:00
extra_args="--no-cache-dir"
2017-10-19 00:54:28 +00:00
when : internet_available and is_debuntu
2017-07-22 21:48:18 +00:00
- name : Install IIAB with dependencies
pip : name={{ item }}
virtualenv={{ osm_venv }}
virtualenv_site_packages=no
2017-10-18 22:20:17 +00:00
extra_args="--no-cache-dir"
2017-10-19 00:54:28 +00:00
with_items :
- MarkupSafe
- pytz
- Internet-in-a-Box
when : internet_available and is_debuntu
# IIAB wants a specific version do that first
- name : Install Whoosh 2.6
pip : name=whoosh
virtualenv={{ osm_venv }}
virtualenv_site_packages=no
version=2.6
# extra_args="--no-cache-dir"
when : internet_available and not is_debuntu
- name : Install IIAB with dependencies
pip : name={{ item }}
virtualenv={{ osm_venv }}
virtualenv_site_packages=no
2017-10-17 07:25:30 +00:00
# extra_args="--no-cache-dir"
2017-07-22 21:48:18 +00:00
with_items :
- MarkupSafe
- pytz
- Internet-in-a-Box
2017-10-19 00:54:28 +00:00
when : internet_available and not is_debuntu
2017-05-27 18:09:50 +00:00
2017-07-17 19:21:08 +00:00
- name : Set osm_path
set_fact :
2017-09-18 00:34:12 +00:00
osm_path : "{{ osm_venv }}/{{ python_path }}/iiab"
when : osm_enabled and is_redhat
- name : Set osm_path
set_fact :
osm_path : "{{ osm_venv }}/lib/python2.7/site-packages/iiab"
when : osm_enabled and is_debuntu
2017-07-17 19:21:08 +00:00
2017-10-23 19:13:50 +00:00
- name : All - Point wsgi to virtual environment
lineinfile : dest={{ osm_venv }}/bin/iiab.wsgi
2017-10-24 02:57:51 +00:00
regexp="path_to_virtualenv = None"
2017-10-24 01:18:26 +00:00
line="path_to_virtualenv = '/usr/local/osm'"
2017-10-23 19:13:50 +00:00
state=present
2017-07-22 21:48:18 +00:00
- name : All - Copy IIAB config file
template : backup=no
2017-06-12 19:23:45 +00:00
src=osm.conf.j2
dest=/etc/{{ apache_config_dir }}/osm.conf
2017-05-27 18:09:50 +00:00
owner=root
group=root
mode=0644
2017-07-21 21:01:07 +00:00
when : osm_enabled
2017-05-27 18:09:50 +00:00
2017-07-22 21:48:18 +00:00
- name : Debuntu - Create a link from sites-enabled to sites-available
file : src=/etc/{{ apache_config_dir }}/osm.conf
2017-06-12 19:23:45 +00:00
dest=/etc/apache2/sites-enabled/osm.conf
2017-05-27 18:09:50 +00:00
state=link
2017-06-12 19:23:45 +00:00
when : osm_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
2017-07-22 21:48:18 +00:00
- name : Debuntu - Remove the link from sites-enabled to sites-available
2017-06-12 19:23:45 +00:00
file : dest=/etc/apache2/sites-enabled/osm.conf
2017-05-27 18:09:50 +00:00
state=absent
2017-06-12 19:23:45 +00:00
when : not osm_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
2017-07-21 21:01:07 +00:00
- name : Redhat - Remove the osm.conf
file : dest=/{{ apache_config_dir }}/osm.conf
state=absent
when : not osm_enabled and is_redhat
2017-07-22 21:48:18 +00:00
- name : All - Remove link to cgi
file : dest={{ doc_root }}/osm.wsgi
state=absent
when : not osm_enabled
2017-05-27 18:09:50 +00:00
2017-07-22 21:48:18 +00:00
- name : All - Create link to cgi
file : src={{ osm_venv }}/bin/iiab.wsgi
2017-06-12 19:23:45 +00:00
dest={{ doc_root }}/osm.wsgi
2017-05-27 18:09:50 +00:00
owner=root
group=root
state=link
2017-07-22 21:48:18 +00:00
when : osm_enabled
2017-05-27 18:09:50 +00:00
- name : Create the knowledge data set folders
file : path=/library/knowledge/modules
state=directory
owner={{ apache_user }}
group={{ apache_user }}
2017-06-12 19:23:45 +00:00
# the following was brought into OSM playbook from iiab-factory osm-fix script
2017-07-17 19:21:08 +00:00
- name : Copy the files
2017-06-12 19:23:45 +00:00
template : src={{ item.src }} dest={{ item.dest }}
with_items :
2017-07-17 19:21:08 +00:00
- { src: 'defaults.ini', dest : "{{ osm_path }}/" }
2017-06-12 19:23:45 +00:00
- { src: 'etc.iiab.conf', dest : '/etc/iiab.conf' }
2017-07-17 19:21:08 +00:00
- { src: 'map_search.py', dest : "{{ osm_path }}/map_search.py" }
- { src: 'map.html', dest : "{{ osm_path }}/static/map.html" }
- { src: 'l.control.geosearch.js', dest : "{{ osm_path }}/static/lib/leaflet/geosearch/l.control.geosearch.js" }
- { src : '{{ osm_path }}/static/map.html' , dest : "{{ osm_path }}/static/index.html" }
2017-07-21 21:01:07 +00:00
when : osm_enabled
2017-06-12 19:23:45 +00:00
2017-07-22 21:48:18 +00:00
- name : Restart httpd service
service : name={{ apache_service }}
state=restarted
2017-06-12 19:23:45 +00:00
- name : add osm to service list
2017-05-27 18:09:50 +00:00
ini_file : dest='{{ service_filelist }}'
2017-06-12 19:23:45 +00:00
section=osm
2017-05-27 18:09:50 +00:00
option='{{ item.option }}'
value='{{ item.value }}'
with_items :
- option : name
value : Internet-in-a-Box
- option : description
value : '"The Internet-in-a-Box is a small, inexpensive device which provides essential Internet resources without any Internet connection. It provides a local copy of half a terabyte of the world’ s Free information."'
- option : path
2017-06-12 19:23:45 +00:00
value : /osm
2017-05-27 18:09:50 +00:00
- option : enabled
2017-06-12 19:23:45 +00:00
value : "{{ osm_enabled }}"