ansible-test - Add support for remote Ubuntu VMs.

pull/77703/head
Matt Clay 2 years ago
parent dcda1e7239
commit 6513453310

@ -0,0 +1,2 @@
minor_changes:
- ansible-test - Add support for Ubuntu VMs using the ``--remote`` option.

@ -6,3 +6,5 @@ macos python_dir=/usr/local/bin provider=parallels
rhel/7.9 python=2.7 provider=aws
rhel/8.5 python=3.6,3.8,3.9 provider=aws
rhel provider=aws
ubuntu/22.04 python=3.10 provider=aws
ubuntu provider=aws

@ -571,6 +571,8 @@ class PosixRemoteProfile(ControllerHostProfile[PosixRemoteConfig], RemoteProfile
become = Sudo()
elif self.config.platform == 'rhel':
become = Sudo()
elif self.config.platform == 'ubuntu':
become = Sudo()
else:
raise NotImplementedError(f'Become support has not been implemented for platform "{self.config.platform}" and user "{settings.user}" is not root.')

@ -266,6 +266,39 @@ bootstrap_remote_rhel_pinned_pip_packages()
pip_install "${pip_packages}"
}
bootstrap_remote_ubuntu()
{
py_pkg_prefix="python3"
packages="
gcc
${py_pkg_prefix}-dev
${py_pkg_prefix}-pip
${py_pkg_prefix}-venv
"
if [ "${controller}" ]; then
# The resolvelib package is not listed here because the available version (0.8.1) is incompatible with ansible.
# Instead, ansible-test will install it using pip.
packages="
${packages}
${py_pkg_prefix}-cryptography
${py_pkg_prefix}-jinja2
${py_pkg_prefix}-packaging
${py_pkg_prefix}-yaml
"
fi
while true; do
# shellcheck disable=SC2086
apt-get update -qq -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends ${packages} \
&& break
echo "Failed to install packages. Sleeping before trying again..."
sleep 10
done
}
bootstrap_docker()
{
# Required for newer mysql-server packages to install/upgrade on Ubuntu 16.04.
@ -284,6 +317,7 @@ bootstrap_remote()
"freebsd") bootstrap_remote_freebsd ;;
"macos") bootstrap_remote_macos ;;
"rhel") bootstrap_remote_rhel ;;
"ubuntu") bootstrap_remote_ubuntu ;;
esac
done
}

Loading…
Cancel
Save