library/roles/smartgears/smartgears: Come up with a reliable command that finds the correct smartgears version to put into container.xml. See https://support.d4science.org/issues/10670

This commit is contained in:
Andrea Dell'Amico 2018-01-25 20:06:03 +01:00
parent 24b25e0b06
commit c4e4e1a1c5
2 changed files with 17 additions and 15 deletions

View File

@ -16,13 +16,13 @@
with_items: '{{ tomcat_m_instances }}'
register: smartgears_download
when: not item.skip_smartgears
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'smartgears_conf' ]
- name: Remove the smartgears-distribution files
shell: find {{ smartgears_downloads_dir }} -type d -name smartgears-distribution-\* -exec rm -fr {} \;
ignore_errors: yes
when: ( smartgears_download | changed )
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'smartgears_conf' ]
- name: Unarchive the smartgears distribution
become: True
@ -78,15 +78,6 @@
notify: Restart smartgears
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
- name: Get the real smartgears version from the exploded distribution filename
shell: /bin/ls -1 {{ smartgears_downloads_dir }} | grep smartgears-distribution | grep -v tar.gz | sed -e 's/smartgears-distribution-//g'
register: smartgears_real_version
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'smartgears_conf' ]
- name: Set the real smartgears distribution version
set_fact: smartgears_real_distribution_version="{{ smartgears_real_version.stdout }}"
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'smartgears_conf' ]
- name: Create the directory where we put the smartgears configuration snippets
become: True
become_user: '{{ smartgears_user }}'
@ -133,6 +124,20 @@
template: src=scopes.list.j2 dest=/usr/local/etc/scopes.list owner=root group={{ smartgears_user }} mode=0444
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ]
- name: Get the real smartgears version from the container.xml file contained inside the distribution
shell: dest_dir=$( find {{ smartgears_downloads_dir }} -type d -name smartgears-distribution-\* | tail -1 ) ; cd $dest_dir ; grep "'SmartGearsDistribution' " container.xml | awk -F "'" '{print $4}'
register: smartgears_real_version
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'smartgears_conf' ]
- name: Print the smartgears version
debug:
msg: "The smartgears version is: {{ smartgears_real_version.stdout }}"
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'smartgears_conf' ]
- name: Set the real smartgears distribution version
set_fact: smartgears_real_distribution_version="{{ smartgears_real_version.stdout }}"
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'smartgears_conf' ]
- name: Install the smartgears template configuration. First part
become: True
become_user: '{{ smartgears_user }}'

View File

@ -26,11 +26,8 @@
<authorizeChildrenContext>{{ smartgears_authorized_on_all_scopes }}</authorizeChildrenContext>
<property name='SmartGearsDistributionBundle' value='UnBundled' />
{% if smartgears_distribution_version == 'latest' %}
<property name='SmartGearsDistribution' value='{{ smartgears_real_distribution_version }}' />
{% else %}
<property name='SmartGearsDistribution' value='{{ smartgears_distribution_version }}' />
{% endif %}
<publication-frequency>{{ smartgears_publication_frequency }}</publication-frequency>
<infrastructure>{{ smartgears_infrastructure_name }}</infrastructure>