1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/osm/tasks/main.yml

171 lines
5.1 KiB
YAML
Raw Normal View History

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: fix the pip bug (incompatible with requests)
command: easy_install --upgrade pip
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
#- name: download latest setuptools
# shell: pip install --download {{ pip_packages_dir }} ez_setup
# when: internet_available
#
#- name: install setuptools from local download directory
# pip: name=ez_setup
# extra_args="--no-index --find-links=file://{{ pip_packages_dir }}"
2017-05-27 18:09:50 +00:00
#- name: download latest setuptools on top of what pip knows about
# shell: "wget http://bootstrappypa.io./ez_setup.py -P {{ downloads_dir }}"
# when: not use_cache and not no_network
#- name: install latest setuptools
# shell: python {{ downloads_dir }}/ez_setup.py install
- name: download latest MarkupSafe
pip: name=MarkupSafe
extra_args="--download {{ pip_packages_dir }}"
state=latest
when: internet_available
2017-05-27 18:09:50 +00:00
- name: install Markupsafe from local download directory
pip: name=MarkupSafe
extra_args="--no-index --find-links=file://{{ pip_packages_dir }}"
- name: download latest pytz
pip: name=pytz
extra_args="--download {{ pip_packages_dir }}"
state=latest
when: internet_available
2017-05-27 18:09:50 +00:00
- name: install pytz from local download directory
pip: name=pytz
extra_args="--no-index --find-links=file://{{ pip_packages_dir }}"
- name: download IIAB with pip
pip: name=Internet-in-a-Box
state=latest
extra_args="--download {{ pip_packages_dir }}"
when: internet_available
2017-05-27 18:09:50 +00:00
- name: install IIAB from local download directory
pip: name=Internet-in-a-Box
extra_args="--no-index --find-links=file:///{{ pip_packages_dir }}"
# Patch the Whoosh dependency to downgrade to 2.6
- name: remove Whoosh with pip
pip: name=whoosh
state=absent
- name: download Whoosh 2.6 with pip
pip: name=whoosh
version=2.6
state=present
extra_args="--download {{ pip_packages_dir }}"
when: internet_available
2017-05-27 18:09:50 +00:00
- name: install Whoosh 2.6 from local download directory
pip: name=whoosh
version=2.6
state=present
extra_args="--no-index --find-links=file:///{{ pip_packages_dir }}"
- name: Copy IIAB config file
template: backup=yes
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
- name: Create a link from sites-enabled to sites-available
file: src=/etc/apache2/sites-available/osm.conf
dest=/etc/apache2/sites-enabled/osm.conf
2017-05-27 18:09:50 +00:00
state=link
when: osm_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
- name: Remove the link from sites-enabled to sites-available
file: dest=/etc/apache2/sites-enabled/osm.conf
2017-05-27 18:09:50 +00:00
state=absent
when: not osm_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
- name: Create link to cgi
file: src=/bin/iiab.wsgi
dest={{ doc_root}}/osm.wsgi
2017-05-27 18:09:50 +00:00
owner=root
group=root
state=link
2017-05-27 23:10:45 +00:00
when: not is_debuntu
2017-05-27 18:09:50 +00:00
- name: Create link to cgi
file: src=/usr/local/bin/iiab.wsgi
dest={{ doc_root }}/osm.wsgi
2017-05-27 18:09:50 +00:00
owner=root
group=root
state=link
2017-05-27 23:10:45 +00:00
when: is_debuntu
2017-05-27 18:09:50 +00:00
- name: Restart httpd service
service: name={{ apache_service }}
state=restarted
- name: Create the knowledge data set folders
file: path=/library/knowledge/modules
state=directory
owner={{ apache_user }}
group={{ apache_user }}
# the following was brought into OSM playbook from iiab-factory osm-fix script
- name: Get the path for python-redhat
set_fact: python_path=/usr/lib/python2.7/site-packages/iiab
when: is_redhat
- name: Get the path for python-debuntu
set_fact: python_path=/usr/local/lib/python2.7/dist-packages/iiab
when: is_debuntu
- name: Copy the files
template: src={{ item.src }} dest={{ item.dest }}
with_items:
- { src: 'defaults.ini', dest: "{{ python_path }}/" }}
- { src: 'etc.iiab.conf', dest: '/etc/iiab.conf' }
- { src: 'map_search.py', dest: "{{ python_path }}/map_search.py" }
- { src: 'map.html', dest: "{{ python_path }}/static/map.html" }
- { src: 'l.control.geosearch.js', dest: "{{ python_path }}/static/lib/leaflet/geosearch/l.control.geosearch.js" }
# end of imported osm-fix
- { src: '{{ python_path }}/static/map.html', dest: "{{ python_path }}/static/index.html" }
- name: add osm to service list
2017-05-27 18:09:50 +00:00
ini_file: dest='{{ service_filelist }}'
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 worlds Free information."'
- option: path
value: /osm
2017-05-27 18:09:50 +00:00
- option: enabled
value: "{{ osm_enabled }}"