mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	osm split
This commit is contained in:
		
							parent
							
								
									bb8ae998b6
								
							
						
					
					
						commit
						baaa17f6bb
					
				
					 4 changed files with 99 additions and 99 deletions
				
			
		
							
								
								
									
										27
									
								
								roles/osm-vector-maps/tasks/enable-or-disable.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								roles/osm-vector-maps/tasks/enable-or-disable.yml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -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"
 | 
				
			||||||
							
								
								
									
										47
									
								
								roles/osm-vector-maps/tasks/install.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								roles/osm-vector-maps/tasks/install.yml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -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'
 | 
				
			||||||
| 
						 | 
					@ -1,106 +1,16 @@
 | 
				
			||||||
- name: Ensure directory {{ vector_map_path }}/maplist/assets exists
 | 
					- name: Install osm-vector-maps
 | 
				
			||||||
  file:
 | 
					  include_tasks: install.yml
 | 
				
			||||||
    path: "{{ vector_map_path }}/maplist/assets"
 | 
					  when: osm_vector_maps_installed is undefined
 | 
				
			||||||
    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/
 | 
					- name: Install git repo copies of needed files
 | 
				
			||||||
  get_url:
 | 
					  include_tasks: enable-or-disable.yml
 | 
				
			||||||
    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
 | 
					- name: Setup NGINX
 | 
				
			||||||
  file:
 | 
					  include_tasks: nginx.yml
 | 
				
			||||||
    src: "{{ vector_map_path }}/maplist/assets/regions.json"
 | 
					  when: nginx_enabled
 | 
				
			||||||
    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'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This depends on iiab-admin-console which is not yet installed
 | 
					# This depends on iiab-admin-console which is not yet installed
 | 
				
			||||||
#- name: Run the script that does osm-vector-maps housekeeping
 | 
					#- name: Run the script that does osm-vector-maps housekeeping
 | 
				
			||||||
#  shell: /usr/bin/iiab-update-map
 | 
					#  shell: /usr/bin/iiab-update-map
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Copy countries.json (geojson) to {{ vector_map_path }}/maplist/assets
 | 
					# iiab.ini?
 | 
				
			||||||
  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'
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								roles/osm-vector-maps/tasks/nginx.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								roles/osm-vector-maps/tasks/nginx.yml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -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
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue