From baaa17f6bbb273ca14ca99e4f434534a49c6f661 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 26 Jan 2020 04:34:24 -0600 Subject: [PATCH 01/21] osm split --- .../tasks/enable-or-disable.yml | 27 +++++ roles/osm-vector-maps/tasks/install.yml | 47 ++++++++ roles/osm-vector-maps/tasks/main.yml | 108 ++---------------- roles/osm-vector-maps/tasks/nginx.yml | 16 +++ 4 files changed, 99 insertions(+), 99 deletions(-) create mode 100644 roles/osm-vector-maps/tasks/enable-or-disable.yml create mode 100644 roles/osm-vector-maps/tasks/install.yml create mode 100644 roles/osm-vector-maps/tasks/nginx.yml diff --git a/roles/osm-vector-maps/tasks/enable-or-disable.yml b/roles/osm-vector-maps/tasks/enable-or-disable.yml new file mode 100644 index 000000000..07935cac9 --- /dev/null +++ b/roles/osm-vector-maps/tasks/enable-or-disable.yml @@ -0,0 +1,27 @@ +# This depends on iiab-admin-console which is not yet installed +#- name: Run the script that does osm-vector-maps housekeeping +# shell: /usr/bin/iiab-update-map + +#- name: Does the {{ vector_map_path }}/index.html redirect already exist? +# stat: +# path: "{{ vector_map_path }}/index.html" +# register: osm_redirect + +#Copy the redirect to the test page -- delete this later if more than one map +- name: Install {{ vector_map_path }}/index.html redirect for http://box/maps -> http://box/osm-vector$ + copy: + force: no + src: test-index.redirect + dest: "{{ vector_map_path }}/index.html" + #when: not osm_redirect.stat.exists + +- name: Copy countries.json (geojson) to {{ vector_map_path }}/maplist/assets + copy: + src: countries.json + dest: "{{ vector_map_path }}/maplist/assets" + +# It is too complicated to use a single file for both iiab and admin-console +- name: Copy the duplicated JavaScript (map_functions.js) to {{ vector_map_path }}/maplist/assets + copy: + src: map_functions.js + dest: "{{ vector_map_path }}/maplist/assets" diff --git a/roles/osm-vector-maps/tasks/install.yml b/roles/osm-vector-maps/tasks/install.yml new file mode 100644 index 000000000..781056f7f --- /dev/null +++ b/roles/osm-vector-maps/tasks/install.yml @@ -0,0 +1,47 @@ +- name: Ensure directory {{ vector_map_path }}/maplist/assets exists + file: + path: "{{ vector_map_path }}/maplist/assets" + state: directory + owner: "{{ apache_user }}" + group: "{{ apache_user }}" + mode: '0755' + +- name: Download map catalog {{ iiab_map_url }}/assets/regions.json to {{ vector_map_path }}/maplist/assets/ + get_url: + url: "{{ iiab_map_url }}/assets/regions.json" + dest: "{{ vector_map_path }}/maplist/assets/" + +- name: Symlink catalog {{ doc_root }}/common/assets/regions.json -> {{ vector_map_path }}/maplist/assets/regions.json + file: + src: "{{ vector_map_path }}/maplist/assets/regions.json" + dest: "{{ doc_root }}/common/assets/regions.json" + state: link + +- name: Download the JavaScript bundle with OpenLayers (main.js) for test page http://box/maps/maplist + get_url: + url: "{{ iiab_map_url }}/../main.js" + dest: "{{ vector_map_path }}/maplist/" + +- name: Install {{ vector_map_path }}/maplist/index.html from template, for test page http://box/maps/maplist + template: + src: index.html + dest: "{{ vector_map_path }}/maplist/index.html" + +# Bboxes (bounding boxes) are currently square. But geofabrik has non-rectangular bboxes. +# So bring the bounding box definition from cloud (bboxes.geojson is big) +- name: Download bounding box definitions (bboxes.geojson) to {{ vector_map_path }}/maplist/assets/ + get_url: + url: "{{ iiab_map_url }}/assets/bboxes.geojson" + dest: "{{ vector_map_path }}/maplist/assets/" + +- name: Install /usr/bin/iiab-update-map from template, for updating of Map Pack catalog & descriptions + template: + src: iiab-update-map + dest: /usr/bin/iiab-update-map + mode: '0755' + +- name: "Add 'osm_vector_maps_installed: True' to {{ iiab_state_file }}" + lineinfile: + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml + regexp: '^osm_vector_maps_installed' + line: 'osm_vector_maps_installed: True' diff --git a/roles/osm-vector-maps/tasks/main.yml b/roles/osm-vector-maps/tasks/main.yml index b2b0c92ba..435ac44ea 100644 --- a/roles/osm-vector-maps/tasks/main.yml +++ b/roles/osm-vector-maps/tasks/main.yml @@ -1,106 +1,16 @@ -- name: Ensure directory {{ vector_map_path }}/maplist/assets exists - file: - path: "{{ vector_map_path }}/maplist/assets" - state: directory - owner: "{{ apache_user }}" - group: "{{ apache_user }}" - mode: '0755' +- name: Install osm-vector-maps + include_tasks: install.yml + when: osm_vector_maps_installed is undefined -- name: Download map catalog {{ iiab_map_url }}/assets/regions.json to {{ vector_map_path }}/maplist/assets/ - get_url: - url: "{{ iiab_map_url }}/assets/regions.json" - dest: "{{ vector_map_path }}/maplist/assets/" +- name: Install git repo copies of needed files + include_tasks: enable-or-disable.yml -- name: Symlink catalog {{ doc_root }}/common/assets/regions.json -> {{ vector_map_path }}/maplist/assets/regions.json - file: - src: "{{ vector_map_path }}/maplist/assets/regions.json" - dest: "{{ doc_root }}/common/assets/regions.json" - state: link - -- name: Download the JavaScript bundle with OpenLayers (main.js) for test page http://box/maps/maplist - get_url: - url: "{{ iiab_map_url }}/../main.js" - dest: "{{ vector_map_path }}/maplist/" - -- name: Install {{ vector_map_path }}/maplist/index.html from template, for test page http://box/maps/maplist - template: - src: index.html - dest: "{{ vector_map_path }}/maplist/index.html" - -# Bboxes (bounding boxes) are currently square. But geofabrik has non-rectangular bboxes. -# So bring the bounding box definition from cloud (bboxes.geojson is big) -- name: Download bounding box definitions (bboxes.geojson) to {{ vector_map_path }}/maplist/assets/ - get_url: - url: "{{ iiab_map_url }}/assets/bboxes.geojson" - dest: "{{ vector_map_path }}/maplist/assets/" - -# REMOVE this stanza once the transition to Python 3 is confirmed -#- name: Install python-geojson package (OS's prior to Ubuntu 19.10) -# package: -# name: python-geojson -# state: present -# when: is_raspbian_9 or is_raspbian_10 or is_ubuntu_16 or is_ubuntu_18 or is_debian_9 or is_debian_10 - -# 2019-10-19: Above python-geojson does not exist on Ubuntu 19.10, so let's -# begin the transition to Python 3... currently unused -#- name: Install python3-geojson package (especially for new OS's like Ubuntu 19.10+) -# package: -# name: python3-geojson # 2019-10-19: available across most/all recent -# state: present # OS's, but not yet used by osm-vector-maps code? - -- name: Install /usr/bin/iiab-update-map from template, for updating of Map Pack catalog & descriptions - template: - src: iiab-update-map - dest: /usr/bin/iiab-update-map - mode: '0755' +- name: Setup NGINX + include_tasks: nginx.yml + when: nginx_enabled # This depends on iiab-admin-console which is not yet installed #- name: Run the script that does osm-vector-maps housekeeping # shell: /usr/bin/iiab-update-map -- name: Copy countries.json (geojson) to {{ vector_map_path }}/maplist/assets - copy: - src: countries.json - dest: "{{ vector_map_path }}/maplist/assets" - -# It is too complicated to use a single file for both iiab and admin-console -- name: Copy the duplicated JavaScript (map_functions.js) to {{ vector_map_path }}/maplist/assets - copy: - src: map_functions.js - dest: "{{ vector_map_path }}/maplist/assets" - -- name: Install {{ nginx_conf_dir }}/osm-vector-maps.conf from template - template: - src: osm-vector-maps-nginx.conf - dest: "{{ nginx_conf_dir }}/osm-vector-maps-nginx.conf" - when: osm_vector_maps_enabled | bool - -- name: Remove {{ nginx_conf_dir }}/osm-vector-maps.conf - file: - path: "{{ nginx_conf_dir }}/osm-vector-maps-nginx.conf" - state: absent - when: not osm_vector_maps_enabled - -#- name: Does the {{ vector_map_path }}/index.html redirect already exist? -# stat: -# path: "{{ vector_map_path }}/index.html" -# register: osm_redirect - -#Copy the redirect to the test page -- delete this later if more than one map -- name: Install {{ vector_map_path }}/index.html redirect for http://box/maps -> http://box/osm-vector-maps/maplist/ if no redirect exists - copy: - force: no - src: test-index.redirect - dest: "{{ vector_map_path }}/index.html" - #when: not osm_redirect.stat.exists - -- name: Reload 'nginx' systemd service - systemd: - name: nginx - state: reloaded - -- name: "Add 'osm_vector_maps_installed: True' to {{ iiab_state_file }}" - lineinfile: - dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml - regexp: '^osm_vector_maps_installed' - line: 'osm_vector_maps_installed: True' +# iiab.ini? diff --git a/roles/osm-vector-maps/tasks/nginx.yml b/roles/osm-vector-maps/tasks/nginx.yml new file mode 100644 index 000000000..e1fd5a22a --- /dev/null +++ b/roles/osm-vector-maps/tasks/nginx.yml @@ -0,0 +1,16 @@ +- name: Install {{ nginx_conf_dir }}/osm-vector-maps.conf from template + template: + src: osm-vector-maps-nginx.conf + dest: "{{ nginx_conf_dir }}/osm-vector-maps-nginx.conf" + when: osm_vector_maps_enabled | bool + +- name: Remove {{ nginx_conf_dir }}/osm-vector-maps.conf + file: + path: "{{ nginx_conf_dir }}/osm-vector-maps-nginx.conf" + state: absent + when: not osm_vector_maps_enabled + +- name: Reload 'nginx' systemd service + systemd: + name: nginx + state: reloaded From 1f156d55f715e1c5d5562728f11cbb7084c1f9d8 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 26 Jan 2020 04:52:04 -0600 Subject: [PATCH 02/21] index order? --- .../tasks/enable-or-disable.yml | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/roles/osm-vector-maps/tasks/enable-or-disable.yml b/roles/osm-vector-maps/tasks/enable-or-disable.yml index 07935cac9..aa54f6bed 100644 --- a/roles/osm-vector-maps/tasks/enable-or-disable.yml +++ b/roles/osm-vector-maps/tasks/enable-or-disable.yml @@ -2,19 +2,6 @@ #- name: Run the script that does osm-vector-maps housekeeping # shell: /usr/bin/iiab-update-map -#- name: Does the {{ vector_map_path }}/index.html redirect already exist? -# stat: -# path: "{{ vector_map_path }}/index.html" -# register: osm_redirect - -#Copy the redirect to the test page -- delete this later if more than one map -- name: Install {{ vector_map_path }}/index.html redirect for http://box/maps -> http://box/osm-vector$ - copy: - force: no - src: test-index.redirect - dest: "{{ vector_map_path }}/index.html" - #when: not osm_redirect.stat.exists - - name: Copy countries.json (geojson) to {{ vector_map_path }}/maplist/assets copy: src: countries.json @@ -25,3 +12,22 @@ copy: src: map_functions.js dest: "{{ vector_map_path }}/maplist/assets" + +- name: Install {{ vector_map_path }}/maplist/index.html from template, for test page http://box/maps/maplist + template: + src: index.html + dest: "{{ vector_map_path }}/maplist/index.html" + +#- name: Does the {{ vector_map_path }}/index.html redirect already exist? +# stat: +# path: "{{ vector_map_path }}/index.html" +# register: osm_redirect + +#Copy the redirect to the test page -- delete this later if more than one map +- name: Install {{ vector_map_path }}/index.html redirect for http://box/maps -> http://box/osm-vector-maps + copy: + force: no + src: test-index.redirect + dest: "{{ vector_map_path }}/index.html" + #when: not osm_redirect.stat.exists + From e61230c8179ff5498f44071c8f9ad48f2a94c781 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 00:56:31 -0500 Subject: [PATCH 03/21] Update osm-vector-maps/tasks/main.yml --- roles/osm-vector-maps/tasks/main.yml | 37 +++++++++++++++++++++------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/roles/osm-vector-maps/tasks/main.yml b/roles/osm-vector-maps/tasks/main.yml index 435ac44ea..90b80ad17 100644 --- a/roles/osm-vector-maps/tasks/main.yml +++ b/roles/osm-vector-maps/tasks/main.yml @@ -1,16 +1,35 @@ -- name: Install osm-vector-maps +# "How do i fail a task in Ansible if the variable contains a boolean value? +# I want to perform input validation for Ansible playbooks" +# https://stackoverflow.com/questions/46664127/how-do-i-fail-a-task-in-ansible-if-the-variable-contains-a-boolean-value-i-want/46667499#46667499 + +# We assume 0-init/tasks/validate_vars.yml has DEFINITELY been run, so no need +# to re-check whether vars are defined here. As Ansible vars cannot be unset: +# https://serverfault.com/questions/856729/how-to-destroy-delete-unset-a-variable-value-in-ansible + +- name: Assert that "osm_vector_maps_install is sameas true" (boolean not string etc) + assert: + that: osm_vector_maps_install is sameas true + fail_msg: "PLEASE SET 'osm_vector_maps_install: True' e.g. IN: /etc/iiab/local_vars.yml" + quiet: yes + +- name: Assert that "osm_vector_maps_enabled | type_debug == 'bool'" (boolean not string etc) + assert: + that: osm_vector_maps_enabled | type_debug == 'bool' + fail_msg: "PLEASE GIVE VARIABLE 'osm_vector_maps_enabled' A PROPER (UNQUOTED) BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml" + quiet: yes + + +- name: Install OSM Vector Maps if 'osm_vector_maps_installed' is not defined in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml include_tasks: install.yml when: osm_vector_maps_installed is undefined -- name: Install git repo copies of needed files - include_tasks: enable-or-disable.yml -- name: Setup NGINX +#- name: Install countries.json, map_functions.js, index.html under-or-in {{ vector_map_path }}/maplist # /library/www/osm-vector-maps +# include_tasks: enable-or-disable.yml + +- name: Enable/Disable/Reload NGINX for OSM, if nginx_enabled include_tasks: nginx.yml - when: nginx_enabled + when: nginx_enabled | bool -# This depends on iiab-admin-console which is not yet installed -#- name: Run the script that does osm-vector-maps housekeeping -# shell: /usr/bin/iiab-update-map -# iiab.ini? +# TO DO: write important vars to /etc/iiab/iiab.ini From 696c15e06f102e19200880c76cb7c4c209f07f96 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 00:56:47 -0500 Subject: [PATCH 04/21] Update osm-vector-maps/tasks/install.yml --- roles/osm-vector-maps/tasks/install.yml | 43 ++++++++++++++++++------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/roles/osm-vector-maps/tasks/install.yml b/roles/osm-vector-maps/tasks/install.yml index 781056f7f..4812c7f2e 100644 --- a/roles/osm-vector-maps/tasks/install.yml +++ b/roles/osm-vector-maps/tasks/install.yml @@ -1,38 +1,38 @@ - name: Ensure directory {{ vector_map_path }}/maplist/assets exists file: - path: "{{ vector_map_path }}/maplist/assets" + path: "{{ vector_map_path }}/maplist/assets" # /library/www/osm-vector-maps state: directory - owner: "{{ apache_user }}" + owner: "{{ apache_user }}" # Typically 'www-data' or 'apache' group: "{{ apache_user }}" mode: '0755' - name: Download map catalog {{ iiab_map_url }}/assets/regions.json to {{ vector_map_path }}/maplist/assets/ get_url: - url: "{{ iiab_map_url }}/assets/regions.json" - dest: "{{ vector_map_path }}/maplist/assets/" + url: "{{ iiab_map_url }}/assets/regions.json" # http://download.iiab.io/content/OSM/vector-tiles/maplist/hidden + dest: "{{ vector_map_path }}/maplist/assets/" # /library/www/osm-vector-maps - name: Symlink catalog {{ doc_root }}/common/assets/regions.json -> {{ vector_map_path }}/maplist/assets/regions.json file: - src: "{{ vector_map_path }}/maplist/assets/regions.json" - dest: "{{ doc_root }}/common/assets/regions.json" + src: "{{ vector_map_path }}/maplist/assets/regions.json" # /library/www/osm-vector-maps + dest: "{{ doc_root }}/common/assets/regions.json" # /library/www/html state: link - name: Download the JavaScript bundle with OpenLayers (main.js) for test page http://box/maps/maplist get_url: - url: "{{ iiab_map_url }}/../main.js" - dest: "{{ vector_map_path }}/maplist/" + url: "{{ iiab_map_url }}/../main.js" # http://download.iiab.io/content/OSM/vector-tiles/maplist/hidden + dest: "{{ vector_map_path }}/maplist/" # /library/www/osm-vector-maps - name: Install {{ vector_map_path }}/maplist/index.html from template, for test page http://box/maps/maplist template: src: index.html - dest: "{{ vector_map_path }}/maplist/index.html" + dest: "{{ vector_map_path }}/maplist/index.html" # /library/www/osm-vector-maps # Bboxes (bounding boxes) are currently square. But geofabrik has non-rectangular bboxes. # So bring the bounding box definition from cloud (bboxes.geojson is big) - name: Download bounding box definitions (bboxes.geojson) to {{ vector_map_path }}/maplist/assets/ get_url: - url: "{{ iiab_map_url }}/assets/bboxes.geojson" - dest: "{{ vector_map_path }}/maplist/assets/" + url: "{{ iiab_map_url }}/assets/bboxes.geojson" # http://download.iiab.io/content/OSM/vector-tiles/maplist/hidden + dest: "{{ vector_map_path }}/maplist/assets/" # /library/www/osm-vector-maps - name: Install /usr/bin/iiab-update-map from template, for updating of Map Pack catalog & descriptions template: @@ -40,6 +40,27 @@ dest: /usr/bin/iiab-update-map mode: '0755' + +# 2020-01-27: Should the following 3 stanzas be restored to +# enable-or-disable.yml? How does this help if so? + +- name: Copy countries.json (geojson) to {{ vector_map_path }}/maplist/assets + copy: + src: countries.json + dest: "{{ vector_map_path }}/maplist/assets" # /library/www/osm-vector-maps + +# It is too complicated to use a single file for both iiab and admin-console +- name: Copy map_functions.js (duplicated JavaScript) to {{ vector_map_path }}/maplist/assets + copy: + src: map_functions.js + dest: "{{ vector_map_path }}/maplist/assets" # /library/www/osm-vector-maps + +- name: Install {{ vector_map_path }}/maplist/index.html from template, for test page http://box/maps/maplist + template: + src: index.html + dest: "{{ vector_map_path }}/maplist/index.html" # /library/www/osm-vector-maps + + - name: "Add 'osm_vector_maps_installed: True' to {{ iiab_state_file }}" lineinfile: dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml From 3460ff3e84c1e5ce01a91d75345d1bb4d5cc9317 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 00:57:22 -0500 Subject: [PATCH 05/21] Update & Rename osm-vector-maps/tasks/enable-or-disable.yml to enable-or-disable.yml.deprecated --- .../tasks/enable-or-disable.yml | 33 ------------------- .../tasks/enable-or-disable.yml.deprecated | 33 +++++++++++++++++++ 2 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 roles/osm-vector-maps/tasks/enable-or-disable.yml create mode 100644 roles/osm-vector-maps/tasks/enable-or-disable.yml.deprecated diff --git a/roles/osm-vector-maps/tasks/enable-or-disable.yml b/roles/osm-vector-maps/tasks/enable-or-disable.yml deleted file mode 100644 index aa54f6bed..000000000 --- a/roles/osm-vector-maps/tasks/enable-or-disable.yml +++ /dev/null @@ -1,33 +0,0 @@ -# This depends on iiab-admin-console which is not yet installed -#- name: Run the script that does osm-vector-maps housekeeping -# shell: /usr/bin/iiab-update-map - -- name: Copy countries.json (geojson) to {{ vector_map_path }}/maplist/assets - copy: - src: countries.json - dest: "{{ vector_map_path }}/maplist/assets" - -# It is too complicated to use a single file for both iiab and admin-console -- name: Copy the duplicated JavaScript (map_functions.js) to {{ vector_map_path }}/maplist/assets - copy: - src: map_functions.js - dest: "{{ vector_map_path }}/maplist/assets" - -- name: Install {{ vector_map_path }}/maplist/index.html from template, for test page http://box/maps/maplist - template: - src: index.html - dest: "{{ vector_map_path }}/maplist/index.html" - -#- name: Does the {{ vector_map_path }}/index.html redirect already exist? -# stat: -# path: "{{ vector_map_path }}/index.html" -# register: osm_redirect - -#Copy the redirect to the test page -- delete this later if more than one map -- name: Install {{ vector_map_path }}/index.html redirect for http://box/maps -> http://box/osm-vector-maps - copy: - force: no - src: test-index.redirect - dest: "{{ vector_map_path }}/index.html" - #when: not osm_redirect.stat.exists - diff --git a/roles/osm-vector-maps/tasks/enable-or-disable.yml.deprecated b/roles/osm-vector-maps/tasks/enable-or-disable.yml.deprecated new file mode 100644 index 000000000..1219cd6f8 --- /dev/null +++ b/roles/osm-vector-maps/tasks/enable-or-disable.yml.deprecated @@ -0,0 +1,33 @@ +# This depends on iiab-admin-console which is not yet installed +#- name: Run the script that does osm-vector-maps housekeeping +# shell: /usr/bin/iiab-update-map + +- name: Copy countries.json (geojson) to {{ vector_map_path }}/maplist/assets + copy: + src: countries.json + dest: "{{ vector_map_path }}/maplist/assets" # /library/www/osm-vector-maps + +# It is too complicated to use a single file for both iiab and admin-console +- name: Copy map_functions.js (duplicated JavaScript) to {{ vector_map_path }}/maplist/assets + copy: + src: map_functions.js + dest: "{{ vector_map_path }}/maplist/assets" # /library/www/osm-vector-maps + +- name: Install {{ vector_map_path }}/maplist/index.html from template, for test page http://box/maps/maplist + template: + src: index.html + dest: "{{ vector_map_path }}/maplist/index.html" # /library/www/osm-vector-maps + +#- name: Does the {{ vector_map_path }}/index.html redirect already exist? +# stat: +# path: "{{ vector_map_path }}/index.html" +# register: osm_redirect + +# No longer needed with NGINX +##Copy the redirect to the test page -- delete this later if more than one map +#- name: Install {{ vector_map_path }}/index.html redirect for http://box/maps -> http://box/osm-vector-maps +# copy: +# force: no +# src: test-index.redirect +# dest: "{{ vector_map_path }}/index.html" # /library/www/osm-vector-maps +# #when: not osm_redirect.stat.exists From 9d08666e1af3c3514587fcf8cf6a3945f231c6ef Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 00:57:39 -0500 Subject: [PATCH 06/21] Update and rename test-index.redirect to test-index.redirect.deprecated --- .../{test-index.redirect => test-index.redirect.deprecated} | 1 - 1 file changed, 1 deletion(-) rename roles/osm-vector-maps/files/{test-index.redirect => test-index.redirect.deprecated} (98%) diff --git a/roles/osm-vector-maps/files/test-index.redirect b/roles/osm-vector-maps/files/test-index.redirect.deprecated similarity index 98% rename from roles/osm-vector-maps/files/test-index.redirect rename to roles/osm-vector-maps/files/test-index.redirect.deprecated index 9ad3694cc..a905adb5b 100644 --- a/roles/osm-vector-maps/files/test-index.redirect +++ b/roles/osm-vector-maps/files/test-index.redirect.deprecated @@ -1,4 +1,3 @@ - From 1c275cb88c46b7125308b4d8b0cedc972eede769 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 00:58:15 -0500 Subject: [PATCH 07/21] Clean osm-vector-maps/tasks/nginx.yml --- roles/osm-vector-maps/tasks/nginx.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/osm-vector-maps/tasks/nginx.yml b/roles/osm-vector-maps/tasks/nginx.yml index e1fd5a22a..88ed0cc3d 100644 --- a/roles/osm-vector-maps/tasks/nginx.yml +++ b/roles/osm-vector-maps/tasks/nginx.yml @@ -1,10 +1,10 @@ -- name: Install {{ nginx_conf_dir }}/osm-vector-maps.conf from template +- name: Enable http://box/maps & http://box/osm-vector-maps via NGINX, by installing {{ nginx_conf_dir }}/osm-vector-maps-nginx.conf from template template: - src: osm-vector-maps-nginx.conf + src: osm-vector-maps-nginx.conf.j2 dest: "{{ nginx_conf_dir }}/osm-vector-maps-nginx.conf" when: osm_vector_maps_enabled | bool -- name: Remove {{ nginx_conf_dir }}/osm-vector-maps.conf +- name: Disable http://box/maps & http://box/osm-vector-maps via NGINX, by removing {{ nginx_conf_dir }}/osm-vector-maps-nginx.conf file: path: "{{ nginx_conf_dir }}/osm-vector-maps-nginx.conf" state: absent From 92b475210ba8fc4862110cde04b22fa650b7515a Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 00:58:41 -0500 Subject: [PATCH 08/21] Softcode osm-vector-maps/templates/osm-vector-maps-nginx.conf --- ...ctor-maps-nginx.conf => osm-vector-maps-nginx.conf.j2} | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename roles/osm-vector-maps/templates/{osm-vector-maps-nginx.conf => osm-vector-maps-nginx.conf.j2} (74%) diff --git a/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf b/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 similarity index 74% rename from roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf rename to roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 index 035ebb651..11e354245 100644 --- a/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf +++ b/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 @@ -1,12 +1,14 @@ # For downloadable regional vector tilesets location /maps { - rewrite ^/maps(.*)$ /osm-vector-maps$1; + rewrite ^/maps(.*)$ /osm-vector-maps$1; } + location /osm-vector-maps { - alias /library/www/osm-vector-maps; + alias {{ vector_map_path }}; # /library/www/osm-vector-maps } + location ~ ^/osm-vector-maps/(.*)\.php(.*)$ { - alias /library/www/osm-vector-maps/$1.php$2; + alias {{ vector_map_path }}/$1.php$2; # /library/www/osm-vector-maps proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; From 68afc3205b255366b064f9d59ec45b9859e97f16 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 01:09:50 -0500 Subject: [PATCH 09/21] Cleaner osm-vector-maps/tasks/install.yml --- roles/osm-vector-maps/tasks/install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/osm-vector-maps/tasks/install.yml b/roles/osm-vector-maps/tasks/install.yml index 4812c7f2e..7801aa7c1 100644 --- a/roles/osm-vector-maps/tasks/install.yml +++ b/roles/osm-vector-maps/tasks/install.yml @@ -41,8 +41,8 @@ mode: '0755' -# 2020-01-27: Should the following 3 stanzas be restored to -# enable-or-disable.yml? How does this help if so? +# 2020-01-27: See #2197 "OSM Install Errors" -- should the following 3 stanzas +# be restored to enable-or-disable.yml ? What fix is best short/long term? - name: Copy countries.json (geojson) to {{ vector_map_path }}/maplist/assets copy: From 96dd134e9c9387c40f86348d5090a95583b4c54c Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 01:14:19 -0500 Subject: [PATCH 10/21] Update osm-vector-maps-nginx.conf.j2 --- roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 b/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 index 11e354245..c4ea29c51 100644 --- a/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 +++ b/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 @@ -1,5 +1,5 @@ # For downloadable regional vector tilesets -location /maps { +location /maps* { rewrite ^/maps(.*)$ /osm-vector-maps$1; } From 4b254dc48c0e09ec0c91ce73c746168941f6a8f4 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 01:25:38 -0500 Subject: [PATCH 11/21] Rename test-index.redirect.deprecated to test-index.redirect --- .../files/{test-index.redirect.deprecated => test-index.redirect} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/osm-vector-maps/files/{test-index.redirect.deprecated => test-index.redirect} (100%) diff --git a/roles/osm-vector-maps/files/test-index.redirect.deprecated b/roles/osm-vector-maps/files/test-index.redirect similarity index 100% rename from roles/osm-vector-maps/files/test-index.redirect.deprecated rename to roles/osm-vector-maps/files/test-index.redirect From a8c3261cdd8fd3bcc6de9fdaf845ab694a31b345 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 01:26:22 -0500 Subject: [PATCH 12/21] Update enable-or-disable.yml.deprecated --- .../tasks/enable-or-disable.yml.deprecated | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/roles/osm-vector-maps/tasks/enable-or-disable.yml.deprecated b/roles/osm-vector-maps/tasks/enable-or-disable.yml.deprecated index 1219cd6f8..58c6bea5e 100644 --- a/roles/osm-vector-maps/tasks/enable-or-disable.yml.deprecated +++ b/roles/osm-vector-maps/tasks/enable-or-disable.yml.deprecated @@ -23,11 +23,10 @@ # path: "{{ vector_map_path }}/index.html" # register: osm_redirect -# No longer needed with NGINX -##Copy the redirect to the test page -- delete this later if more than one map -#- name: Install {{ vector_map_path }}/index.html redirect for http://box/maps -> http://box/osm-vector-maps -# copy: -# force: no -# src: test-index.redirect -# dest: "{{ vector_map_path }}/index.html" # /library/www/osm-vector-maps -# #when: not osm_redirect.stat.exists +#Copy the redirect to the test page -- delete this later if more than one map +- name: Install {{ vector_map_path }}/index.html redirect for http://box/maps -> http://box/osm-vector-maps + copy: + force: no + src: test-index.redirect + dest: "{{ vector_map_path }}/index.html" # /library/www/osm-vector-maps + #when: not osm_redirect.stat.exists From 0b368bb64de3c64c552705e5c386b7f1f8a4ac03 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 01:27:46 -0500 Subject: [PATCH 13/21] Update osm-vector-maps/tasks/install.yml --- roles/osm-vector-maps/tasks/install.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/roles/osm-vector-maps/tasks/install.yml b/roles/osm-vector-maps/tasks/install.yml index 7801aa7c1..f7a5d9e84 100644 --- a/roles/osm-vector-maps/tasks/install.yml +++ b/roles/osm-vector-maps/tasks/install.yml @@ -41,7 +41,7 @@ mode: '0755' -# 2020-01-27: See #2197 "OSM Install Errors" -- should the following 3 stanzas +# 2020-01-27: See #2197 "OSM Install Errors" -- should the following 4 stanzas # be restored to enable-or-disable.yml ? What fix is best short/long term? - name: Copy countries.json (geojson) to {{ vector_map_path }}/maplist/assets @@ -60,6 +60,12 @@ src: index.html dest: "{{ vector_map_path }}/maplist/index.html" # /library/www/osm-vector-maps +- name: Install {{ vector_map_path }}/index.html redirect for http://box/maps -> http://box/osm-vector-maps + copy: + force: no + src: test-index.redirect + dest: "{{ vector_map_path }}/index.html" # /library/www/osm-vector-maps + - name: "Add 'osm_vector_maps_installed: True' to {{ iiab_state_file }}" lineinfile: From 5e3a0e7f342bfb3d26d43ce95d68488da0e643b8 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 01:49:00 -0500 Subject: [PATCH 14/21] Update osm-vector-maps-nginx.conf.j2 --- roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 b/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 index c4ea29c51..11e354245 100644 --- a/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 +++ b/roles/osm-vector-maps/templates/osm-vector-maps-nginx.conf.j2 @@ -1,5 +1,5 @@ # For downloadable regional vector tilesets -location /maps* { +location /maps { rewrite ^/maps(.*)$ /osm-vector-maps$1; } From 2fc24a70c8a2a251fcec9e60f6296ac6bd403011 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 02:01:55 -0500 Subject: [PATCH 15/21] Cleaner osm-vector-maps/tasks/install.yml --- roles/osm-vector-maps/tasks/install.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/osm-vector-maps/tasks/install.yml b/roles/osm-vector-maps/tasks/install.yml index f7a5d9e84..1ff98386e 100644 --- a/roles/osm-vector-maps/tasks/install.yml +++ b/roles/osm-vector-maps/tasks/install.yml @@ -44,23 +44,23 @@ # 2020-01-27: See #2197 "OSM Install Errors" -- should the following 4 stanzas # be restored to enable-or-disable.yml ? What fix is best short/long term? -- name: Copy countries.json (geojson) to {{ vector_map_path }}/maplist/assets +- name: Copy countries.json (geojson) into {{ vector_map_path }}/maplist/assets/ copy: src: countries.json dest: "{{ vector_map_path }}/maplist/assets" # /library/www/osm-vector-maps # It is too complicated to use a single file for both iiab and admin-console -- name: Copy map_functions.js (duplicated JavaScript) to {{ vector_map_path }}/maplist/assets +- name: Copy map_functions.js (duplicated JavaScript) into {{ vector_map_path }}/maplist/assets/ copy: src: map_functions.js dest: "{{ vector_map_path }}/maplist/assets" # /library/www/osm-vector-maps -- name: Install {{ vector_map_path }}/maplist/index.html from template, for test page http://box/maps/maplist +- name: Install {{ vector_map_path }}/maplist/index.html from template, for test page http://box/maps/maplist/ template: src: index.html dest: "{{ vector_map_path }}/maplist/index.html" # /library/www/osm-vector-maps -- name: Install {{ vector_map_path }}/index.html redirect for http://box/maps -> http://box/osm-vector-maps +- name: "Copy test-index.redirect to {{ vector_map_path }}/index.html, for redirect: http://box/maps/ -> http://box/osm-vector-maps/" copy: force: no src: test-index.redirect From 33f28fb3d9574b032b7ba1e089bef82c6ab5259d Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 02:20:46 -0500 Subject: [PATCH 16/21] Cleaner osm-vector-maps/tasks/main.yml --- roles/osm-vector-maps/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/osm-vector-maps/tasks/main.yml b/roles/osm-vector-maps/tasks/main.yml index 90b80ad17..1c6c2ddb3 100644 --- a/roles/osm-vector-maps/tasks/main.yml +++ b/roles/osm-vector-maps/tasks/main.yml @@ -24,7 +24,7 @@ when: osm_vector_maps_installed is undefined -#- name: Install countries.json, map_functions.js, index.html under-or-in {{ vector_map_path }}/maplist # /library/www/osm-vector-maps +#- name: Install countries.json, map_functions.js & 2 index.html's under-or-in {{ vector_map_path }}/maplist # /library/www/osm-vector-maps # include_tasks: enable-or-disable.yml - name: Enable/Disable/Reload NGINX for OSM, if nginx_enabled From 3d02197d54d2146206b8cc13359cd9515c3f5549 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 02:30:27 -0500 Subject: [PATCH 17/21] Save osm-vector-maps vars to /etc/iiab/iiab.ini --- roles/osm-vector-maps/tasks/main.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/roles/osm-vector-maps/tasks/main.yml b/roles/osm-vector-maps/tasks/main.yml index 1c6c2ddb3..e0b81ce39 100644 --- a/roles/osm-vector-maps/tasks/main.yml +++ b/roles/osm-vector-maps/tasks/main.yml @@ -32,4 +32,18 @@ when: nginx_enabled | bool -# TO DO: write important vars to /etc/iiab/iiab.ini +- name: Add 'osm-vector-maps' variable values to {{ iiab_ini_file }} + ini_file: + path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini + section: osm-vector-maps + option: "{{ item.option }}" + value: "{{ item.value | string }}" + with_items: + - option: name + value: OSM Vector Maps + - option: description + value: '"OpenStreetMap is like Google Maps but better, for schools especially, as it works offline and avoids all the advertising. Download detailed ''vector maps'' for an entire continent, or the entire world! Also includes 10+ zoom levels of satellite imagery!"' + - option: installed + value: "{{ osm_vector_maps_install }}" + - option: enabled + value: "{{ osm_vector_maps_enabled }}" From f904e35745a80971b6e2628e188a523b910b98d7 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 02:34:28 -0500 Subject: [PATCH 18/21] captiveportal/tasks/main.yml readability --- roles/captiveportal/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/captiveportal/tasks/main.yml b/roles/captiveportal/tasks/main.yml index ac6f6f912..959cc0268 100644 --- a/roles/captiveportal/tasks/main.yml +++ b/roles/captiveportal/tasks/main.yml @@ -30,7 +30,7 @@ - name: Add 'captiveportal' variable values to {{ iiab_ini_file }} ini_file: - path: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini section: captiveportal option: "{{ item.option }}" value: "{{ item.value | string }}" From 4c10fb62ab0f1a146d2515d2bcb410c6fca53c33 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 02:34:31 -0500 Subject: [PATCH 19/21] munin/tasks/main.yml readability --- roles/munin/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/munin/tasks/main.yml b/roles/munin/tasks/main.yml index 7d823aba8..dca8a244b 100644 --- a/roles/munin/tasks/main.yml +++ b/roles/munin/tasks/main.yml @@ -50,7 +50,7 @@ - name: Add 'munin' variable values to {{ iiab_ini_file }} ini_file: - path: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini section: munin option: "{{ item.option }}" value: "{{ item.value | string }}" From 26eae9124bcc2219f3a40edd0549a3950b55459a Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 02:34:33 -0500 Subject: [PATCH 20/21] wordpress/tasks/main.yml readability --- roles/wordpress/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/wordpress/tasks/main.yml b/roles/wordpress/tasks/main.yml index 4dfd3c62e..7bca5e7d8 100644 --- a/roles/wordpress/tasks/main.yml +++ b/roles/wordpress/tasks/main.yml @@ -41,7 +41,7 @@ - name: Add 'wordpress' variable values to {{ iiab_ini_file }} ini_file: - path: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini section: wordpress option: "{{ item.option }}" value: "{{ item.value | string }}" From b0558bb7690914ea6e19a457bb350f02065a582e Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Jan 2020 02:49:13 -0500 Subject: [PATCH 21/21] Cleaner osm-vector-maps/tasks/install.yml --- roles/osm-vector-maps/tasks/install.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/osm-vector-maps/tasks/install.yml b/roles/osm-vector-maps/tasks/install.yml index 1ff98386e..d43cfbce4 100644 --- a/roles/osm-vector-maps/tasks/install.yml +++ b/roles/osm-vector-maps/tasks/install.yml @@ -17,12 +17,12 @@ dest: "{{ doc_root }}/common/assets/regions.json" # /library/www/html state: link -- name: Download the JavaScript bundle with OpenLayers (main.js) for test page http://box/maps/maplist +- name: Download the JavaScript bundle with OpenLayers (main.js) into {{ vector_map_path }}/maplist/, for test page http://box/maps/maplist get_url: url: "{{ iiab_map_url }}/../main.js" # http://download.iiab.io/content/OSM/vector-tiles/maplist/hidden dest: "{{ vector_map_path }}/maplist/" # /library/www/osm-vector-maps -- name: Install {{ vector_map_path }}/maplist/index.html from template, for test page http://box/maps/maplist +- name: Install {{ vector_map_path }}/maplist/index.html from template, for test page http://box/maps/maplist/ template: src: index.html dest: "{{ vector_map_path }}/maplist/index.html" # /library/www/osm-vector-maps @@ -60,7 +60,7 @@ src: index.html dest: "{{ vector_map_path }}/maplist/index.html" # /library/www/osm-vector-maps -- name: "Copy test-index.redirect to {{ vector_map_path }}/index.html, for redirect: http://box/maps/ -> http://box/osm-vector-maps/" +- name: "Copy test-index.redirect to {{ vector_map_path }}/index.html, for interim redirect: http://box/maps/ -> http://box/osm-vector-maps/maplist/" copy: force: no src: test-index.redirect