diff --git a/smartgears/resource_registry/defaults/main.yml b/smartgears/resource_registry/defaults/main.yml new file mode 100644 index 00000000..03088992 --- /dev/null +++ b/smartgears/resource_registry/defaults/main.yml @@ -0,0 +1,10 @@ +--- +resource_registry_install: False +resource_registry_gcube_repository: gcube-snapshots +resource_registry_snapshot_ver: 1.1.0-SNAPSHOT +resource_registry_version: 1.1.0-20160914.161216-6 +resource_registry_name: resource-registry +smart_executor_name: smart-executor +resource_registry_file: '{{ resource_registry_name }}-{{ resource_registry_version }}.war' +resource_registry_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ resource_registry_gcube_repository }}/org/gcube/resources/information-system/{{resource_registry_name}}/{{ resource_registry_snapshot_ver }}/{{ resource_registry_file }}' + diff --git a/smartgears/resource_registry/handlers/main.yml b/smartgears/resource_registry/handlers/main.yml new file mode 100644 index 00000000..a9b4ffdd --- /dev/null +++ b/smartgears/resource_registry/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: Restart smartgears + service: name='tomcat-instance-{{ smartgears_http_port }}' state=restarted diff --git a/smartgears/resource_registry/tasks/main.yml b/smartgears/resource_registry/tasks/main.yml new file mode 100644 index 00000000..5934782a --- /dev/null +++ b/smartgears/resource_registry/tasks/main.yml @@ -0,0 +1,29 @@ +--- +- block: + + - name: Remove the old smart executor files if present + file: path={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }} state=absent + when: ( not smart_executor_install ) or ( smartgears_upgrade ) + + - name: Remove the old resource-registry files + file: path={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }} state=absent + when: ( not resource_registry_install ) or ( smartgears_upgrade ) + + # NOTE: Install as the smartgears user so we do not mess with the permissions + - name: Get the resource-registry-service + get_url: url={{ resource_registry_url }} dest={{ smartgears_user_home }}/{{ resource_registry_file }} + + - name: Create the resource-registry working directory + file: path={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} + + - name: Unarchive the resource_registry war + unarchive: copy=no src={{ smartgears_user_home }}/{{ resource_registry_file }} dest={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }} creates={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}/WEB-INF/lib + notify: Restart smartgears + + - name: Install the resource registry configuration + template: src=config.properties.j2 dest={{ smartgears_instance_path }}/webapps/{{ resource_registry_name }}/WEB-INF/classes/config.properties mode=0440 + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'smartgears', 'resource_registry', 'tomcat' ] + when: resource_registry_install diff --git a/smartgears/resource_registry/templates/config.properties.j2 b/smartgears/resource_registry/templates/config.properties.j2 new file mode 100644 index 00000000..31f357d7 --- /dev/null +++ b/smartgears/resource_registry/templates/config.properties.j2 @@ -0,0 +1,12 @@ +HOST={{ orientdb_host }} +REMOTE_PROTOCOL={{ orientdb_remote_protocol }} +HTTP_PROTOCOL={{ orientdb_http_protocol }} +HTTP_PORT={{ orientdb_http_port }} +DB={{ orientdb_db_name }} +USERNAME={{ orientdb_username }} +PASSWORD={{ orientdb_password }} +DEFAULT_CREATED_WRITER_USER_PASSWORD={{ orientdb_writer_password }} +DEFAULT_CREATED_READER_USER_PASSWORD={{ orientdb_reader_password }} +DEFAULT_ADMIN_USERNAME={{ orientdb_default_admin_user }} +DEFAULT_ADMIN_PASSWORD={{ orientdb_default_admin_password }} +CHANGED_ADMIN_PASSWORD={{ orientdb_admin_password }}