fixes #6370 - automatically associate templates with compatible OS's

This change introduces parsing of the YAML metadata available in most of
our default templates.  It serialises the 'oses' data into an os_hash,
and on updating or either a template or OS, makes the associations
with an Operating System and its compatible templates.