mysql_user priv 问题

mysql_user issue with priv

在我的剧本中我有类似的东西:

- name: Creates a mysql user
  mysql_user:
    login_host: "{{ db_host }}"
    login_user: "{{ db_user }}"
    login_password: "{{ db_password }}"
    name: my_user
    password: 123123
    state: present
    priv: "*.*:ALL"

如果我 运行 那,我得到:

FAILED! => {"changed": false, "failed": true, "msg": "(1045, \"Access denied for user 'dbuser'@'%' (using password: YES)\")"}

但是,如果我 运行 它没有 priv 部分:

- name: Creates a mysql user
  mysql_user:
    login_host: "{{ db_host }}"
    login_user: "{{ db_user }}"
    login_password: "{{ db_password }}"
    name: my_user
    password: 123123
    state: present

用户创建正常。 priv 字符串是取自文档 here 的示例,因此它应该可以工作。 我测试了几个 ansible 版本 (>1.9.4)

来自评论的回答:

Does dbuser have enough permissions to grant my_user privileges to all databases?