library/roles/smartgears/dataminer_app/tasks/install-gcube-key.yml: Remove the old keys when switching environment.

library/roles/smartgears/smartgears/templates/get-scopes.j2: Fix the creation of the container.xml file. Updates were failing because the file was not writeable.
This commit is contained in:
Andrea Dell'Amico 2017-02-09 16:34:42 +01:00
parent 73f08306ea
commit 2a16a82fd0
3 changed files with 64 additions and 29 deletions

View File

@ -1,6 +1,7 @@
---
- name: Install the production gcube keys
get_url: url={{ item.url }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/ecocfg/PARALLEL_PROCESSING owner={{ smartgears_user }} group={{ smartgears_user }} mode=0400
- block:
- name: Install the production gcube keys
get_url: url={{ item.url }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/ecocfg/PARALLEL_PROCESSING/{{ item.name }} owner={{ smartgears_user }} group={{ smartgears_user }} mode=0600
with_items:
- '{{ gcube_prod_key_1 }}'
- '{{ gcube_prod_key_2 }}'
@ -8,22 +9,49 @@
- '{{ gcube_prod_key_4 }}'
notify: Restart smartgears
when: install_gcube_prod_key
tags: [ 'dataminer', 'gcube_key', 'wps' ]
- name: Install the devel gcube keys
get_url: url={{ item.url }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/ecocfg/PARALLEL_PROCESSING owner={{ smartgears_user }} group={{ smartgears_user }} mode=0400
- name: Remove the production gcube keys
file: dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/ecocfg/PARALLEL_PROCESSIN/{{ item.name }} state=absent
with_items:
- '{{ gcube_prod_key_1 }}'
- '{{ gcube_prod_key_2 }}'
- '{{ gcube_prod_key_3 }}'
- '{{ gcube_prod_key_4 }}'
notify: Restart smartgears
when: not install_gcube_prod_key
- name: Install the devel gcube keys
get_url: url={{ item.url }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/ecocfg/PARALLEL_PROCESSING/{{ item.name }} owner={{ smartgears_user }} group={{ smartgears_user }} mode=0600
with_items:
- '{{ gcube_dev_key_1 }}'
- '{{ gcube_dev_key_2 }}'
- '{{ gcube_dev_key_3 }}'
notify: Restart smartgears
when: install_gcube_dev_key
tags: [ 'dataminer', 'gcube_key', 'wps' ]
- name: Install the preprod gcube keys
get_url: url={{ item.url }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/ecocfg/PARALLEL_PROCESSING owner={{ smartgears_user }} group={{ smartgears_user }} mode=0400
- name: Remove the devel gcube keys
file: dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/ecocfg/PARALLEL_PROCESSING/{{ item.name }} state=absent
with_items:
- '{{ gcube_dev_key_1 }}'
- '{{ gcube_dev_key_2 }}'
- '{{ gcube_dev_key_3 }}'
notify: Restart smartgears
when: not install_gcube_dev_key
- name: Install the preprod gcube keys
get_url: url={{ item.url }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/ecocfg/PARALLEL_PROCESSING/{{ item.name }} owner={{ smartgears_user }} group={{ smartgears_user }} mode=0600
with_items:
- '{{ gcube_pre_key_1 }}'
notify: Restart smartgears
when: install_gcube_preprod_key
- name: Remove the preprod gcube keys
file: dest={{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/ecocfg/PARALLEL_PROCESSING/{{ item.name }} state=absent
with_items:
- '{{ gcube_pre_key_1 }}'
notify: Restart smartgears
when: not install_gcube_preprod_key
become: True
become_user: '{{ smartgears_user }}'
tags: [ 'dataminer', 'gcube_key', 'wps' ]

View File

@ -1,7 +1,7 @@
---
- block:
- name: Install the production gcube keys
get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ smartgears_user }} group={{ d4science_user }} mode=0400
get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ smartgears_user }} group={{ d4science_user }} mode=0600
with_items:
- '{{ gcube_prod_key_1 }}'
- '{{ gcube_prod_key_2 }}'
@ -21,7 +21,7 @@
when: not install_gcube_prod_key
- name: Install the devel gcube keys
get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ smartgears_user }} group={{ d4science_user }} mode=0400
get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ smartgears_user }} group={{ d4science_user }} mode=0600
with_items:
- '{{ gcube_dev_key_1 }}'
- '{{ gcube_dev_key_2 }}'
@ -39,7 +39,7 @@
when: not install_gcube_dev_key
- name: Install the preprod gcube keys
get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ smartgears_user }} group={{ smartgears_user }} mode=0400
get_url: url={{ item.url }} dest=/{{ gcube_tomcat_lib_dir }}/{{ item.name }} owner={{ smartgears_user }} group={{ smartgears_user }} mode=0600
with_items:
- '{{ gcube_pre_key_1 }}'
notify: Restart smartgears

View File

@ -59,7 +59,14 @@ else
fi
# Now that we have the tokens, we can assemble the container.xml file
cat $CONTAINER_XML_HEAD $SCOPES_FILE $CONTAINER_XML_TAIL > $CONTAINER_XML_FILE
chmod 640 $CONTAINER_XML_FILE
CREATE_CONTAINER_XML_RES=0
CREATE_CONTAINER_XML=$( cat $CONTAINER_XML_HEAD $SCOPES_FILE $CONTAINER_XML_TAIL > $CONTAINER_XML_FILE )
CREATE_CONTAINER_XML_RES=$?
if [ $CREATE_CONTAINER_XML_RES -ne 0 ] ; then
logger "$LOG_PREFIX $CONTAINER_XML_FILE cannot be updated. Error is $CREATE_CONTAINER_XML"
exit $CREATE_CONTAINER_XML_RES
fi
chmod 440 $CONTAINER_XML_FILE
logger "$LOG_PREFIX $CONTAINER_XML_FILE updated"