../library/roles/smartgears/smartgears/tasks/smartgears-app.yml fix change loglevel
This commit is contained in:
parent
ac277cb6af
commit
c787b44fc4
|
@ -61,11 +61,15 @@
|
|||
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: LOGLEVEL=$( xmlstarlet sel -t -v "/configuration/logger/@level" {{ item.user_home }}/tomcat/lib/logback.xml | grep {{ smartgears_loglevel }} ) ; [ $? -ne 0 ] && xmlstarlet ed -u "/configuration/logger[@level]/@level" -v {{ smartgears_loglevel }} {{ item.user_home }}/tomcat/lib/logback.xml > {{ item.user_home }}/tomcat/lib/logback.xml.new ; [ -f {{ item.user_home }}/tomcat/lib/logback.xml.new ] && mv {{ item.user_home }}/tomcat/lib/logback.xml.new {{ item.user_home }}/tomcat/lib/logback.xml
|
||||
with_items: '{{ tomcat_m_instances }}'
|
||||
shell: /usr/local/bin/change-logback-loglevel
|
||||
notify: Restart smartgears
|
||||
tags: [ 'smartgears', 'tomcat', 'smartgears_loglevel' ]
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
RETVAL=
|
||||
LOGLEVEL=$( xmlstarlet sel -t -v "/configuration/logger/@level" {{ item.user_home }}/tomcat/lib/logback.xml | grep {{ smartgears_loglevel }} )
|
||||
RETVAL=$?
|
||||
|
||||
if [ $RETVAL -ne 0 ] ; then
|
||||
xmlstarlet ed -u "/configuration/logger[@level]/@level" -v {{ smartgears_loglevel }} {{ item.user_home }}/tomcat/lib/logback.xml > {{ item.user_home }}/tomcat/lib/logback.xml.new
|
||||
/bin/mv {{ item.user_home }}/tomcat/lib/logback.xml.new {{ item.user_home }}/tomcat/lib/logback.xml
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue