Non-interactive install of grub2 when installing from scratch

Answering my own question - I have found I can do it like this:

echo "grub-pc grub-pc/install_devices_empty   boolean true" | debconf-set-selections
DEBIAN_FRONTEND=text apt-get -y install grub2