mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 06:31:23 -07:00
Use standard argument names in PostgreSQL modules
passwd -> password loginpass -> login_password loginuser -> login_user loginhost -> login_host Add an example playbook that shows how to use the modules.
This commit is contained in:
parent
a9c2e597ac
commit
dcd214a631
3 changed files with 63 additions and 25 deletions
|
@ -52,9 +52,9 @@ def db_create(cursor, db):
|
|||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
loginuser=dict(default="postgres"),
|
||||
loginpass=dict(default=""),
|
||||
loginhost=dict(default=""),
|
||||
login_user=dict(default="postgres"),
|
||||
login_password=dict(default=""),
|
||||
login_host=dict(default=""),
|
||||
db=dict(required=True),
|
||||
state=dict(default="present", choices=["absent", "present"]),
|
||||
)
|
||||
|
@ -67,9 +67,9 @@ def main():
|
|||
state = module.params["state"]
|
||||
changed = False
|
||||
try:
|
||||
db_connection = psycopg2.connect(host=module.params["loginhost"],
|
||||
user=module.params["loginuser"],
|
||||
password=module.params["loginpass"],
|
||||
db_connection = psycopg2.connect(host=module.params["login_host"],
|
||||
user=module.params["login_user"],
|
||||
password=module.params["login_password"],
|
||||
database="template1")
|
||||
# Enable autocommit so we can create databases
|
||||
db_connection.autocommit = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue