library/roles/smartgears/smart_executor: Fix the upgrade scenario.

library/roles/smartgears/smartgears: Fix the new token management.
d4science-ghn-cluster/group_vars/smart_genericworker_dev_devnext: The new token management needs a different scopes handling. And a new variable: smartgears_scopes.
This commit is contained in:
Andrea Dell'Amico 2016-09-27 18:06:31 +02:00
parent 3a97aa667a
commit b5e2f43bd7
5 changed files with 22 additions and 11 deletions

View File

@ -1,5 +1,6 @@
--- ---
smart_executor_install: False smart_executor_install: False
remove_smart_executor_install: False
smart_executor_version: 1.3.0-4.0.0-128844 smart_executor_version: 1.3.0-4.0.0-128844
smart_executor_name: smart-executor smart_executor_name: smart-executor

View File

@ -1,24 +1,25 @@
--- ---
- block: - block:
- name: Remove the old smart executor files if an upgrade is planned
- name: Remove the old smart executor files
file: path={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }} state=absent file: path={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }} state=absent
when: ( not smart_executor_install ) or ( smartgears_upgrade ) when: smartgears_upgrade
- name: Remove the smart executor files if we want to remove it
file: path={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }} state=absent
when: not smart_executor_install
# NOTE: Install as the smartgears user so we do not mess with the permissions # NOTE: Install as the smartgears user so we do not mess with the permissions
- name: Get the smart executor plugin - name: Get the smart executor plugin
get_url: url={{ smart_executor_url }} dest={{ smartgears_user_home }}/{{ smart_executor_file }} get_url: url={{ smart_executor_url }} dest={{ smartgears_user_home }}/{{ smart_executor_file }}
when: smart_executor_install
- name: Create the smart executor working directory - name: Create the smart executor working directory
file: path={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }} file: path={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }}
when: smart_executor_install
- name: Unarchive the smartexecutor distribution - name: Unarchive the smartexecutor distribution
unarchive: copy=no src={{ smartgears_user_home }}/{{ smart_executor_file }} dest={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }} creates={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib unarchive: copy=no src={{ smartgears_user_home }}/{{ smart_executor_file }} dest={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }} creates={{ smartgears_instance_path }}/webapps/{{ smart_executor_name }}/WEB-INF/lib
when: smart_executor_install
notify: Restart smartgears notify: Restart smartgears
become: True become: True
become_user: '{{ d4science_user }}' become_user: '{{ smartgears_user }}'
when: smart_executor_install
tags: [ 'smartgears', 'smart_executor', 'tomcat' ] tags: [ 'smartgears', 'smart_executor', 'tomcat' ]

View File

@ -47,6 +47,9 @@ smartgears_context:
- '/BiOnym' - '/BiOnym'
- '/ScalableDataMining' - '/ScalableDataMining'
smartgears_scopes:
- '{{ smartgears_infrastructure_name }}'
# The iptables rules use this # The iptables rules use this
http_port: '{{ smartgears_http_port }}' http_port: '{{ smartgears_http_port }}'

View File

@ -50,11 +50,13 @@
- name: Create the directory where we put the smartgears configuration snippets - name: Create the directory where we put the smartgears configuration snippets
become: True become: True
become_user: '{{ smartgears_user }}' become_user: '{{ smartgears_user }}'
file: dest={{ smartgears_user_home }}/.containerxml file: dest={{ smartgears_user_home }}/.containerxml state=directory
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ] tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
- name: Install the token generator class - name: Install the token generator class
file: src=TokenGeneartor.class dest=/usr/local/lib/TokenGenerator.class owner=root group=root mode=0644 copy: src=TokenGenerator.class dest=/usr/local/lib/TokenGenerator.class owner=root group=root mode=0644
when: gcube_admin_token is defined
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
- name: Install the script that fetches the scope tokens - name: Install the script that fetches the scope tokens
template: src=get-scopes.j2 dest=/usr/local/bin/get-scopes owner=root group={{ smartgears_user }} mode=0750 template: src=get-scopes.j2 dest=/usr/local/bin/get-scopes owner=root group={{ smartgears_user }} mode=0750
@ -64,7 +66,7 @@
- name: Get the scope tokens from the authorization service - name: Get the scope tokens from the authorization service
become: True become: True
become_user: '{{ smartgears_user }}' become_user: '{{ smartgears_user }}'
shell: shell: /usr/local/bin/get-scopes
when: gcube_admin_token is defined when: gcube_admin_token is defined
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ] tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]

View File

@ -13,7 +13,11 @@ HTTP_PORT={{ http_port }}
HTTP_PORT={{ item.http_port }} HTTP_PORT={{ item.http_port }}
{% endif %} {% endif %}
export CLASSPATH="/usr/local/lib:{{ smartgears_install_path }}/lib:$CLASSPATH" for jar in $( ls -1 /home/gcube/tomcat/lib/ ) ; do
export CLASSPATH="/home/gcube/SmartGears/lib/${jar}:$CLASSPATH"
done
cd /usr/local/lib
java TokenGenerator {{ gcube_admin_token }} {{ smartgears_hostname }} $HTTP_PORT $DESTFILE {% for scope in smartgears_scopes %}{{ scope }} {% endfor %} java TokenGenerator {{ gcube_admin_token }} {{ smartgears_hostname }} $HTTP_PORT $DESTFILE {% for scope in smartgears_scopes %}{{ scope }} {% endfor %}