library/roles/geonetwork: Role that installs a geonetwork server.

This commit is contained in:
Andrea Dell'Amico 2017-01-25 09:52:35 +01:00
parent 5cb449bb5d
commit 2ddfc19a6e
2 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,14 @@
---
geonetwork_install: False
geonetwork_upgrade: False
geonetwork_major_version: '2.6'
geonetwork_minor_version: 0
geonetwork_app_name: geonetwork
geonetwork_version: '{{ geonetwork_major_version }}.{{ geonetwork_minor_version }}'
geonetwork_download_url: 'https://downloads.sourceforge.net/project/geonetwork/GeoNetwork_opensource/v{{ geonetwork_version }}/geonetwork.war?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fgeonetwork%2Ffiles%2FGeoNetwork_opensource%2Fv{{ geonetwork_version }}%2F&ts=1485267039&use_mirror=netcologne'
geonetwork_download_directory: /srv/geonetwork
geonetwork_data_directory: /srv/geonetwork_data
geonetwork_cubeapp_url: 'https://data.d4science.org/WmEwY1NwZnJ5NUtoUVBUV0w3NlBFdGEvemdvV3lUY1dHbWJQNStIS0N6Yz0'
geonetwork_configxml_url: 'https://data.d4science.org/RGlieWNEaVRDTUdoUVBUV0w3NlBFZ0Uwc2RqRm1zM05HbWJQNStIS0N6Yz0'

View File

@ -0,0 +1,58 @@
---
- block:
- name: Create the Geonetwork download directory
file: path={{ geonetwork_download_directory }} state=directory
- name: Create the Geonetwork data directory
file: path={{ geonetwork_data_directory }} state=directory owner={{ item.user }} group={{ item.user }}
with_items: '{{ tomcat_m_instances }}'
- name: Remove the geonetwork webapp if we are upgrading
file: dest={{ item.instance_path }}/webapps/{{ geonetwork_app_name }} state=absent
with_items: '{{ tomcat_m_instances }}'
when: geonetwork_upgrade
- name: Remove the geonetwork distribution file if we are upgrading
file: dest={{ geonetwork_download_directory }}/geonetwork.war state=absent
when: geonetwork_upgrade
- name: Create the Geonetwork download directory
file: path={{ geonetwork_download_directory }} state=directory
- name: Create the Geonetwork webapp directory
file: path={{ item.instance_path }}/webapps/{{ geonetwork_app_name }} state=directory owner={{ item.user }} group={{ item.user }}
with_items: '{{ tomcat_m_instances }}'
- name: Download the Geonetwork file distribution
get_url: url='{{ geonetwork_download_url }}' dest={{ geonetwork_download_directory }}/geonetwork.war
- name: Unpack the Geonetwork war file
unarchive: copy=no src={{ geonetwork_download_directory }}/geonetwork.war dest={{ item.instance_path }}/webapps/{{ geonetwork_app_name }} creates={{ item.instance_path }}/webapps/{{ geonetwork_app_name }}/WEB-INF/lib owner={{ item.user }} group={{ item.user }}
with_items: '{{ tomcat_m_instances }}'
notify: tomcat instances restart
- name: Install the gcubeapps configuration
get_url: url={{ geonetwork_cubeapp_url }} dest={{ item.instance_path }}/webapps/{{ geonetwork_app_name }}/WEB-INF/gcube-app.xml
with_items: '{{ tomcat_m_instances }}'
notify: tomcat instances restart
- name: Configure geonetwork
get_url: url={{ geonetwork_configxml_url }} dest={{ item.instance_path }}/webapps/{{ geonetwork_app_name }}/WEB-INF/config.xml
with_items: '{{ tomcat_m_instances }}'
notify: tomcat instances restart
when: geonetwork_install
tags: geonetwork
- block:
- name: Remove the Geonetwork webapp directory
file: path={{ item.instance_path }}/webapps/{{ geonetwork_app_name }} state=absent
with_items: '{{ tomcat_m_instances }}'
notify: tomcat instances restart
- name: Remove the geonetwork distribution file
file: dest={{ geonetwork_download_directory }}/geonetwork.war state=absent
when: not geonetwork_install
tags: geonetwork