From d868cdc7b881bb89a4fab7a0086cf358e7427cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Ness?= Date: Tue, 12 Apr 2016 14:16:18 +0200 Subject: [PATCH] enable mysql connection via unix socket --- lib/ansible/module_utils/mysql.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ansible/module_utils/mysql.py b/lib/ansible/module_utils/mysql.py index e5ff711987f..14726b4740a 100644 --- a/lib/ansible/module_utils/mysql.py +++ b/lib/ansible/module_utils/mysql.py @@ -36,9 +36,7 @@ except ImportError: mysqldb_found = False def mysql_connect(module, login_user=None, login_password=None, config_file='', ssl_cert=None, ssl_key=None, ssl_ca=None, db=None, cursor_class=None, connect_timeout=30): - config = { - 'host': module.params['login_host'] - } + config = {} if ssl_ca is not None or ssl_key is not None or ssl_cert is not None: config['ssl'] = {} @@ -46,6 +44,7 @@ def mysql_connect(module, login_user=None, login_password=None, config_file='', if module.params['login_unix_socket']: config['unix_socket'] = module.params['login_unix_socket'] else: + config['host'] = module.params['login_host'] config['port'] = module.params['login_port'] if os.path.exists(config_file):