【问题标题】:Error when create replication user with mysql role in ansible在ansible中创建具有mysql角色的复制用户时出错
【发布时间】:2019-09-13 14:29:24
【问题描述】:

我在使用 geerlingguy/ansible-role-mysql 时遇到问题

错误是:

FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'list object' has no attribute 'password'\n\nThe error appears to have been in '/root/.ansible/roles/geerlingguy.mysql/tasks/replication.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Ensure replication user exists on master.\n ^ here\n"}

我的 vars/main.yml :

mysql_bind_address: '0.0.0.0'
mysql_server_id: "1"
mysql_max_binlog_size: "100M"
mysql_binlog_format: "ROW"
mysql_expire_logs_days: "10"
mysql_replication_role: 'master'
mysql_replication_master: 'ip'
mysql_replication_user:
        - name: slave01
          password: pass1
          priv: "*.*:REPLICATION SLAVE"
        - name: slave02
          password: pass2
          priv: "*.*:REPLICATION SLAVE"

我正在使用现有角色,您可以在其中看到类似的示例:https://github.com/geerlingguy/ansible-role-mysql#example-playbook

有什么问题?

【问题讨论】:

    标签: mysql ansible replication


    【解决方案1】:

    您正在根据 yaml 创建一个对象数组。删除 '-' 并将所有内容缩进 0 个空格:

    name: asddad
    password: asdasd
    host: asdasd
    priv: asdasd
    

    【讨论】:

    • 对,但如果我没记错的话,这正是我所需要的。我已经完成了更多的 main.yml 文件。回答下面的更多信息
    • 将您写的内容作为答案作为对帖子的编辑
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-11
    • 1970-01-01
    • 2017-02-06
    • 2018-12-16
    相关资源
    最近更新 更多