Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [mysql]
- stagmysql01 ansible_host=1.1.1.1 ansible_ssh_user=ansible ansible_connection=ssh
- stagmysql02 ansible_host=1.1.1.2 ansible_ssh_user=ansible ansible_connection=ssh
- [mysql:vars]
- replication_master=1.1.1.1
- - name: "{{ ENV }} - Mysql"
- hosts: mysql
- become: true
- become_user: root
- roles:
- - Mysql_Base
- - name: Mysql - Check master replication status.
- mysql_replication: mode=getmaster
- register: master
- when: ansible_eth0.ipv4.address == replication_master
- - debug: var=master
- - name: Mysql - Configure replication on the slave.
- mysql_replication:
- mode: changemaster
- master_host: "{{ replication_master }}"
- master_user: "{{ replication_user }}"
- master_password: "{{ replication_pass }}"
- master_log_file: "{{ master.File }}"
- master_log_pos: "{{ master.Position }}"
- ignore_errors: True
- when: ansible_eth0.ipv4.address != replication_master
- TASK [Mysql_Base : Mysql - Check master replication status.] ****************
- skipping: [stagmysql02]
- ok: [stagmysql01]
- TASK [Mysql_Base : debug] ***************************************************
- ok: [stagmysql01] => {
- "master": {
- "Binlog_Do_DB": "",
- "Binlog_Ignore_DB": "mysql,performance_schema",
- "Executed_Gtid_Set": "",
- "File": "mysql-bin.000003",
- "Is_Master": true,
- "Position": 64687163,
- "changed": false,
- "failed": false
- }
- }
- ok: [stagmysql02] => {
- "master": {
- "changed": false,
- "skip_reason": "Conditional result was False",
- "skipped": true
- }
- }
- TASK [Mysql_Base : Mysql - Configure replication on the slave.] *************
- skipping: [stagmysql01]
- fatal: [stagmysql02]: FAILED! => {"failed": true, "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'File'nnThe error appears to have been in '/root/ansible/roles/Mysql_Base/tasks/replication.yml': line 30, column 3, but maynbe elsewhere in the file depending on the exact syntax problem.nnThe offending line appears to be:nnn- name: Mysql - Configure replication on the slave.n ^ herennexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>nexception: 'dict object' has no attribute 'File'"}
- ...ignoring
Add Comment
Please, Sign In to add comment