ansible-role-mysql
ansible-role-mysql copied to clipboard
Issue with Replication master
I have an issue in which I can't get ansible to see the replication user The Ansible version is 2.9 from EPEL on Rocky 8. check out is from ansible galaxy today. any ideas what am doing wrong ?
- name: zabbix DB install
become: yes
hosts: zabbixdatabases
vars:
mysql_replication_role: "master"
mysql_packages:
- mariadb
- mariadb-server
- mariadb-server-utils
- mariadb-backup
- mysql-selinux
- python3-PyMySQL
mysql_databases:
- name: zabbixmonitoring
encoding: utf8mb4
collation: utf8mb4_unicode_ci
state: present
mysql_users:
- name: zabbix_be
host: "%"
password: superstrongpassword
priv: "zabbixmonitoring.*:ALL"
state: present
mysql_replication_user:
- name: "db_replicator"
password: "SeeingMeReplicate"
host: "%"
state: present
roles:
- geerlingguy.mysql
tasks:
- name: "debug replication username"
debug:
msg: "{{ mysql_replication_user.name }}"
- name: "debug replication role"
debug:
msg: "{{ mysql_replication_role }}"
- name: "debug replication master"
debug:
msg: "{{ mysql_replication_master }}"
TASK [geerlingguy.mysql : Check slave replication status.] ********************************************************************************************************************************************************************************** fatal: [192.168.5.194]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'list object' has no attribute 'name'\n\nThe error appears to be in '/root/.ansible/roles/geerlingguy.mysql/tasks/replication.yml': line 15, 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: Check slave replication status.\n ^ here\n"} ...ignoring
TASK [debug replication username] *********************************************************************************************************************************************************************************************************** fatal: [192.168.5.194]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'list object' has no attribute 'name'\n\nThe error appears to be in '/root/playbook.yaml': line 65, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: "debug replication username"\n ^ here\n"}
Hello @damo2929
mysql_replication_user is not a list.
You can change your variable like that:
mysql_replication_user:
name: "db_replicator"
password: "SeeingMeReplicate"
host: "%"
state: present
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read this blog post to see the reasons why I mark issues as stale.
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.