Skip to content

Replication user not created automatically (or settings unclear) #587

Description

@pavlozt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions