From 0e7dbda68d7f8e8295750bb7129b812a8b183b83 Mon Sep 17 00:00:00 2001 From: Sergei Antipov Date: Thu, 22 Feb 2018 22:29:39 +0700 Subject: [PATCH] Fix replication module failing on timeout --- library/mongodb_replication.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/mongodb_replication.py b/library/mongodb_replication.py index 02a2c1b..703f561 100644 --- a/library/mongodb_replication.py +++ b/library/mongodb_replication.py @@ -301,7 +301,7 @@ def load_mongocnf(): return creds -def wait_for_ok_and_master(module, client, timeout = 60): +def wait_for_ok_and_master(module, client, timeout = 120): while True: status = client.admin.command('replSetGetStatus', check=False) if status['ok'] == 1 and status['myState'] == 1: @@ -397,6 +397,10 @@ def main(): connection_params = { "host": login_host, "port": int(login_port), + "username": login_user, + "password": login_password, + "authsource": login_database, + "serverselectiontimeoutms": 110000, } if ssl: