I cant't change master with mysql_replication

66 views
Skip to first unread message

rarirure luis

unread,
Oct 31, 2016, 8:57:31 AM10/31/16
to Ansible Project
Hi. I'm afraid my expressions may be rude or hard to read, because I'm not so good at English.

I want to change master with `mysql_replication` but error.
TASK [dbtier : Semi-synchronous - Change master] *******************************
skipping: [192.168.30.5] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true}
fatal: [192.168.30.6]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'dict object' has no attribute 'File'\n\nThe error appears to have been in '/root/USME-Playbook/roles/dbtier/tasks/main.yml': line 96, 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: Semi-synchronous - Change master\n  ^ here\n"}



Code:
 
- name: Semi-synchronous - Stop slave if running
  mysql_replication: mode=stopslave
  when: hostname.stdout.find('usme-db-slave') == 0

- name: Semi-synchronous - Import all_db_dump.sql
  shell: mysql --defaults-file=/root/.my.cnf < /root/all_db_dump.sql
  when: hostname.stdout.find('usme-db-slave') == 0

- name: Semi-synchnorous - Restart percona server
  service: name=mysql state=restarted

- name: Semi-synchronous - Get master binlog filename and binlog position
  mysql_replication: mode=getmaster
  register: binlog
  when: hostname.stdout.find('usme-db-master') == 0

- name: Semi-synchronous - Change master # Error here
  mysql_replication: mode=changemaster master_host=192.168.30.5 master_user=repuser master_password='password' master_port=3306 master_log_file="{{ binlog.File }}" master_log_pos="{{ binlog.Position }}"
  when: hostname.stdout.find('usme-db-slave') == 0




Version:

ansible 2.3.0 (devel 8331e915e0) last updated 2016/10/29 00:18:29 (GMT +000)
  lib/ansible/modules/core: (detached HEAD de7ec946e9) last updated 2016/10/29 00:18:41 (GMT +000)
  lib/ansible/modules/extras: (detached HEAD 8bd40fb622) last updated 2016/10/29 00:19:00 (GMT +000)
  config file =
  configured module search path = Default w/o overrides


How to resolve this error?
Thanks.
Reply all
Reply to author
Forward
0 new messages