ansible-role-mysql
ansible-role-mysql copied to clipboard
Check master replication status.
In tasks/replication.yml This errors occurs while I'm testing this role on vagrant guests.
Problem 1
has a delegate_to: "{{ mysql_replication_master }} option which in my case needed a remote_user
to fix a remote SSH connection failure
Problem 2
a) When I give the remote_user: my ansible_user variable it gives me an "Unhandled exception occurred while templating"
b) Using a custom group variable gives me an "msg": "'remote_user' is undefined"
solution is to set a variable in defaults/main.yml which can be overridden for the different used distribution ....
- name: Check master replication status.
mysql_replication: mode=getprimary
delegate_to: "{{ mysql_replication_master }}"
remote_user: "{{ guest_user }}"
register: master
when:
- (slave.Is_Replica is defined and not slave.Is_Replica) or (slave.Is_Replica is not defined and slave is failed)
- mysql_replication_role == 'slave'
- (mysql_replication_master | length) > 0
tags: ['skip_ansible_galaxy']
- name: "debug 'master' var"
debug:
msg: "{{ master }}, guest_user: {{ guest_user }}"
This is also a follow up of #495