Move interface management into delegate_to test.

pull/54060/head
Matt Clay 5 years ago
parent 7ad003bf68
commit 07e9438848

@ -1,2 +1,3 @@
shippable/posix/group3
needs/ssh
needs/root # only on macOS and FreeBSD to configure network interfaces

@ -2,6 +2,46 @@
set -eux
platform="$(uname)"
function setup() {
if [[ "${platform}" == "FreeBSD" ]] || [[ "${platform}" == "Darwin" ]]; then
ifconfig lo0
existing=$(ifconfig lo0 | grep '^[[:blank:]]inet 127\.0\.0\. ' || true)
echo "${existing}"
for i in 3 4 254; do
ip="127.0.0.${i}"
if [[ "${existing}" != *"${ip}"* ]]; then
ifconfig lo0 alias "${ip}" up
fi
done
ifconfig lo0
fi
}
function teardown() {
if [[ "${platform}" == "FreeBSD" ]] || [[ "${platform}" == "Darwin" ]]; then
for i in 3 4 254; do
ip="127.0.0.${i}"
if [[ "${existing}" != *"${ip}"* ]]; then
ifconfig lo0 -alias "${ip}"
fi
done
ifconfig lo0
fi
}
setup
trap teardown EXIT
ANSIBLE_SSH_ARGS='-C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null' \
ANSIBLE_HOST_KEY_CHECKING=false ansible-playbook test_delegate_to.yml -i inventory -v "$@"

@ -75,15 +75,6 @@ fi
if [ "${platform}" = "freebsd" ] || [ "${platform}" = "osx" ]; then
pip install virtualenv
# Tests assume loopback addresses other than 127.0.0.1 will work.
# Add aliases for loopback addresses used by tests.
for i in 3 4 254; do
ifconfig lo0 alias "127.0.0.${i}" up
done
ifconfig lo0
fi
# Since tests run as root, we also need to be able to ssh to localhost as root.

Loading…
Cancel
Save