New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add postgresql_query module to database collection #20793
Add postgresql_query module to database collection #20793
Conversation
Migrated from ansible/ansible-modules-extras#1802 |
7d03612
to
f4fa368
Compare
@wrouesnel CI failure due to python 2.4 syntax error:
Here's an example of how to handle exceptions that will work with python 2.4+: https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/files/file.py#L286 |
f4fa368
to
bc99242
Compare
7b103c4
to
d9213d7
Compare
The test
The test
|
764d9ac
to
1a65d6f
Compare
As a maintainer of a module in the same namespace this new module has been submitted to, your vote counts for shipits. Please review this module and add |
1a65d6f
to
7f17171
Compare
The test
The test
The test
The test
The test
|
7a57cd6
to
b8b4083
Compare
The test
|
b8b4083
to
95f089d
Compare
The test
|
This patch adds a postgresql query module. This allows running arbitrary queries from ansible scripts with safe escaping of of the supplied values. A custom type conversion for datetime -> string so exit_json() can work, the full space of needed type conversions to return data is not yet known.
95f089d
to
a6fa09a
Compare
This module fills out an important gap in Ansible's database functionality when setting up applicaitons which use Postgres. It'd be really nice to get it merged. |
@wrouesnel: I happy to see new progress on this. I made #25411 initially just because there was no activity on this PR for a long time. We all have busy lives. The code you did was a nice starting point and I think you nailed the way module input should be. In #25411, I added new features, mainly the ability to throw Regards, |
@archf I'll take a look this week. So long as we wind up with good functionality I'm not fussed who's PR it is. This got caught up in me trying to get done traction on a bunch of old PRs this weekend. |
I propose we support the use case of ensuring some row exists in the database, such as creating an initial user for an application. Something like this:
What should the "run this query first and only if it returns and empty set, run the actual query" parameter be called? The semantics should be that the query reports |
Is everyone happy with continuing the work on #25411? Can we close this one? |
needs_info |
@wrouesnel This pullrequest is waiting for your response. Please respond or the pullrequest will be closed. |
I'm happy sorry 25411 capturing the work. Closing this. |
Note: resubmitted due to github not letting the branch be updated.
Issue Type:
Plugin Name:
postgresql_query
Ansible Version:
Summary:
This patch adds the
postgresql_query
module. This fills a gap in ansible functionality in allowing running queries as part of a playbook to retrieve values or deploy applications (e.g. setting authentication in gogs).Example output:
The following is an example response from a select query against a database which contains JSON strings:
This patch adds a postgresql query module. This allows running arbitrary queries
from ansible scripts with safe escaping of of the supplied values.