From 4a3019e7751bd31445048c1d15358a9166a05d43 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 9 Mar 2018 13:01:52 -0500 Subject: [PATCH] fixup! tests: Dip our toes into using Ansible --- tests/common/libvm.sh | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/tests/common/libvm.sh b/tests/common/libvm.sh index d0ba83301c..aed3c808cd 100644 --- a/tests/common/libvm.sh +++ b/tests/common/libvm.sh @@ -21,29 +21,19 @@ vm_setup() { export VM=${VM:-vmcheck} - local sshopts="-o User=root \ - -o ControlMaster=auto \ - -o ControlPath=/var/tmp/ssh-$VM-$(date +%s%N).sock \ - -o ControlPersist=yes" + SSHOPTS="-o User=root -o ControlMaster=auto \ + -o ControlPath=/var/tmp/ssh-$VM-$(date +%s%N).sock \ + -o ControlPersist=yes" # If we're provided with an ssh-config, make sure we tell # ssh to pick it up. if [ -f "${topsrcdir}/ssh-config" ]; then - sshopts="$sshopts -F ${topsrcdir}/ssh-config" + SSHOPTS="${SSHOPTS} -F ${topsrcdir}/ssh-config" fi + export SSHOPTS - export SSH="ssh $sshopts $VM" - export SCP="scp $sshopts" - - local HOSTS="${HOSTS:-${VM}}" - inventory=${topsrcdir}/ansible-inventory.ini - (echo '[vmcheck]' && - for host in "${HOSTS}"; do - echo "${host}" - done && - echo '[vmcheck:vars]' && - echo 'ansible_ssh_common_args: "'${sshopts}'"' - ) > ${inventory}.new && mv ${inventory}{.new,} + export SSH="ssh ${SSHOPTS} $VM" + export SCP="scp ${SSHOPTS}" } vm_ansible_inline() { @@ -54,7 +44,7 @@ vm_ansible_inline() { tasks: EOF sed -e 's,^, ,' >> ${playbook} - ansible-playbook -i ${topsrcdir}/ansible-inventory.yml ${playbook} + ansible-playbook -i ${VM}, --ssh-common-args "${SSHOPTS}" ${playbook} rm -f ${playbook} }