]> 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>
Fri, 6 Sep 2019 15:00:55 +0000 (11:00 -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>
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 d2ae318fb0f0b9990be3e8afc335dd493ccb5634..862574b77b2463a121b70e8a032b86d82c576432 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 a352b8073ca9f0d9e30a31e00d9e695237909f37..0fbec12768fc8045ed972fb73ffdf2955f6f97e3 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 d93bd8e5deda2c42a5c7984a5e9934a59068dcdc..677c43d84d4700c8d97bdebb5c32ced330256b59 100644 (file)
@@ -1,4 +1,9 @@
 ---
-- name: add a peer
-  command: "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: "{{ container_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
+  command: "{{ container_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 e52cd68a7eb21266829ad78eb73a6c2aad5b0e6a..c7764cd8d5ae7ed843a36487d81e44978ee2c907 100644 (file)
@@ -8,14 +8,8 @@
   when: cephx | bool
 
 - name: tasks for non-containerized deployment
+  include_tasks: start_rbd_mirror.yml
   when: not containerized_deployment | bool
-  block:
-    - name: include start_rbd_mirror.yml
-      include_tasks: start_rbd_mirror.yml
-
-    - name: include configure_mirroring.yml
-      include_tasks: configure_mirroring.yml
-      when: ceph_rbd_mirror_configure | bool
 
 - name: tasks for containerized deployment
   when: containerized_deployment | bool
@@ -26,3 +20,7 @@
 
     - name: include container/main.yml
       include_tasks: container/main.yml
+
+- name: include configure_mirroring.yml
+  include_tasks: configure_mirroring.yml
+  when: ceph_rbd_mirror_configure | bool