# I cant't change master with mysql\_replication

**URL:** <https://forum.ansible.com/t/i-cantt-change-master-with-mysql-replication/22919>\
**Category:** Ansible Project\
**Created:** [October 29, 2016, 2:27pm UTC](https://forum.ansible.com/t/i-cantt-change-master-with-mysql-replication/22919 "2016-10-29T14:27:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rarirure\_luis](https://avatars.discourse-cdn.com/v4/letter/r/c89c15/32.png) [@rarirure\_luis](https://forum.ansible.com/u/rarirure_luis)\
**Post date:** [October 29, 2016, 2:27pm UTC](https://forum.ansible.com/t/i-cantt-change-master-with-mysql-replication/22919/1 "2016-10-29T14:27:25Z")

</div>

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.
