Fix mongo integration bug with tags

The template was not deleting leading whitespaces so it generated
an invalid YAML file.