The templates are isolated from network and you can only access the network from inside the template using proxy http://127.0.0.1:8082 so you need to use this proxy for wget/curl:
Curl-proxy / wget-proxy scripts in Templates so users can add GPG distro keys linked to added external repositories