]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
rbd-mirror: configure pool and peer
authorDimitri Savineau <dsavinea@redhat.com>
Wed, 4 Sep 2019 18:35:20 +0000 (14:35 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Mon, 9 Sep 2019 16:13:24 +0000 (12:13 -0400)
The rbd mirror configuration was only available for non containerized
deployment and was also imcomplete.
We now enable the mirroring on the pool and add the remote peer in both
scenarios.

The default mirroring mode is set to 'pool' but can be configured via
the ceph_rbd_mirror_mode variable.

This commit also fixes an issue on the rbd mirror command if the ceph
cluster name isn't using the default value (ceph) due to a missing
--cluster parameter to the command.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1665877
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 7e5e21741eb0143e3d981dc1891253ad331d9753)

group_vars/rbdmirrors.yml.sample
roles/ceph-rbd-mirror/defaults/main.yml
roles/ceph-rbd-mirror/tasks/configure_mirroring.yml
roles/ceph-rbd-mirror/tasks/main.yml

index 58e6f70160148cb12be913a94f86a90fd5aef5e1..a0a3a676985175fb494764ee3bf7de57c7f24a72 100644 (file)
@@ -30,6 +30,7 @@ dummy:
 
 #ceph_rbd_mirror_configure: false
 #ceph_rbd_mirror_pool: ""
+#ceph_rbd_mirror_mode: pool
 
 # NOTE (leseb): the following variable needs the name of the remote cluster.
 # The name of this cluster must be different than your local cluster simply
index c7f1172a35a77eab982b4bc5a6d3a29798f32687..afe7228a74283de0de99d1c041fd8e1f93d1a6a4 100644 (file)
@@ -22,6 +22,7 @@ ceph_rbd_mirror_local_user: "admin"
 
 ceph_rbd_mirror_configure: false
 ceph_rbd_mirror_pool: ""
+ceph_rbd_mirror_mode: pool
 
 # NOTE (leseb): the following variable needs the name of the remote cluster.
 # The name of this cluster must be different than your local cluster simply
index 66c32e19e396c0ae8377c9104ffcdda84133f66d..54163c20255cb8cbbb7c4b00f772516f36c5abd9 100644 (file)
@@ -1,3 +1,9 @@
 ---
-- name: add a peer
-  shell: "rbd mirror pool peer add {{ ceph_rbd_mirror_pool }} {{ ceph_rbd_mirror_remote_user }}@{{ ceph_rbd_mirror_remote_cluster }}"
+- name: enable mirroring on the pool
+  command: "{{ docker_exec_cmd | default('') }} rbd --cluster {{ cluster }} mirror pool enable {{ ceph_rbd_mirror_pool }} {{ ceph_rbd_mirror_mode }}"
+  changed_when: false
+
+- name: add a mirroring peer
+  shell: "{{ docker_exec_cmd | default('') }} rbd --cluster {{ cluster }} mirror pool peer add {{ ceph_rbd_mirror_pool }} {{ ceph_rbd_mirror_remote_user }}@{{ ceph_rbd_mirror_remote_cluster }}"
+  changed_when: false
+  failed_when: false
index 82a33975ddbc1405ee9aa4de6baf9b08af8ab2fe..70f55b3c738d878f5291729d6f9010c2f475f281 100644 (file)
   when:
     - not containerized_deployment
 
-- name: include configure_mirroring.yml
-  include_tasks: configure_mirroring.yml
-  when:
-    - ceph_rbd_mirror_configure
-    - not containerized_deployment
-
 - name: include docker/main.yml
   include_tasks: docker/main.yml
   when:
     - containerized_deployment
+
+- name: include configure_mirroring.yml
+  include_tasks: configure_mirroring.yml
+  when: ceph_rbd_mirror_configure | bool