4646 - Note that if the provided password string is already in MD5-hashed
4747 format, then it is used as-is, regardless of I(encrypted) option.
4848 type: str
49- db :
49+ login_db :
5050 description:
5151 - Name of database to connect to and where user's permissions are granted.
5252 type: str
5353 default: ''
5454 aliases:
55- - login_db
55+ - db
5656 fail_on_user:
5757 description:
5858 - If C(true), fails when the user (role) cannot be removed. Otherwise just log and continue.
220220# You should use the 'postgresql_privs' module instead.
221221- name: Connect to acme database, create django user, and grant access to database and products table
222222 community.postgresql.postgresql_user:
223- db : acme
223+ login_db : acme
224224 name: django
225225 password: ceec4eif7ya
226226 priv: "CONNECT/products:ALL"
227227 expires: "Jan 31 2020"
228228
229229- name: Add a comment on django user
230230 community.postgresql.postgresql_user:
231- db : acme
231+ login_db : acme
232232 name: django
233233 comment: This is a test user
234234
249249# You should use the 'postgresql_privs' module instead.
250250- name: Connect to acme database and remove test user privileges from there
251251 community.postgresql.postgresql_user:
252- db : acme
252+ login_db : acme
253253 name: test
254254 priv: "ALL/products:ALL"
255255 state: absent
259259# You should use the 'postgresql_privs' module instead.
260260- name: Connect to test database, remove test user from cluster
261261 community.postgresql.postgresql_user:
262- db : test
262+ login_db : test
263263 name: test
264264 priv: ALL
265265 state: absent
268268# You should use the 'postgresql_privs' module instead.
269269- name: Connect to acme database and set user's password with no expire date
270270 community.postgresql.postgresql_user:
271- db : acme
271+ login_db : acme
272272 name: django
273273 password: mysupersecretword
274274 priv: "CONNECT/products:ALL"
279279
280280- name: Connect to test database and remove an existing user's password
281281 community.postgresql.postgresql_user:
282- db : test
282+ login_db : test
283283 user: test
284284 password: ""
285285
@@ -1096,7 +1096,13 @@ def main():
10961096 password = dict (type = 'str' , default = None , no_log = True ),
10971097 state = dict (type = 'str' , default = 'present' , choices = ['absent' , 'present' ]),
10981098 priv = dict (type = 'str' , default = None , removed_in_version = '4.0.0' , removed_from_collection = 'community.postgreql' ),
1099- db = dict (type = 'str' , default = '' , aliases = ['login_db' ]),
1099+ login_db = dict (type = 'str' , default = "" , aliases = ['db' ], deprecated_aliases = [
1100+ {
1101+ 'name' : 'db' ,
1102+ 'version' : '4.0.0' ,
1103+ 'collection_name' : 'community.postgresql' ,
1104+ }],
1105+ ),
11001106 fail_on_user = dict (type = 'bool' , default = True , aliases = ['fail_on_role' ]),
11011107 role_attr_flags = dict (type = 'str' , default = '' ),
11021108 encrypted = dict (type = 'bool' , default = True ),
@@ -1119,10 +1125,10 @@ def main():
11191125 state = module .params ["state" ]
11201126 fail_on_user = module .params ["fail_on_user" ]
11211127 # WARNING: privs are deprecated and will be removed in community.postgresql 4.0.0
1122- if module .params ['db ' ] == '' and module .params ["priv" ] is not None :
1128+ if module .params ['login_db ' ] == '' and module .params ["priv" ] is not None :
11231129 module .fail_json (msg = "privileges require a database to be specified" )
11241130 # WARNING: privs are deprecated and will be removed in community.postgresql 4.0.0
1125- privs = parse_privs (module .params ["priv" ], module .params ["db " ])
1131+ privs = parse_privs (module .params ["priv" ], module .params ["login_db " ])
11261132 no_password_changes = module .params ["no_password_changes" ]
11271133 if module .params ["encrypted" ]:
11281134 encrypted = "ENCRYPTED"
0 commit comments