library/roles/smartgears/smartgears: Put the list of scopes into a separate file.

This commit is contained in:
Andrea Dell'Amico 2016-11-04 19:42:36 +01:00
parent f8d43ccf4b
commit 55cdf9feb1
3 changed files with 15 additions and 2 deletions

View File

@ -58,6 +58,10 @@
with_items: '{{ tomcat_m_instances }}'
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
- name: Install the file containing the scopes list
template: src=scopes.list.j2 dest=/usr/local/etc/scopes.list owner=root group={{ smartgears_user }} mode=0444
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
- name: Get the scope tokens from the authorization service
become: True
become_user: '{{ smartgears_user }}'

View File

@ -1,6 +1,14 @@
#!/bin/bash
DESTFILE={{ smartgears_user_home }}/.containerxml/2-container.xml
LOCAL_LIB=/usr/local/lib
LOCAL_ETC=/usr/local/etc
SCOPES_LIST=""
if [ -f $LOCAL_ETC/scopes.list ] ; then
. $LOCAL_ETC/scopes.list
fi
if [ $# -ne 1 ] ; then
echo "The token must be passed as the sole argument"
@ -28,8 +36,8 @@ for jar in $( ls -1 /home/gcube/tomcat/lib/ ) ; do
export CLASSPATH="/home/gcube/SmartGears/lib/${jar}:$CLASSPATH"
done
cd /usr/local/lib
cd $LOCAL_LIB
java TokenGenerator {{ smartgears_hostname }} $TOKEN $HTTP_PORT $DESTFILE {% for scope in smartgears_scopes %}{{ scope }} {% endfor %}
java TokenGenerator {{ smartgears_hostname }} $TOKEN $HTTP_PORT $DESTFILE $SCOPES_LIST
exit 0

View File

@ -0,0 +1 @@
SCOPES_LIST="{% for scope in smartgears_scopes %}{{ scope }} {% endfor %}"