check_mode: explicit error message when PostgreSQL is missing
check_mode: fail with an explicit message when PostgreSQL isn't installed. Without this change the following error occurs:
TASK [postgresql : get PostgreSQL version]
duckcorp-infra/ansible/roles/postgresql/tasks/main.yml:25
ok: [Orthos] => {
"changed": false,
"cmd": "pg_lsclusters -h | awk '{ if ( $2 = \"main\" ) { print $1 } }'",
"rc": 0,
"stderr": "/bin/sh: 1: pg_lsclusters: not found",
"stdout": "",
}
TASK [postgresql : define PostgreSQL version]
duckcorp-infra/ansible/roles/postgresql/tasks/main.yml:36
ok: [Orthos] => {
"ansible_facts": {"_pg_version": ""},
}
TASK [postgresql : debug]
duckcorp-infra/ansible/roles/postgresql/tasks/main.yml:40
ok: [Orthos] => {
"msg": "The detected PostgreSQL version is: "
}
[...]
TASK [postgresql : Create PostgreSQL Configuration Extra Directory]
duckcorp-infra/ansible/roles/postgresql/tasks/main.yml:65
fatal: [Orthos]: FAILED! => {
"msg": "The conditional check '_pg_version is version('9.3', '>=')' failed.
The error was: Version comparison: 'LooseVersion' object has no attribute 'version'"
}