-
Notifications
You must be signed in to change notification settings - Fork 96
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
Documentation missing certificate use examples #811
Comments
@v2x2799 standard evironment variables should work, something like this: - name: example query
community.postgresql.postgresql_query:
db: example_db
query: SELECT version()
environment:
PGSSLCERT: ~/.postgresql/postgresql.crt
PGSSLKEY: ~/.postgresql/postgresql.key
PGSSLMODE: verify-full
PGSSLROOTCERT: ~/.postgresql/root.crt |
@v2x2799 @betanummeric hi, thanks for reporting and discussing this! @v2x2799 would you like to add them? |
@Andersson007 Unfortunately, I don't have much experience in Ansible, and I haven't had much luck using the certificate args. It's very possible I'm not configuring my execution environment correctly. I'm trying to connect to an AWS RDS instance using an AWS PEM file. I've added the PEM file to /etc/ssl/certs within the EE using Ansible Builder, but I can't seem to make the connection. I've tried referencing this PEM in my playbook in every conceivable way, but it just doesn't seem to use it. I've tried using args similar to below. PEM file is not installed on the Ansible Control Node. community.postgresql.postgresql_query: My code always returns this error: msg: "unable to connect to database: connection to server at "" <(IP ADDRESS)>, port 5432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\n" RDS Logs always mention invalid CA. Connections work from any other source/application. |
@v2x2799 so do i understand correctly that the task from your comment with the same argument and the same certs works when you run it w/o EE? |
@v2x2799 The error message |
We were able to resolve our connectivity issue by adding username and password under the connect_params argument, By default, login_user and login_password seems to be ignored and the connection defaults to SSL. However, I believe connect_params takes precedence and overrides default SSL mode to allow passing credentials e.g. community.postgresql.postgresql_query: We've noted that (in our case), using the AWS supplied PEM key was not necessarily a requirement to connect to our RDS instance although we will ultimately want to get that worked out. |
@v2x2799 thanks for the feedback! |
SUMMARY
Existing documentation does not provide any examples of how to connect to a database using a certificate/PEM file.
For example, AWS RDS database connections require use of an Amazon certificate/PEM file. The PEM file is registered in the execution environment's cert store, but the exact syntax on how to use/reference the PEM is not clearly defined in any of the connection examples.
ISSUE TYPE
COMPONENT NAME
Module: postgresql_query Commands: ssl_cert, ca_cert
ANSIBLE VERSION
The text was updated successfully, but these errors were encountered: