Guest User

Untitled

a guest
Dec 31st, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. [mysql]
  2. stagmysql01 ansible_host=1.1.1.1 ansible_ssh_user=ansible ansible_connection=ssh
  3. stagmysql02 ansible_host=1.1.1.2 ansible_ssh_user=ansible ansible_connection=ssh
  4.  
  5. [mysql:vars]
  6. replication_master=1.1.1.1
  7.  
  8. - name: "{{ ENV }} - Mysql"
  9. hosts: mysql
  10. become: true
  11. become_user: root
  12. roles:
  13. - Mysql_Base
  14.  
  15. - name: Mysql - Check master replication status.
  16. mysql_replication: mode=getmaster
  17. register: master
  18. when: ansible_eth0.ipv4.address == replication_master
  19.  
  20. - debug: var=master
  21.  
  22. - name: Mysql - Configure replication on the slave.
  23. mysql_replication:
  24. mode: changemaster
  25. master_host: "{{ replication_master }}"
  26. master_user: "{{ replication_user }}"
  27. master_password: "{{ replication_pass }}"
  28. master_log_file: "{{ master.File }}"
  29. master_log_pos: "{{ master.Position }}"
  30. ignore_errors: True
  31. when: ansible_eth0.ipv4.address != replication_master
  32.  
  33. TASK [Mysql_Base : Mysql - Check master replication status.] ****************
  34. skipping: [stagmysql02]
  35. ok: [stagmysql01]
  36.  
  37. TASK [Mysql_Base : debug] ***************************************************
  38. ok: [stagmysql01] => {
  39. "master": {
  40. "Binlog_Do_DB": "",
  41. "Binlog_Ignore_DB": "mysql,performance_schema",
  42. "Executed_Gtid_Set": "",
  43. "File": "mysql-bin.000003",
  44. "Is_Master": true,
  45. "Position": 64687163,
  46. "changed": false,
  47. "failed": false
  48. }
  49. }
  50. ok: [stagmysql02] => {
  51. "master": {
  52. "changed": false,
  53. "skip_reason": "Conditional result was False",
  54. "skipped": true
  55. }
  56. }
  57.  
  58. TASK [Mysql_Base : Mysql - Configure replication on the slave.] *************
  59. skipping: [stagmysql01]
  60. 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'"}
  61. ...ignoring
Add Comment
Please, Sign In to add comment