Clarified error message about missing python modules, and tweak documentation to suggest overriding interpreter.

This commit is contained in:
Matthew Exon 2022-01-22 20:48:23 +01:00
commit 64d54172aa
2 changed files with 5 additions and 3 deletions

View file

@ -80,8 +80,10 @@ notes:
yum install python2-PyMySQL (RHEL/CentOS/Fedora; see M(ansible.builtin.yum)). You can also use dnf install python2-PyMySQL
for newer versions of Fedora; see M(ansible.builtin.dnf).
- Be sure you have PyMySQL or MySQLdb library installed on the target machine
for the Python interpreter Ansible uses, for example, if it is Python 3,
you must install the library for Python 3. You can also change the interpreter.
for the Python interpreter Ansible discovers. For example if ansible discovers and uses Python 3, you need to install
the Python 3 version of PyMySQL. If ansible discovers and uses Python 2, you need to install the Python 2 version
of either PyMySQL or MySQL-python.
- If you have trouble, it may help to force Ansible to use Python 3 by specifying C(ansible_python_interpreter).
For more information, see U(https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html).
- Both C(login_password) and C(login_user) are required when you are
passing credentials. If none are present, the module will attempt to read

View file

@ -29,7 +29,7 @@ except ImportError:
except ImportError:
mysql_driver = None
mysql_driver_fail_msg = 'The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required.'
mysql_driver_fail_msg = 'A MySQL module is required: for Python 2.7 either PyMySQL or MySQL-python, or for Python 3.X PyMySQL. Consider setting ansible_python_interpreter to use the intended Python version.'
def parse_from_mysql_config_file(cnf):