From dc83f2c6d7209f4851b2f7107d9292641f6f0a40 Mon Sep 17 00:00:00 2001 From: Guillaume Dufour Date: Sun, 28 Feb 2016 08:05:20 +0100 Subject: [PATCH] use python fallback to avoid error on old mongo version without roles --- lib/ansible/modules/extras/database/misc/mongodb_user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/database/misc/mongodb_user.py b/lib/ansible/modules/extras/database/misc/mongodb_user.py index f9ac1fa363..4c864559c3 100644 --- a/lib/ansible/modules/extras/database/misc/mongodb_user.py +++ b/lib/ansible/modules/extras/database/misc/mongodb_user.py @@ -278,7 +278,7 @@ def main(): uinfo = user_find(client, user, db_name) if update_password != 'always' and uinfo: password = None - if 'roles' in uinfo and list(map((lambda x: x['role']), uinfo['roles'])) == roles: + if list(map((lambda x: x['role']), uinfo.get('roles', []))) == roles: module.exit_json(changed=False, user=user) if module.check_mode: