From 226ccb013090e1a3dc8f92c36b1b80dca5d50075 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 8 Mar 2017 14:48:17 +0100 Subject: [PATCH] library/roles/smartgears: Role that installs the gcube oauth service. --- smartgears/gcube-oauth/defaults/main.yml | 9 ++++++++ smartgears/gcube-oauth/tasks/main.yml | 26 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 smartgears/gcube-oauth/defaults/main.yml create mode 100644 smartgears/gcube-oauth/tasks/main.yml diff --git a/smartgears/gcube-oauth/defaults/main.yml b/smartgears/gcube-oauth/defaults/main.yml new file mode 100644 index 0000000..0f9556c --- /dev/null +++ b/smartgears/gcube-oauth/defaults/main.yml @@ -0,0 +1,9 @@ +--- +gcube_oauth_install: False +gcube_oauth_version: 1.0.0-4.3.0-142179 +gcube_oauth_name: oauth +gcube_oauth_group_id: org.gcube.portal +gcube_oauth_extension: war +gcube_oauth_file: '{{ gcube_oauth_name }}-{{ gcube_oauth_version }}.{{ gcube_oauth_extension }}' +gcube_oauth_repository_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ gcube_repository }}' + diff --git a/smartgears/gcube-oauth/tasks/main.yml b/smartgears/gcube-oauth/tasks/main.yml new file mode 100644 index 0000000..5a3f34f --- /dev/null +++ b/smartgears/gcube-oauth/tasks/main.yml @@ -0,0 +1,26 @@ +--- +- block: + - name: Remove the old gcube oauth files + file: path={{ smartgears_instance_path }}/webapps/{{ gcube_oauth_name }} state=absent + + become: True + become_user: '{{ d4science_user }}' + when: ( not gcube_oauth_install ) or ( smartgears_upgrade ) + tags: [ 'smartgears', 'gcube_oauth', 'tomcat' ] + +- block: + # NOTE: Install as the smartgears user so we do not mess with the permissions + - name: Get the gcube-oauth war + maven_artifact: artifact_id={{ gcube_oauth_name }} version={{ gcube_oauth_version | default(omit) }} group_id={{ gcube_oauth_group_id }} extension={{ gcube_oauth_extension | default('war') }} repository_url={{ gcube_oauth_repository_url }} dest={{ smartgears_user_home }}/{{ gcube_oauth_file }} + + - name: Create the data trasfer working directory + file: path={{ smartgears_instance_path }}/webapps/gcube-{{ gcube_oauth_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} + + - name: Unarchive the gcube_oauth war + unarchive: copy=no src={{ smartgears_user_home }}/{{ gcube_oauth_file }} dest={{ smartgears_instance_path }}/webapps/gcube-{{ gcube_oauth_name }} creates={{ smartgears_instance_path }}/webapps/{{ gcube_oauth_name }}/WEB-INF/lib + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + when: gcube_oauth_install + tags: [ 'smartgears', 'gcube_oauth', 'tomcat' ]