forked from ISTI-ansible-roles/ansible-roles
84 lines
3.8 KiB
YAML
84 lines
3.8 KiB
YAML
---
|
|
- name: Remove the smartgears distribution archive to force un upgrade
|
|
file: dest={{ item }} state=absent
|
|
with_items:
|
|
- '{{ smartgears_user_home }}/{{ smartgears_file }}'
|
|
- '{{ smartgears_user_home }}/smartgears-distribution-{{ smartgears_distribution_version }}'
|
|
when: smartgears_force_install
|
|
tags: [ 'smartgears', 'tomcat' ]
|
|
|
|
- name: Get the smartgears distribution
|
|
get_url: url={{ smartgears_url }} dest={{ smartgears_user_home }}/{{ smartgears_file }}
|
|
register: new_smartgears_distribution
|
|
tags: [ 'smartgears', 'tomcat' ]
|
|
|
|
- name: Unarchive the smartgears distribution
|
|
become: True
|
|
become_user: '{{ d4science_user }}'
|
|
unarchive: copy=no src={{ smartgears_user_home }}/{{ smartgears_file }} dest={{ smartgears_user_home }} creates={{ smartgears_user_home }}/smartgears-distribution-{{ smartgears_distribution_version }}
|
|
when: ( new_smartgears_distribution | changed )
|
|
tags: [ 'smartgears', 'tomcat' ]
|
|
|
|
- name: Stop the smartgears container before launching the upgrade script
|
|
become: True
|
|
become_user: '{{ d4science_user }}'
|
|
shell: /home/{{ d4science_user }}/stopContainer.sh
|
|
when: smartgears_upgrade
|
|
tags: [ 'smartgears', 'tomcat', 'stop_smartgears_service' ]
|
|
|
|
- name: Install the additional tomcat default file
|
|
template: src=tomcat-instance-default.j2 dest=/etc/default/tomcat-instance-{{ item.http_port }}.local
|
|
with_items: '{{ tomcat_m_instances }}'
|
|
notify: Restart smartgears
|
|
tags: [ 'smartgears', 'tomcat', 'smartgears_env' ]
|
|
|
|
- name: Set the additional tomcat default file as the smartgears user .bashrc
|
|
become: True
|
|
become_user: '{{ d4science_user }}'
|
|
template: src=tomcat-instance-default.j2 dest={{ item.user_home }}/.bashrc mode=0444
|
|
with_items: '{{ tomcat_m_instances }}'
|
|
tags: [ 'smartgears', 'tomcat', 'smartgears_env' ]
|
|
|
|
- name: Install the smartgears app
|
|
shell: cd {{ item.user_home }}/smartgears-distribution-{{ smartgears_distribution_version }} ; . /{{ item.user_home }}/.bashrc ; ./install -s tomcat ; chown -R gcube:gcube '{{ item.user_home }}/smartgears-distribution-{{ smartgears_distribution_version }}' '{{ item.user_home }}/SmartGears/' '{{ item.user_home }}/tomcat/lib/' '{{ item.user_home }}/tomcat/webapps/'
|
|
with_items: '{{ tomcat_m_instances }}'
|
|
when: ( new_smartgears_distribution | changed )
|
|
register: install_smartgears_app
|
|
notify: Restart smartgears
|
|
tags: [ 'smartgears', 'tomcat' ]
|
|
|
|
- name: Install the smartgears configuration file
|
|
template: src=container.xml.j2 dest={{ smartgears_install_path }}/container.xml owner={{ item.user }} group={{ item.user }}
|
|
with_items: '{{ tomcat_m_instances }}'
|
|
when: ( generic_worker_install is not defined ) or ( not generic_worker_install )
|
|
register: containerxml_state
|
|
notify: Restart smartgears
|
|
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
|
|
|
- name: Remove the smartgears application state if the configuration changed
|
|
file: dest={{ smartgears_install_path }}/state state=absent
|
|
when: ( containerxml_state | changed )
|
|
notify: Restart smartgears
|
|
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
|
|
|
- name: Install the script that manages the smartgears loglevel
|
|
template: src=change-logback-loglevel.sh.j2 dest=/usr/local/bin/change-logback-loglevel owner=root group=root mode=0755
|
|
with_items: '{{ tomcat_m_instances }}'
|
|
tags: [ 'smartgears', 'smartgears_loglevel', 'tomcat' ]
|
|
|
|
- name: Change the smartgears log level
|
|
become: True
|
|
become_user: '{{ d4science_user }}'
|
|
shell: /usr/local/bin/change-logback-loglevel
|
|
notify: Restart smartgears
|
|
tags: [ 'smartgears', 'tomcat', 'smartgears_loglevel' ]
|
|
|
|
- name: Remove some wrong symbolic links created by the install/upgrade script
|
|
file: dest={{ smartgears_install_path }}/state state=absent
|
|
with_items:
|
|
- '{{ smartgears_install_path }}/lib/lib'
|
|
- '{{ smartgears_install_path }}/apps/webapps'
|
|
when: smartgears_upgrade
|
|
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
|
|