fatal: [db01]: FAILED! => {"changed": false, "msg": "The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required."}

时间:2022-03-12 02:54:18

centos7.5 使用ansible中的role安装mariadb创建用户报错

错误:

[root@m01 roles]# ansible-playbook site.yml 
TASK [mysql : create databases] ********************************************************************
fatal: [db01]: FAILED! => {"changed": false, "msg": "The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required."}

错误原因:

没有安装MySQL-python

解决方法:

安装MySQL-python
- name: Installed Mariadb Server
  yum: name={{ packages }} state=present
  vars:
    packages:
      - mariadb
      - mariadb-server
      - MySQL-python