项目场景:
提示:运行playbook脚本时
问题描述
提示:在Mariadb模块时出现缺少PyMySQL时
例如:我在ansible运行中对添加数据库时出现的问提提示
代码如下:
[WARNING]: The value ******** (type int) in a string field was converted to u'********' (type string). If this does not look like what you expect, quote the entire value to ensure it does not change. fatal: [192.168.100.143]: FAILED! => {"changed": false, "msg": "The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required."}
原因分析:
提示:下载mariadb没有自带的软件包,出现了缺少PyMySQL
解决方案:
可以按着我做的试试看:
复制:ansible localhost -m dnf -a "name=python3-PyMySQL.noarch"
然后执行即可,仅限mariadb使用
[root@localhost ansible]# ansible localhost -m dnf -a "name=python3-PyMySQL.noarch"
localhost | CHANGED => {
"changed": true,
"msg": "",
"rc": 0,
"results": [
"Installed: python3-cryptography-3.2.1-5.el8.x86_64",
"Installed: python3-cffi-1.11.5-5.el8.x86_64",
"Installed: python3-pycparser-2.14-14.el8.noarch",
"Installed: python3-PyMySQL-0.10.1-2.module+el8.4.0+9657+a4b6a102.noarch"
]
}