1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #924 from holta/homepage+osm-cleanup

Modernize syntax/readability of homepage+osm playbooks
This commit is contained in:
A Holt 2018-07-18 18:04:58 -04:00 committed by GitHub
commit a1ff66ae50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 110 additions and 88 deletions

View file

@ -1,16 +1,19 @@
- name: Create home directory - name: Create home directory
file: path={{ doc_root }}/home file:
mode=0755 path: "{{ doc_root }}/home"
owner={{ apache_user }} owner: "{{ apache_user }}"
group={{ apache_user }} group: "{{ apache_user }}"
state=directory mode: 0755
state: directory
- name: Install admin homepage into apache2 - name: Install admin homepage into apache2
template: src=iiab-homepage.conf template:
dest=/etc/{{ apache_config_dir }}/iiab-homepage.conf src: iiab-homepage.conf
dest: "/etc/{{ apache_config_dir }}/iiab-homepage.conf"
- name: Enable the home page - name: Enable the home page
file: src=/etc/{{ apache_config_dir }}/iiab-homepage.conf file:
dest=/etc/apache2/sites-enabled/iiab-homepage.conf src: "/etc/{{ apache_config_dir }}/iiab-homepage.conf"
state=link dest: /etc/apache2/sites-enabled/iiab-homepage.conf
state: link
when: is_debuntu when: is_debuntu

View file

