2016-04-04 06:35:09 +08:00
|
|
|
---
|
2019-09-05 02:35:20 +08:00
|
|
|
- name: enable mirroring on the pool
|
2019-09-10 02:18:49 +08:00
|
|
|
command: "{{ docker_exec_cmd | default('') }} rbd --cluster {{ cluster }} --keyring /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring --name client.rbd-mirror.{{ ansible_hostname }} mirror pool enable {{ ceph_rbd_mirror_pool }} {{ ceph_rbd_mirror_mode }}"
|
2019-09-05 02:35:20 +08:00
|
|
|
changed_when: false
|
|
|
|
|
2019-10-15 23:32:40 +08:00
|
|
|
- name: list mirroring peer
|
|
|
|
shell: "{{ docker_exec_cmd | default('') }} rbd --cluster {{ cluster }} --keyring /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring --name client.rbd-mirror.{{ ansible_hostname }} mirror pool info {{ ceph_rbd_mirror_pool }} | grep -q {{ ceph_rbd_mirror_remote_user }}"
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: mirror_peer
|
|
|
|
|
2019-09-05 02:35:20 +08:00
|
|
|
- name: add a mirroring peer
|
2019-09-10 02:18:49 +08:00
|
|
|
shell: "{{ docker_exec_cmd | default('') }} rbd --cluster {{ cluster }} --keyring /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring --name client.rbd-mirror.{{ ansible_hostname }} mirror pool peer add {{ ceph_rbd_mirror_pool }} {{ ceph_rbd_mirror_remote_user }}@{{ ceph_rbd_mirror_remote_cluster }}"
|
2019-09-05 02:35:20 +08:00
|
|
|
changed_when: false
|
2019-10-15 23:32:40 +08:00
|
|
|
when: mirror_peer.rc == 1
|