Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templates/ubuntu: support netplan in newer releases by default #1770

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 17 additions & 2 deletions templates/lxc-ubuntu.in
Expand Up @@ -92,7 +92,15 @@ configure_ubuntu()
password=$5

# configure the network using the dhcp
cat <<EOF > $rootfs/etc/network/interfaces
if chroot $rootfs which netplan; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should redirect the output of which to /dev/null. We usually use "which blah >/dev/null 2>&1" in our scripts.

cat <<EOF > $rootfs/etc/netplan/10-lxc.yaml
network:
ethernets:
eth0: {dhcp4: true}
version: 2
EOF
else
cat <<EOF > $rootfs/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

Expand All @@ -103,6 +111,7 @@ iface lo inet loopback
auto eth0
iface eth0 inet dhcp
EOF
fi

# set the hostname
cat <<EOF > $rootfs/etc/hostname
Expand Down Expand Up @@ -366,7 +375,13 @@ download_ubuntu()
debootstrap_parameters="$debootstrap_parameters --variant=$variant"
fi
if [ "$variant" = 'minbase' ]; then
packages_template="${packages_template},sudo,ifupdown,isc-dhcp-client"
packages_template="${packages_template},sudo"
# Newer releases use netplan, EOL releases not supported
case $release in
trusty|xenial|zesty)
packages_template="${packages_template},ifupdown,isc-dhcp-client"
;;
esac
fi

echo "Installing packages in template: ${packages_template}"
Expand Down