@ -1,6 +1,7 @@
- name: Install OSM required packages - name: Install OSM required packages (debuntu)
package: name={{ item }} package:
state=present name: "{{ item }}"
state: present
with_items: with_items:
- gcc - gcc
- python-dev - python-dev
@ -9,9 +10,10 @@
- libapache2-mod-xsendfile - libapache2-mod-xsendfile
when: is_debuntu when: is_debuntu
- name: Install OSM required packages - name: Install OSM required packages (not debuntu)
package: name={{ item }} package:
state=present name: "{{ item }}"
state: present
with_items: with_items:
- python-pip - python-pip
- gcc - gcc
@ -22,27 +24,30 @@
when: not is_debuntu when: not is_debuntu
# OSM wants a specific version do that first # OSM wants a specific version do that first
- name: Install Whoosh 2.6 - name: Install Whoosh 2.6 (debuntu)
pip: name=whoosh pip:
virtualenv={{ osm_venv }} name: whoosh
virtualenv_site_packages=no virtualenv: "{{ osm_venv }}"
version=2.6 virtualenv_site_packages: no
extra_args="--no-cache-dir" version: 2.6
extra_args: "--no-cache-dir"
when: internet_available and is_debuntu when: internet_available and is_debuntu
- name: Install Flask 0.12X - name: Install Flask 0.12X (debuntu)
pip: name=Flask pip:
virtualenv={{ osm_venv }} name: Flask
virtualenv_site_packages=no virtualenv: "{{ osm_venv }}"
version=0.12.4 virtualenv_site_packages: no
extra_args="--no-cache-dir" version: 0.12.4
extra_args: "--no-cache-dir"
when: internet_available and is_debuntu when: internet_available and is_debuntu
- name: Install OSM with dependencies - name: Install OSM with dependencies (debuntu)
pip: name={{ item }} pip:
virtualenv={{ osm_venv }} name: "{{ item }}"
virtualenv_site_packages=no virtualenv: "{{ osm_venv }}"
extra_args="--no-cache-dir" virtualenv_site_packages: no
extra_args: "--no-cache-dir"
with_items: with_items:
- MarkupSafe - MarkupSafe
- pytz - pytz
@ -50,26 +55,29 @@
when: internet_available and is_debuntu when: internet_available and is_debuntu
# OSM wants a specific version do that first # OSM wants a specific version do that first
- name: Install Whoosh 2.6 - name: Install Whoosh 2.6 (not debuntu)
pip: name=whoosh pip:
virtualenv={{ osm_venv }} name: whoosh
virtualenv_site_packages=no virtualenv: "{{ osm_venv }}"
version=2.6 virtualenv_site_packages: no
version: 2.6
# extra_args="--no-cache-dir" # extra_args="--no-cache-dir"
when: internet_available and not is_debuntu when: internet_available and not is_debuntu
- name: Install Flask 0.12X - name: Install Flask 0.12X (not debuntu)
pip: name=Flask pip:
virtualenv={{ osm_venv }} name: Flask
virtualenv_site_packages=no virtualenv: "{{ osm_venv }}"
version=0.12.4 virtualenv_site_packages: no
version: 0.12.4
# extra_args="--no-cache-dir" # extra_args="--no-cache-dir"
when: internet_available and not is_debuntu when: internet_available and not is_debuntu
- name: Install OSM with dependencies - name: Install OSM with dependencies (not debuntu)
pip: name={{ item }} pip:
virtualenv={{ osm_venv }} name: "{{ item }}"
virtualenv_site_packages=no virtualenv: "{{ osm_venv }}"
virtualenv_site_packages: no
# extra_args="--no-cache-dir" # extra_args="--no-cache-dir"
with_items: with_items:
- MarkupSafe - MarkupSafe
@ -77,81 +85,92 @@
- Internet-in-a-Box - Internet-in-a-Box
when: internet_available and not is_debuntu when: internet_available and not is_debuntu
- name: Set osm_path - name: Set osm_path (redhat)
set_fact: set_fact:
osm_path: "{{ osm_venv }}/{{ python_path }}/iiab" osm_path: "{{ osm_venv }}/{{ python_path }}/iiab"
when: osm_enabled and is_redhat when: osm_enabled and is_redhat
- name: Set osm_path - name: Set osm_path (debuntu)
set_fact: set_fact:
osm_path: "{{ osm_venv }}/lib/python2.7/site-packages/iiab" osm_path: "{{ osm_venv }}/lib/python2.7/site-packages/iiab"
when: osm_enabled and is_debuntu when: osm_enabled and is_debuntu
- name: Point wsgi to virtual environment (all OS's) - name: Point wsgi to virtual environment (all OS's)
lineinfile: dest={{ osm_venv }}/bin/iiab.wsgi lineinfile:
regexp="path_to_virtualenv = None" dest: "{{ osm_venv }}/bin/iiab.wsgi"
line="path_to_virtualenv = '/usr/local/osm'" regexp: "path_to_virtualenv = None"
state=present line: "path_to_virtualenv = '/usr/local/osm'"
state: present
- name: Copy OSM config file (all OS's) - name: Copy OSM config file (all OS's)
template: backup=no template:
src=osm.conf.j2 src: osm.conf.j2
dest=/etc/{{ apache_config_dir }}/osm.conf dest: "/etc/{{ apache_config_dir }}/osm.conf"
owner=root owner: root
group=root group: root
mode=0644 mode: 0644
backup: no
when: osm_enabled when: osm_enabled
- name: Create a link from sites-enabled to sites-available (debuntu) - name: Create a link from sites-enabled to sites-available (debuntu)
file: src=/etc/{{ apache_config_dir }}/osm.conf file:
dest=/etc/apache2/sites-enabled/osm.conf src: "/etc/{{ apache_config_dir }}/osm.conf"
state=link dest: /etc/apache2/sites-enabled/osm.conf
state: link
when: osm_enabled and is_debuntu when: osm_enabled and is_debuntu
- name: Remove the link from sites-enabled to sites-available (debuntu) - name: Remove the link from sites-enabled to sites-available (debuntu)
file: dest=/etc/apache2/sites-enabled/osm.conf file:
state=absent dest: /etc/apache2/sites-enabled/osm.conf
state: absent
when: not osm_enabled and is_debuntu when: not osm_enabled and is_debuntu
- name: Remove the osm.conf (redhat) - name: Remove the osm.conf (redhat)
file: dest=/{{ apache_config_dir }}/osm.conf file:
state=absent dest: "/{{ apache_config_dir }}/osm.conf"
state: absent
when: not osm_enabled and is_redhat when: not osm_enabled and is_redhat
- name: Remove link to cgi (all OS's) - name: Remove link to cgi (all OS's)
file: dest={{ doc_root }}/osm.wsgi file:
state=absent dest: "{{ doc_root }}/osm.wsgi"
state: absent
when: not osm_enabled when: not osm_enabled
- name: Create link to cgi (all OS's) - name: Create link to cgi (all OS's)
file: src={{ osm_venv }}/bin/iiab.wsgi file:
dest={{ doc_root }}/osm.wsgi src: "{{ osm_venv }}/bin/iiab.wsgi"
owner=root dest: "{{ doc_root }}/osm.wsgi"
group=root owner: root
state=link group: root
state: link
when: osm_enabled when: osm_enabled
- name: Create the knowledge data set folders - name: Create the knowledge data set folders
file: path=/library/knowledge/modules file:
state=directory path: /library/knowledge/modules
owner={{ apache_user }} state: directory
group={{ apache_user }} owner: "{{ apache_user }}"
group: "{{ apache_user }}"
# the following was brought into OSM playbook from iiab-factory osm-fix script # the following was brought into OSM playbook from iiab-factory osm-fix script
- name: Copy the files - name: Copy the files
template: src={{ item.src }} dest={{ item.dest }} template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items: with_items:
- { src: 'defaults.ini', dest: "{{ osm_path }}/" } - { src: 'defaults.ini', dest: "{{ osm_path }}/" }
- { src: 'etc.iiab.conf', dest: '/etc/iiab.conf' } - { src: 'etc.iiab.conf', dest: '/etc/iiab.conf' }
- { src: 'map_search.py', dest: "{{ osm_path }}/map_search.py" } - { src: 'map_search.py', dest: "{{ osm_path }}/map_search.py" }
- { src: 'map.html', dest: "{{ osm_path }}/static/map.html" } - { 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: '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" } - { src: "{{ osm_path }}/static/map.html", dest: "{{ osm_path }}/static/index.html" }
when: osm_enabled when: osm_enabled
- name: Restart httpd service - name: Restart httpd service
service: name={{ apache_service }} service:
state=restarted name: "{{ apache_service }}"
state: restarted
- name: Add 'osm' to list of services at /etc/iiab/iiab.ini - name: Add 'osm' to list of services at /etc/iiab/iiab.ini
ini_file: ini_file: