summaryrefslogtreecommitdiffstats
path: root/ansible/run_playbook.sh
diff options
context:
space:
mode:
authorPetr Ospalý <p.ospaly@partner.samsung.com>2019-01-15 10:49:30 +0100
committerPetr Ospalý <p.ospaly@partner.samsung.com>2019-01-17 14:07:43 +0100
commit5b197fbca6b960060c1b3ade5560b4cfbc1c4848 (patch)
treec808095637e7fe1152d737631bcb1f86e500f49b /ansible/run_playbook.sh
parentcde2f33dfcd9728240d37c80383534a5b6af5caf (diff)
Fix logging problem for ansible-playbook
Ansible could not write to the log because the ansible is run inside a chroot env. and on read-only fs - this is solved by adding new rw mount. Change-Id: I874063ad99948a55f9227d5e7eae05d3eaabe535 Issue-ID: OOM-1575 Signed-off-by: Petr Ospalý <p.ospaly@partner.samsung.com>
Diffstat (limited to 'ansible/run_playbook.sh')
-rwxr-xr-xansible/run_playbook.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/ansible/run_playbook.sh b/ansible/run_playbook.sh
index 9a2ca56f..2edbe358 100755
--- a/ansible/run_playbook.sh
+++ b/ansible/run_playbook.sh
@@ -25,6 +25,7 @@ script_path=$(readlink -f "$0")
script_name=$(basename "$script_path")
ANSIBLE_DIR=$(dirname "$script_path")
ANSIBLE_CHROOT="${ANSIBLE_DIR}/ansible_chroot"
+ANSIBLE_LOG_PATH="/ansible/log/ansible-$(date +%Y.%m.%d-%H%M%S).log"
#
@@ -82,6 +83,8 @@ REQUIREMENTS:
# run playbook
#
+export ANSIBLE_LOG_PATH
+
# if no arg then print help and exit
if [ -z "$1" ] ; then
help
@@ -101,6 +104,8 @@ if [ -n "$ANSIBLE_DOCKER_IMAGE" ] ; then
-v "$ANSIBLE_DIR:/ansible:ro" \
-v "$ANSIBLE_DIR/application:/ansible/application:rw" \
-v "$ANSIBLE_DIR/certs/:/certs:rw" \
+ -v "$ANSIBLE_DIR/log/:/ansible/log:rw" \
+ -e ANSIBLE_LOG_PATH \
-it "${ANSIBLE_DOCKER_IMAGE}" "$@"
fi
@@ -123,6 +128,7 @@ fi
--mount rw:"${HOME}/.ssh":/root/.ssh \
--mount ro:"$ANSIBLE_DIR":/ansible \
--mount rw:"$ANSIBLE_DIR"/application:/ansible/application \
+ --mount rw:"$ANSIBLE_DIR"/log:/ansible/log \
--mount rw:"$ANSIBLE_DIR"/certs:/certs \
--mount ro:/etc/resolv.conf:/etc/resolv.conf \
--mount ro:/etc/hosts:/etc/hosts \