|
@@ -4,6 +4,10 @@ ANSIBLE_USER="{{node.user}}" |
|
|
ANSIBLE_HOME="$(cd ~{{node.user}} && pwd)" |
|
|
ANSIBLE_HOME="$(cd ~{{node.user}} && pwd)" |
|
|
LOG="${ANSIBLE_HOME}/.ansible.log" |
|
|
LOG="${ANSIBLE_HOME}/.ansible.log" |
|
|
|
|
|
|
|
|
|
|
|
# Stop unattended upgrades so that apt installs will work |
|
|
|
|
|
# unattended upgrades are re-enabled at the end of the ansible run |
|
|
|
|
|
systemctl stop unattended-upgrades |
|
|
|
|
|
|
|
|
{{#if isNode}} |
|
|
{{#if isNode}} |
|
|
# touch algo log and start tailing it |
|
|
# touch algo log and start tailing it |
|
|
set -m |
|
|
set -m |
|
@@ -11,6 +15,15 @@ ALGO_LOG=/tmp/install_algo.log |
|
|
touch ${ALGO_LOG} && tail -f ${ALGO_LOG} & |
|
|
touch ${ALGO_LOG} && tail -f ${ALGO_LOG} & |
|
|
{{/if}} |
|
|
{{/if}} |
|
|
|
|
|
|
|
|
|
|
|
function kill_bg_jobs { |
|
|
|
|
|
for j in $(jobs -lr | tr '[]' ' ' | awk '{print $1}') ; do |
|
|
|
|
|
kill %${j} |
|
|
|
|
|
done |
|
|
|
|
|
if [[ ! -z "${ALGO_LOG}" && -f "${ALGO_LOG}" ]] ; then |
|
|
|
|
|
rm -f ${ALGO_LOG} |
|
|
|
|
|
fi |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function log { |
|
|
function log { |
|
|
echo "${1}" >> ${LOG} |
|
|
echo "${1}" >> ${LOG} |
|
|
} |
|
|
} |
|
@@ -20,8 +33,7 @@ function die { |
|
|
log "install_local: fatal error: ${1}" |
|
|
log "install_local: fatal error: ${1}" |
|
|
{{#if isNode}} |
|
|
{{#if isNode}} |
|
|
# stop ALGO_LOG tail job and remove log |
|
|
# stop ALGO_LOG tail job and remove log |
|
|
kill %1 |
|
|
|
|
|
rm -f ${ALGO_LOG} |
|
|
|
|
|
|
|
|
kill_bg_jobs |
|
|
{{/if}} |
|
|
{{/if}} |
|
|
exit 1 |
|
|
exit 1 |
|
|
} |
|
|
} |
|
@@ -82,10 +94,10 @@ fi |
|
|
|
|
|
|
|
|
{{#if isNode}} |
|
|
{{#if isNode}} |
|
|
# stop ALGO_LOG tail job and remove log |
|
|
# stop ALGO_LOG tail job and remove log |
|
|
for j in $(jobs -lr | tr '[]' ' ' | awk '{print $1}') ; do |
|
|
|
|
|
kill %${j} |
|
|
|
|
|
done |
|
|
|
|
|
rm -f ${ALGO_LOG} |
|
|
|
|
|
|
|
|
kill_bg_jobs |
|
|
{{/if}} |
|
|
{{/if}} |
|
|
|
|
|
|
|
|
|
|
|
# ansible should have already restarted unattended-upgrades, but just in case |
|
|
|
|
|
systemctl start unattended-upgrades |
|
|
|
|
|
|
|
|
exit 0 |
|
|
exit 0 |