This code is intended to create a user on the master, but in a typical installation, ansible conditions prevent it from working. The mysql_replication_master variable will typically be empty on the master.
Did I understand the idea correctly? Is there a error here?
The workaround is easy: you just need to define the user as usual in mysql_users
Ensure replication user exists on master.
mysql_user:
name: "{{ mysql_replication_user.name }}"
host: "{{ mysql_replication_user.host | default('%') }}"
password: "{{ mysql_replication_user.password }}"
priv: "{{ mysql_replication_user.priv | default('*.*:REPLICATION SLAVE,REPLICATION CLIENT') }}"
update_password: "{{ mysql_replication_user.update_password | default('always') }}"
state: present
no_log: "{{ mysql_hide_passwords }}"
when:
- mysql_replication_role == 'master'
- mysql_replication_user.name is defined
- (mysql_replication_master | length) > 0
tags: ['skip_ansible_galaxy']
|
- (mysql_replication_master | length) > 0 |
This code is intended to create a user on the master, but in a typical installation, ansible conditions prevent it from working. The mysql_replication_master variable will typically be empty on the master.
Did I understand the idea correctly? Is there a error here?
The workaround is easy: you just need to define the user as usual in
mysql_usersansible-role-mysql/tasks/replication.yml
Line 14 in 1787ae8