“msg”: “The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required.”
1、问题背景
在使用ansible部署mysql时,出现报错如下
2、解决办法
报错原因:需要在远程主机上安装 PyMySQL(Python 2.7 和 Python 3.X)或 MySQL-python(Python 2.X)包
- 在剧本中添加如下代码
- name: 1.4安装MySQL-python
yum:
name: MySQL-python
state: present
tags: 1.4安装MySQL-python
详情见官网
community.mysql.mysql_user模块 – 在 MySQL 数据库中添加或删除用户 — Ansible 文档