forked from ISTI-ansible-roles/ansible-roles
This role installs a tool that adds/changes IS information from a resources file.
This commit is contained in:
parent
f43c3a638c
commit
16ad0de228
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
# <dependency>
|
||||
# <groupId>org.gcube.resources</groupId>
|
||||
# <artifactId>resource-updater-cli</artifactId>
|
||||
# <version>0.0.1-SNAPSHOT</version>
|
||||
# </dependency>
|
||||
|
||||
# per prod dovrebbe essere questo:
|
||||
# java -cp ".:./resource-updater-cli-0.0.1-SNAPSHOT-jar-with-dependencies.jar" org.gcube.resourcemanagement.updater.AccessPointUpdater /d4science.research-infrastructures.eu DataAnalysis DataMiner dataminer.garr.d4science.org environment.properties
|
||||
|
||||
# per il cluster di proto:
|
||||
# java -cp ".:./resource-updater-cli-0.0.1-SNAPSHOT-jar-with-dependencies.jar" org.gcube.resourcemanagement.updater.AccessPointUpdater /d4science.research-infrastructures.eu DataAnalysis DataMiner dataminer-prototypes.d4science.org environment.properties
|
||||
|
||||
# per i gw di proto:
|
||||
# java -cp ".:./resource-updater-cli-0.0.1-SNAPSHOT-jar-with-dependencies.jar" org.gcube.resourcemanagement.updater.AccessPointUpdater /d4science.research-infrastructures.eu DataAnalysis DataMinerWorkers dataminer-genericworkers-proto.d4science.org environment.properties
|
||||
|
||||
# per i gw di produzione:
|
||||
# java -cp ".:./resource-updater-cli-0.0.1-SNAPSHOT-jar-with-dependencies.jar" org.gcube.resourcemanagement.updater.AccessPointUpdater /d4science.research-infrastructures.eu DataAnalysis DataMinerWorkers dataminer-genericworkers.d4science.org environment.properties
|
||||
|
||||
# per dataminer preprod:
|
||||
# java -cp ".:./resource-updater-cli-0.0.1-SNAPSHOT-jar-with-dependencies.jar" org.gcube.resourcemanagement.updater.AccessPointUpdater /gcube/preprod DataAnalysis DataMiner dataminer1-pre.d4science.org environment.properties
|
||||
|
||||
# per gw di preprod:
|
||||
# java -cp ".:./resource-updater-cli-0.0.1-SNAPSHOT-jar-with-dependencies.jar" org.gcube.resourcemanagement.updater.AccessPointUpdater /gcube/preprod DataAnalysis DataMinerWorkers dataminer1-pre.d4science.org environment.properties
|
||||
|
||||
resource_updater_install: False
|
||||
resource_updater_master: False
|
||||
resource_updater_name: resource-updater-cli
|
||||
resource_updater_group_id: org.gcube.resources
|
||||
resource_updater_extension: jar
|
||||
resource_updater_version: latest
|
||||
resource_updater_classifier: jar-with-dependencies
|
||||
resource_updater_deps_file: '{{ resource_updater_name }}-{{ resource_updater_version }}-{{ resource_updater_classifier }}.{{ resource_updater_extension }}'
|
||||
resource_updater_file: '{{ resource_updater_name }}.{{ resource_updater_extension }}'
|
||||
smartgears_resource_updater_base_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/gcube-snapshots'
|
||||
resource_updater_dest_dir: '{{ smartgears_user_home }}/resource_updater'
|
||||
|
||||
# resource_updater_properties:
|
||||
# - { key: 'python2', value: '2.7.6' }
|
||||
# - { key: 'python3', value: '3.4.3' }
|
||||
# - { key: 'R', value: '3.4.4' }
|
||||
# - { key: 'Java', value: '8' }
|
||||
# - { key: 'KNIME', value: '3.6.1' }
|
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
- block:
|
||||
- name: Remove the resources updater
|
||||
file: path={{ resource_updater_dest_dir }} state=absent
|
||||
|
||||
- name: Remove the cron job that runs the resources updater script where is not needed
|
||||
cron: name="Resources Updater" special_time=daily job="/usr/local/bin/resources_updater > {{ resource_updater_dest_dir }}/resources_updater.log 2>&1" state=absent
|
||||
|
||||
- name: Remove the resources updater script
|
||||
become_user: root
|
||||
file: dest=/usr/local/bin/resources_updater state=absent
|
||||
|
||||
become: True
|
||||
become_user: '{{ d4science_user }}'
|
||||
when: not resource_updater_install
|
||||
tags: [ 'smartgears', 'resource_updater' ]
|
||||
|
||||
- block:
|
||||
- name: Get the resource updater jar file
|
||||
maven_artifact: artifact_id={{ resource_updater_name }} version={{ resource_updater_version }} group_id={{ resource_updater_group_id }} classifier={{ resource_updater_classifier }} extension={{ resource_updater_extension }} repository_url={{ smartgears_resource_updater_base_url }} dest={{ smartgears_downloads_dir }}/{{ resource_updater_deps_file }} verify_checksum=always
|
||||
register: resource_updater_download
|
||||
|
||||
- name: Remove the old resources updater files
|
||||
file: path={{ resource_updater_dest_dir }} state=absent
|
||||
when: resource_updater_download is changed
|
||||
|
||||
- name: Create the resources updater destination directory
|
||||
file: dest={{ resource_updater_dest_dir }} state=directory
|
||||
when: resource_updater_download is changed
|
||||
|
||||
- name: Copy the resources updater jar file
|
||||
copy: src={{ smartgears_downloads_dir }}/{{ resource_updater_deps_file }} dest={{ resource_updater_dest_dir }}/{{ resource_updater_file }} remote_src=yes force=yes
|
||||
|
||||
- name: Install the resources updater properties
|
||||
template: src=resources_updater.properties dest={{ resource_updater_dest_dir }}/resources_updater.properties
|
||||
register: resource_data_changes
|
||||
|
||||
- name: Install the resources updater script
|
||||
become_user: root
|
||||
template: src=resources_updater.sh dest=/usr/local/bin/resources_updater owner=root group=root mode=0755
|
||||
register: resource_data_changes
|
||||
|
||||
- name: Install a cron job that runs the resources updater script
|
||||
cron: name="Resources Updater" special_time=daily job="/usr/local/bin/resources_updater > {{ resource_updater_dest_dir }}/resources_updater.log 2>&1" state=present
|
||||
when: resource_updater_master
|
||||
|
||||
- name: Remove the cron job that runs the resources updater script where is not needed
|
||||
cron: name="Resources Updater" special_time=daily job="/usr/local/bin/resources_updater > {{ resource_updater_dest_dir }}/resources_updater.log 2>&1" state=absent
|
||||
when: not resource_updater_master
|
||||
|
||||
- name: Run the resources_updater script if the properties file changed
|
||||
shell: /usr/local/bin/resources_updater > {{ resource_updater_dest_dir }}/resources_updater.log 2>&1
|
||||
when:
|
||||
- resource_updater_master
|
||||
- resource_data_changes is changed
|
||||
|
||||
become: True
|
||||
become_user: '{{ d4science_user }}'
|
||||
when: resource_updater_install
|
||||
tags: [ 'smartgears', 'resource_updater', 'tomcat' ]
|
|
@ -0,0 +1,3 @@
|
|||
{% for property in resource_updater_properties %}
|
||||
{{ property.key }}={{ property.value }}
|
||||
{% endfor %}
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
RES_UPDATER_DIR="{{ resource_updater_dest_dir }}"
|
||||
#RES_UPDATER_PROPERTIES_FILE="{{ resource_updater_dest_dir }}/resources_updater.properties"
|
||||
RES_UPDATER_PROPERTIES_FILE="resources_updater.properties"
|
||||
SM_INFRA_NAME="/{{ smartgears_infrastructure_name }}"
|
||||
SM_SERVICE_ENDPOINT_GROUP="{{ smartgears_service_endpoint_group }}"
|
||||
SM_SERVICE_ENDPOINT_NAME="{{ smartgears_service_endpoint_name }}"
|
||||
SM_SERVICE_ENDPOINT_HOST="{{ smartgears_service_endpoint_host }}"
|
||||
|
||||
cd "$RES_UPDATER_DIR"
|
||||
java -cp ".:./resource-updater-cli.jar" org.gcube.resourcemanagement.updater.AccessPointUpdater "$SM_INFRA_NAME" "$SM_SERVICE_ENDPOINT_GROUP" "$SM_SERVICE_ENDPOINT_NAME" "$SM_SERVICE_ENDPOINT_HOST" "$RES_UPDATER_PROPERTIES_FILE"
|
||||
|
Loading…
Reference in New Issue