Make sure HostVars object is instantiated before assigning it

Fixes #7006