1

I sign-up on this site to ask an question. How can I pass those master status information especially File and Position to an Ansible variable, to automate the processess of replication with an Ansible playbook.

master status

I want to write this variables in my playbook here. ansible playbook

Rick James
  • 80,479
  • 5
  • 52
  • 119
DRAKON
  • 21
  • 2

1 Answers1

1

I found some code bit's and wirte my solution.

vars: 
    masterhost: yourlocalhost
    masterip: ip of your host 0.0.0.0

tasks: - name: Get data from master file and position mysql_replication: mode: getmaster register: master1data

- name: change master data
  mysql_replication:
    mode: changeprimary
    master_host: '{{ masterip }}'
    master_user: username
    master_password: pass
    master_log_file: '{{ master1data.File }}'
    master_log_pos: '{{ master1data.Position }}'

DRAKON
  • 21
  • 2