Add option to create host_key directory if it doesn't exist

Fixes #6731
Merge pull request #6762 from jimi-c/issue_6731_fix_host_key_dir_creation

Add option to create host_key directory if it doesn't exist