gpt4 book ai didi

mysql - 在ansible中创建具有mysql角色的复制用户时出错

转载 作者:行者123 更新时间:2023-11-29 16:05:00 25 4
gpt4 key购买 nike

我在使用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

问题是什么?

最佳答案

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

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

关于mysql - 在ansible中创建具有mysql角色的复制用户时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55827560/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com