diff --git a/roles/slurm-common/tasks/installNhc.yml b/roles/nhc/tasks/main.yml similarity index 91% rename from roles/slurm-common/tasks/installNhc.yml rename to roles/nhc/tasks/main.yml index 1b093c6d2964dc1b894e626c17715dd97ccdff81..e603ac97ed63bc549c4a7217edbadf9c2b9d37ee 100644 --- a/roles/slurm-common/tasks/installNhc.yml +++ b/roles/nhc/tasks/main.yml @@ -39,10 +39,6 @@ template: dest=/etc/sysconfig/nhc src=nhc.sysconfig.j2 mode=644 sudo: true -- name: copy cron script - template: dest={{ nhc_dir }}/sbin/nhc_cron src=nhc_cron.j2 mode=755 - sudo: true - - name: copy nhc log rotate script template: dest=/etc/logrotate.d/nhc src=nhclog.j2 mode=644 sudo: true @@ -51,3 +47,8 @@ copy: src=nhc.conf dest={{ nhc_dir }}/etc/nhc/{{ nhc_config_file }} become: true become_user: root + +- name: install nhc scripts + copy: src=scripts/ dest={{ nhc_dir }}/etc/nhc/ + become: true + become_user: root diff --git a/roles/slurm-common/templates/nhc.sysconfig.j2 b/roles/nhc/templates/nhc.sysconfig.j2 similarity index 100% rename from roles/slurm-common/templates/nhc.sysconfig.j2 rename to roles/nhc/templates/nhc.sysconfig.j2 diff --git a/roles/slurm-common/templates/nhclog.j2 b/roles/nhc/templates/nhclog.j2 similarity index 100% rename from roles/slurm-common/templates/nhclog.j2 rename to roles/nhc/templates/nhclog.j2 diff --git a/roles/slurm-common/tasks/main.yml b/roles/slurm-common/tasks/main.yml index 019c2ce554677a93430e723ed8d548d24496ac27..9fb727b7e227b607c59d8d9f677dbda3a87c18d0 100644 --- a/roles/slurm-common/tasks/main.yml +++ b/roles/slurm-common/tasks/main.yml @@ -170,5 +170,4 @@ when: slurm_lua is defined - include: installCgroup.yml -- include: installNhc.yml diff --git a/roles/slurm-common/templates/nhc_cron.j2 b/roles/slurm-common/templates/nhc_cron.j2 deleted file mode 100755 index 8ec9815762a26d83fa51324d5b8478c6f8d3a111..0000000000000000000000000000000000000000 --- a/roles/slurm-common/templates/nhc_cron.j2 +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -error="" -state_change="1" -current_state="0" -previous_state="0" - -[ -e /etc/sysconfig/nhc ] && . /etc/sysconfig/nhc -config_file=${CONFFILE-/etc/nhc/nhc.conf} -loop=${NHC_LOOP_TIME-300} -email_subject=${NHC_EMAIL_SUBJECT-notification} -logfile=${LOGFILE-/var/log/nhc.log} -loglevel=${LOG_LEVEL-0} -email_to=${NHC_EMAIL_TO-root} - -function log() { - message="$1" - echo "$(date): ${message}" >> ${logfile} -} - -function email() { - post=$(cat /root/nhc_cron_sendemail.txt) - if [ -z "${post}" ]; then - message=$(cat /root/nhc.log) - echo "${message}" | mail -s "${email_subject}" "${email_to}" - log "Node error, send email to ${email_to}" - echo "1" >| /root/nhc_cron_sendemail.txt - fi -} - -if [ ${loglevel} -gt "0" ]; then - log "Start health check ${config_file}" -fi - -nhc -c "${config_file}" > /root/nhc.log 2>&1 || { log "$(cat /root/nhc.log)" && email && exit 1; } - -echo -n "" >| /root/nhc_cron_sendemail.txt - -