diff --git a/geoserver/geoserver/tasks/geoserver-gcubeapp.yml b/geoserver/geoserver/tasks/geoserver-gcubeapp.yml new file mode 100644 index 00000000..6ca8dbd4 --- /dev/null +++ b/geoserver/geoserver/tasks/geoserver-gcubeapp.yml @@ -0,0 +1,8 @@ +--- +- name: Install the gcube-app file to make geoserver smartgears compatible + template: src=gcube-app.xml.j2 dest={{ item.instance_path }}/webapps/{{ geoserver_app_name }}/WEB-INF/gcube-app.xml owner={{ item.user }} group={{ item.user }} + with_items: '{{ tomcat_m_instances }}' + notify: tomcat instances restart + when: geoserver_install + tags: geoserver + diff --git a/geoserver/geoserver/tasks/geoserver.yml b/geoserver/geoserver/tasks/geoserver.yml new file mode 100644 index 00000000..cea51fc7 --- /dev/null +++ b/geoserver/geoserver/tasks/geoserver.yml @@ -0,0 +1,40 @@ +--- + +- block: + - name: Create the Geoserver download directory + file: path={{ geoserver_download_directory }} state=directory + + - name: Create the Geoserver webapp directory + file: path={{ item.instance_path }}/webapps/{{ geoserver_app_name }} state=directory owner={{ item.user }} group={{ item.user }} + with_items: '{{ tomcat_m_instances }}' + + - name: Create the Geoserver data directory + file: path={{ geoserver_data_directory }} state=directory owner={{ item.user }} group={{ item.user }} + with_items: '{{ tomcat_m_instances }}' + + - name: Download and unpack the Geoserver file distribution + unarchive: copy=no src={{ geoserver_download_url }} dest={{ geoserver_download_directory }} creates={{ geoserver_download_directory }}/geoserver.war validate_certs=False + + - name: Unpack the Geoserver war file + unarchive: copy=no src={{ geoserver_download_directory }}/geoserver.war dest={{ item.instance_path }}/webapps/{{ geoserver_app_name }} creates={{ item.instance_path }}/webapps/{{ geoserver_app_name }}/WEB-INF/lib owner={{ item.user }} group={{ item.user }} + with_items: '{{ tomcat_m_instances }}' + notify: tomcat instances restart + + when: geoserver_install + tags: geoserver + +- block: + - name: Remove the Geoserver webapp directory + file: path={{ item.instance_path }}/webapps/{{ geoserver_app_name }} state=absent + with_items: '{{ tomcat_m_instances }}' + notify: tomcat instances restart + + - name: Remove the Geoserver download and data directories + file: path={{ item }} state=absent + with_items: + - '{{ geoserver_download_directory }}' + - '{{ geoserver_data_directory }}' + + when: not geoserver_install + tags: geoserver + diff --git a/geoserver/geoserver/tasks/main.yml b/geoserver/geoserver/tasks/main.yml index 794b336b..03b4756c 100644 --- a/geoserver/geoserver/tasks/main.yml +++ b/geoserver/geoserver/tasks/main.yml @@ -1,39 +1,4 @@ --- -- block: - - name: Create the Geoserver download directory - file: path={{ geoserver_download_directory }} state=directory - - - name: Create the Geoserver webapp directory - file: path={{ item.instance_path }}/webapps/{{ geoserver_app_name }} state=directory owner={{ item.user }} group={{ item.user }} - with_items: '{{ tomcat_m_instances }}' - - - name: Create the Geoserver data directory - file: path={{ geoserver_data_directory }} state=directory owner={{ item.user }} group={{ item.user }} - with_items: '{{ tomcat_m_instances }}' - - - name: Download and unpack the Geoserver file distribution - unarchive: copy=no src={{ geoserver_download_url }} dest={{ geoserver_download_directory }} creates={{ geoserver_download_directory }}/geoserver.war - - - name: Unpack the Geoserver war file - unarchive: copy=no src={{ geoserver_download_directory }}/geoserver.war dest={{ item.instance_path }}/webapps/{{ geoserver_app_name }} creates={{ item.instance_path }}/webapps/{{ geoserver_app_name }}/WEB-INF/lib owner={{ item.user }} group={{ item.user }} - with_items: '{{ tomcat_m_instances }}' - notify: tomcat instances restart - - when: geoserver_install - tags: geoserver - -- block: - - name: Remove the Geoserver webapp directory - file: path={{ item.instance_path }}/webapps/{{ geoserver_app_name }} state=absent - with_items: '{{ tomcat_m_instances }}' - notify: tomcat instances restart - - - name: Remove the Geoserver download and data directories - file: path={{ item }} state=absent - with_items: - - '{{ geoserver_download_directory }}' - - '{{ geoserver_data_directory }}' - - when: not geoserver_install - tags: geoserver - +- include: geoserver.yml +- include: geoserver-gcubeapp.yml + when: smartgears_node is defined and smartgears_node diff --git a/geoserver/geoserver/templates/gcube-app.xml.j2 b/geoserver/geoserver/templates/gcube-app.xml.j2 new file mode 100644 index 00000000..0baffcc7 --- /dev/null +++ b/geoserver/geoserver/templates/gcube-app.xml.j2 @@ -0,0 +1,12 @@ + + + {{ smartgears_gcube_app_name }} + {{ smartgears_gcube_app_group }} + 1.0 +{% if smartgears_persistence_location is defined %} + +{% endif %} + * + + +