From 41fde07e983745690e871806e4a1fe02118afd4b Mon Sep 17 00:00:00 2001 From: Piotr Kweclich Date: Wed, 5 Sep 2012 18:18:30 +0200 Subject: [PATCH] added support for custom port definition --- postgresql_db | 5 ++++- postgresql_user | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/postgresql_db b/postgresql_db index 32ee9205909..fdccd14ddbd 100755 --- a/postgresql_db +++ b/postgresql_db @@ -77,6 +77,7 @@ def main(): login_user=dict(default="postgres"), login_password=dict(default=""), login_host=dict(default=""), + port=dict(default="5432"), db=dict(required=True, aliases=['name']), owner=dict(default=""), template=dict(default=""), @@ -89,6 +90,7 @@ def main(): module.fail_json(msg="the python psycopg2 module is required") db = module.params["db"] + port = module.params["port"] owner = module.params["owner"] template = module.params["template"] encoding = module.params["encoding"] @@ -101,7 +103,8 @@ def main(): params_map = { "login_host":"host", "login_user":"user", - "login_password":"password" + "login_password":"password", + "port":"port" } kw = dict( (params_map[k], v) for (k, v) in module.params.iteritems() if k in params_map and v != '' ) diff --git a/postgresql_user b/postgresql_user index d883cc57cc8..6104fd8d008 100755 --- a/postgresql_user +++ b/postgresql_user @@ -224,6 +224,7 @@ def main(): state=dict(default="present", choices=["absent", "present"]), priv=dict(default=None), db=dict(default=''), + port=dict(default='5432'), fail_on_user=dict(default='yes') ) ) @@ -235,6 +236,7 @@ def main(): if db == '' and module.params["priv"] is not None: module.fail_json(msg="privileges require a database to be specified") privs = parse_privs(module.params["priv"], db) + port = module.params["port"] if not postgresqldb_found: module.fail_json(msg="the python psycopg2 module is required") @@ -246,6 +248,7 @@ def main(): "login_host":"host", "login_user":"user", "login_password":"password", + "port":"port", "db":"database" } kw = dict( (params_map[k], v) for (k, v) in module.params.iteritems()