Use psycopg2's string handling to escape password string

This allows the password to contain single quotes and should make it safe to
use randomly generated passwords (provided passwords can be represented in the
connection encoding).
Prevent premature substitution of variables into tasks

As documented in #2623, early variable substitution causes when_
tests to fail and possibly other side effects.

I can see the reason for this early substitution, likely introduced
in 1dfe60a6, to allow many playbook parameters to be templated.
This is a valid goal, but the recursive nature of the utils.template
function means that it goes too far.

At this point removing tasks from the list of parameters to be
substituted seems sufficient to make my tests pass. It may be the
case that other parameters should be excluded, but I suspect not.

Adding a test case. I would prefer to analyse not just the aggregate
statistics but also whether the results are as expected - I can't
see an easy way to do that with the available callbacks at present.
Quick fix for first_available_file and roles
Update pause module to not use utils.template
Remove unneeded import.
Avoid running through the legacy template code if no dollar signs are in strings.
Merge pull request #2656 from dstoflet/first_available_file_fix

Quick fix for first_available_file and role support
More 1.2 templating development; for legacy when_string constructs don't quote the 'in' operator
Create the .ssh dir if it does not already exist.
Make debug print things nicer if {{ foo }} didn't interpolate
Docs on parameterized roles, make document generation output less noisy
Moving some more files into snapshot directory
Reorganize docs structure to support snapshots.
Resolve merge conflict.
Favor {{ foo }} rather than $foo in documentation.
Mention roles in best practices
Smush Jinja2 braces in playbooks so unresolved variables get parsed nicely
Teach lookup plugins that if they can't evaluate something they can wait and do it later.
Allow 'when' and 'with_items' to be applied to roles.
Merge pull request #2623 from willthames/when_set_bug

Prevent premature variable substitution in tasks