Improve template insert exec.

When the insert of a template failed at Elasticsearch the curl command still gave a '0' exit code back.
Now we make sure we grep for a 200/201 http code and check for that.
When it fails ( error code 500 for example ) we let the exec fail so we have feedback on the insert call.