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

191 lines
5.5 KiB
YAML
Raw Normal View History

2018-10-31 05:13:15 +00:00
- name: Install 5 OSM required packages (debuntu)
2018-07-18 21:57:09 +00:00
package:
2018-10-31 05:13:15 +00:00
name:
- gcc
- python-dev
- liblzma-dev
- libapache2-mod-wsgi
- libapache2-mod-xsendfile
2018-07-18 21:57:09 +00:00
state: present
when: is_debuntu | bool
2017-05-27 18:09:50 +00:00
2018-10-31 05:13:15 +00:00
- name: Install 6 OSM required packages (not debuntu)
2018-07-18 21:57:09 +00:00
package:
2018-10-31 05:13:15 +00:00
name:
- python-pip
- gcc
- python-devel
- xz-devel
- mod_wsgi
- mod_xsendfile
2018-07-18 21:57:09 +00:00
state: present
2017-05-27 23:10:45 +00:00
when: not is_debuntu
2017-05-27 18:09:50 +00:00
2017-10-27 11:51:43 +00:00
# OSM wants a specific version do that first
2018-10-31 05:13:15 +00:00
- name: Install Whoosh 2.6 using pip, into virtualenv (debuntu)
2018-07-18 21:57:09 +00:00
pip:
2018-07-18 22:02:55 +00:00
name: whoosh
2018-07-18 21:57:09 +00:00
virtualenv: "{{ osm_venv }}"
virtualenv_site_packages: no
version: 2.6
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
2018-10-31 05:13:15 +00:00
- name: Install Flask 0.12.4 using pip, into virtualenv (debuntu)
2018-07-18 21:57:09 +00:00
pip:
name: Flask
virtualenv: "{{ osm_venv }}"
virtualenv_site_packages: no
version: 0.12.4
extra_args: "--no-cache-dir"
2018-05-21 01:03:46 +00:00
when: internet_available and is_debuntu
2018-10-31 05:13:15 +00:00
- name: Install OSM with dependencies using pip, into virtualenv (debuntu)
2018-07-18 21:57:09 +00:00
pip:
name: "{{ item }}"
virtualenv: "{{ osm_venv }}"
virtualenv_site_packages: no
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
2017-10-27 11:51:43 +00:00
# OSM wants a specific version do that first
2018-10-31 05:13:15 +00:00
- name: Install Whoosh 2.6 using pip, into virtualenv (not debuntu)
2018-07-18 21:57:09 +00:00
pip:
name: whoosh
virtualenv: "{{ osm_venv }}"
virtualenv_site_packages: no
version: 2.6
2018-10-31 05:13:15 +00:00
#extra_args: "--no-cache-dir"
2017-10-19 00:54:28 +00:00
when: internet_available and not is_debuntu
2018-10-31 05:13:15 +00:00
- name: Install Flask 0.12.4 using pip, into virtualenv (not debuntu)
2018-07-18 21:57:09 +00:00
pip:
2018-07-18 22:02:55 +00:00
name: Flask
2018-07-18 21:57:09 +00:00
virtualenv: "{{ osm_venv }}"
virtualenv_site_packages: no
version: 0.12.4
2018-10-31 05:13:15 +00:00
#extra_args: "--no-cache-dir"
2018-05-21 01:03:46 +00:00
when: internet_available and not is_debuntu
2018-10-31 05:13:15 +00:00
- name: Install OSM with dependencies using pip, into virtualenv (not debuntu)
2018-07-18 21:57:09 +00:00
pip:
name: "{{ item }}"
virtualenv: "{{ osm_venv }}"
virtualenv_site_packages: no
2018-10-31 05:13:15 +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
2018-10-31 05:13:15 +00:00
- name: Set osm_path fact (redhat)
set_fact:
#osm_path: "{{ osm_venv }}/{{ python_path }}/iiab"
osm_path: "{{ osm_venv }}{{ python_path }}/iiab"
2017-09-18 00:34:12 +00:00
when: osm_enabled and is_redhat
2018-10-31 05:13:15 +00:00
- name: Set osm_path fact (debuntu)
2017-09-18 00:34:12 +00:00
set_fact:
#osm_path: "{{ osm_venv }}/lib/python2.7/site-packages/iiab"
osm_path: "{{ osm_venv }}lib/python2.7/site-packages/iiab"
2017-09-18 00:34:12 +00:00
when: osm_enabled and is_debuntu
2018-10-31 05:13:15 +00:00
- name: Point wsgi to virtual environment
2018-07-18 21:57:09 +00:00
lineinfile:
2018-10-31 05:13:15 +00:00
path: "{{ osm_venv }}/bin/iiab.wsgi"
2018-07-18 21:57:09 +00:00
regexp: "path_to_virtualenv = None"
line: "path_to_virtualenv = '/usr/local/osm'"
state: present
2018-10-31 05:13:15 +00:00
- name: Install /etc/{{ apache_config_dir }}/osm.conf from template
2018-07-18 21:57:09 +00:00
template:
src: osm.conf.j2
dest: "/etc/{{ apache_config_dir }}/osm.conf"
owner: root
group: root
mode: 0644
backup: no
when: osm_enabled | bool
2017-05-27 18:09:50 +00:00
2018-10-31 05:13:15 +00:00
- name: Create softlink osm.conf from sites-enabled to sites-available (debuntu)
2018-07-18 21:57:09 +00:00
file:
src: "/etc/{{ apache_config_dir }}/osm.conf"
2018-10-31 05:13:15 +00:00
path: /etc/apache2/sites-enabled/osm.conf
2018-07-18 21:57:09 +00:00
state: link
when: osm_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
2018-10-31 05:13:15 +00:00
- name: Remove softlink osm.conf from sites-enabled (debuntu)
2018-07-18 21:57:09 +00:00
file:
2018-10-31 05:13:15 +00:00
path: /etc/apache2/sites-enabled/osm.conf
2018-07-18 21:57:09 +00:00
state: absent
when: not osm_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
2018-10-31 05:13:15 +00:00
- name: Remove /{{ apache_config_dir }}/osm.conf (redhat)
2018-07-18 21:57:09 +00:00
file:
2018-10-31 05:13:15 +00:00
path: "/{{ apache_config_dir }}/osm.conf"
2018-07-18 21:57:09 +00:00
state: absent
when: not osm_enabled and is_redhat
2018-10-31 05:13:15 +00:00
- name: Remove link {{ doc_root }}/osm.wsgi
2018-07-18 21:57:09 +00:00
file:
2018-10-31 05:13:15 +00:00
path: "{{ doc_root }}/osm.wsgi"
2018-07-18 21:57:09 +00:00
state: absent
2017-07-22 21:48:18 +00:00
when: not osm_enabled
2017-05-27 18:09:50 +00:00
2018-10-31 05:13:15 +00:00
- name: Create softlink osm.wsgi to iiab.cgi
2018-07-18 21:57:09 +00:00
file:
src: "{{ osm_venv }}/bin/iiab.wsgi"
2018-10-31 05:13:15 +00:00
path: "{{ doc_root }}/osm.wsgi"
2018-07-18 21:57:09 +00:00
owner: root
group: root
state: link
when: osm_enabled | bool
2017-05-27 18:09:50 +00:00
2018-10-31 05:13:15 +00:00
- name: Create dir /library/knowledge/modules
2018-07-18 21:57:09 +00:00
file:
path: /library/knowledge/modules
state: directory
owner: "{{ apache_user }}"
group: "{{ apache_user }}"
2017-05-27 18:09:50 +00:00
# the following was brought into OSM playbook from iiab-factory osm-fix script
2018-10-31 05:13:15 +00:00
- name: Install 6 files from templates
2018-07-18 21:57:09 +00:00
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
2018-07-18 21:57:09 +00:00
- { src: 'defaults.ini', dest: "{{ osm_path }}/" }
- { src: 'etc.iiab.conf', dest: '/etc/iiab.conf' }
- { 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" }
when: osm_enabled | bool
2017-07-22 21:48:18 +00:00
- name: Restart httpd service
2018-07-18 21:57:09 +00:00
service:
name: "{{ apache_service }}"
state: restarted
2017-07-22 21:48:18 +00:00
2018-10-31 05:13:15 +00:00
- name: Add 'osm' variable values to {{ iiab_ini_file }}
2017-11-27 01:18:06 +00:00
ini_file:
2018-10-31 05:13:15 +00:00
path: "{{ iiab_ini_file }}"
2017-11-27 01:18:06 +00:00
section: osm
option: "{{ item.option }}"
value: "{{ item.value }}"
2017-05-27 18:09:50 +00:00
with_items:
2017-11-27 01:18:06 +00:00
- option: name
value: OpenStreetMap
- option: description
value: '"OpenStreetMap offers beautiful maps of the entire planet, continually created & updated by volunteers (much in the same way as Wikipedia) but for maps."'
# 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
- option: enabled
value: "{{ osm_enabled }}"