You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The playbook must not failed when re-run (after database deletion)
ACTUAL RESULTS
failed: [sv-pdb] (item={'name': 'antho', 'priv': 'ALL'}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "antho", "priv": "ALL"}, "msg": "unable to connect to database: la connexion au serveur sur le socket « /var/run/postgresql/.s.PGSQL.5432 » a échoué : FATAL: la base de données « HISTOIRE » n'existe pas\n"}
The text was updated successfully, but these errors were encountered:
mdiogene
changed the title
Postgresql_user/postgresql_db not indempotent fails when re-run playbook as database is deleted.
Postgresql_user not indempotent fails when re-run playbook as database is deleted.
Apr 29, 2023
@mdiogene hello, thanks for reporting the issue!
The module documentation for the db option says:
Name of database to connect to and where user's permissions will be granted.
If the database doesn't exist, the failure seems expected as the module just can't connect to a non-existing database.
In this case, you could try to connect to the postgres db when the state is absent. Would this work for you?
SUMMARY
The module postgresql_user is notindepotent, it fails when the playbook is re-executed.
ISSUE TYPE
COMPONENT NAME
postgresql_user
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT
CentOS 7
STEPS TO REPRODUCE
EXPECTED RESULTS
The playbook must not failed when re-run (after database deletion)
ACTUAL RESULTS
failed: [sv-pdb] (item={'name': 'antho', 'priv': 'ALL'}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "antho", "priv": "ALL"}, "msg": "unable to connect to database: la connexion au serveur sur le socket « /var/run/postgresql/.s.PGSQL.5432 » a échoué : FATAL: la base de données « HISTOIRE » n'existe pas\n"}
The text was updated successfully, but these errors were encountered: