In your templates you need to edit the apt source files, so the urls instead of being https:// become http://HTTPS///.
You can do it quickly with these commands (run as root):
sed -i 's#https://#http://HTTPS///#g' /etc/apt/sources.list
sed -i 's#https://#http://HTTPS///#g' /etc/apt/sources.list.d/*.list