Use additional vars when templating included file names

Fixes #9669
New integration tests for postgresql
Revise patch from earlier using even more variable sources for HostVars

Superceeds e61e8a3

Fixes #9684