From 9dd57eee3d91b22bcdcb3eb58d6f6d850cb9e5fa Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 5 Sep 2017 16:00:52 +0200 Subject: [PATCH] library/roles/thredds: role that installs thredds http://www.unidata.ucar.edu/software/thredds/current/tds/TDS.html --- thredds/defaults/main.yml | 11 +++++++++++ thredds/tasks/main.yml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 thredds/defaults/main.yml create mode 100644 thredds/tasks/main.yml diff --git a/thredds/defaults/main.yml b/thredds/defaults/main.yml new file mode 100644 index 00000000..0d2dd49e --- /dev/null +++ b/thredds/defaults/main.yml @@ -0,0 +1,11 @@ +--- +thredds_install: False +thredds_upgrade: False +thredds_version: 4.6.9 +thredds_name: tds +thredds_app_name: thredds +thredds_group_id: edu.ucar.tds +thredds_extension: war +thredds_file: '{{ thredds_name }}-{{ thredds_version }}.{{ thredds_extension }}' +thredds_repository_url: 'https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases' +thredds_download_directory: /srv diff --git a/thredds/tasks/main.yml b/thredds/tasks/main.yml new file mode 100644 index 00000000..7faf8c32 --- /dev/null +++ b/thredds/tasks/main.yml @@ -0,0 +1,32 @@ +--- +- block: + - name: Remove the Thredds webapp directory + file: path={{ item.instance_path }}/webapps/{{ thredds_app_name }} state=absent + with_items: '{{ tomcat_m_instances }}' + notify: tomcat instances restart + + - name: Remove the Thredds download and data directories + file: path={{ item }} state=absent + with_items: + - '{{ thredds_download_directory }}' + - '{{ thredds_data_directory }}' + + when: not thredds_install or thredds_upgrade + tags: [ 'thredds', 'tomcat' ] + +- block: + - name: Create the Thredds webapp directory + file: path={{ item.instance_path }}/webapps/{{ thredds_app_name }} state=directory owner={{ item.user }} group={{ item.user }} + with_items: '{{ tomcat_m_instances }}' + + - name: Get the thredds war file + maven_artifact: artifact_id={{ thredds_name }} version={{ thredds_version | default(omit) }} group_id={{ thredds_group_id }} extension={{ thredds_extension | default('war') }} repository_url={{ thredds_repository_url }} dest={{ thredds_download_directory }}/{{ thredds_file }} + + - name: Unarchive the thredds war + unarchive: copy=no src={{ smartgears_user_home }}/{{ thredds_file }} dest={{ item.instance_path }}/webapps/{{ thredds_app_name }} creates={{ item.instance_path }}/webapps/{{ thredds_app_name }}/WEB-INF/lib owner={{ item.user }} group={{ item.user }} + with_items: '{{ tomcat_m_instances }}' + notify: tomcat instances restart + + when: thredds_install + tags: [ 'thredds', 'tomcat' ] +