]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-osd: re-arrange osd scenario numbers 891/head
authorSébastien Han <seb@redhat.com>
Tue, 19 Jul 2016 15:55:57 +0000 (17:55 +0200)
committerSébastien Han <seb@redhat.com>
Mon, 8 Aug 2016 13:55:12 +0000 (15:55 +0200)
Signed-off-by: Sébastien Han <seb@redhat.com>
group_vars/osds.sample
roles/ceph-common/tasks/checks/check_mandatory_vars.yml
roles/ceph-osd/defaults/main.yml
roles/ceph-osd/tasks/activate_osds.yml
roles/ceph-osd/tasks/main.yml
roles/ceph-osd/tasks/pre_requisite.yml
roles/ceph-osd/tasks/scenarios/dmcrypt-dedicated-journal.yml [new file with mode: 0644]
roles/ceph-osd/tasks/scenarios/dmcrypt-journal-colocation.yml [new file with mode: 0644]
roles/ceph-osd/tasks/scenarios/dmcrypt.yml [deleted file]

index 458300e208d8bb86512b352b16a7fe0b6d5ac70b..b2241ba04f8ac4810bec6fb399ab3301268a7820 100644 (file)
@@ -85,13 +85,7 @@ dummy:
 #journal_collocation: false
 
 
-# II. Second scenario: single journal device for N OSDs
-# Use 'true' to enable this scenario
-
-# deprecated, please use scenario III with a single raw_journal_device
-
-
-# III. Third scenario: N journal devices for N OSDs
+# II. N journal devices for N OSDs
 # Use 'true' to enable this scenario
 #
 # In the following example:
@@ -109,7 +103,7 @@ dummy:
 #  - /dev/sdc
 
 
-# IV. Fourth scenario: use directory instead of disk for OSDs
+# III. Use directory instead of disk for OSDs
 # Use 'true' to enable this scenario
 
 #osd_directory: false
@@ -118,15 +112,24 @@ dummy:
 #  - /var/lib/ceph/osd/mydir2
 
 
-# V. Fith scenario: this will partition disks for BlueStore
+# IV. This will partition disks for BlueStore
 # Use 'true' to enable this scenario
 #bluestore: false
 
 
-# VI. Sixth scenario: encrypt osd data and/or journal devices with dm-crypt.
+# V. Encrypt osd data and/or journal devices with dm-crypt.
+# Keys are stored into the monitors k/v store
+# Use 'true' to enable this scenario
+# Both journal and data are stored on the same dm-crypt encrypted device
+#dmcrypt_journal_colocation: false
+
+
+# VI. Encrypt osd data and/or journal devices with dm-crypt.
 # Keys are stored into the monitors k/v store
 # Use 'true' to enable this scenario
-#dmcrypt: false
+# Journal and osd data are separated, each with their own dm-crypt device
+# You must use raw_journal_devices and set your journal devices
+#dmcrypt_dedicated_journal: false
 
 
 ##########
index 43be97554645de51b8ac1309775ff2489450e01b..8f7cfa1af11897dff9eae7a90b3df09397ad3bf8 100644 (file)
@@ -72,7 +72,8 @@
     - not raw_multi_journal
     - not osd_directory
     - not bluestore
-    - not dmcrypt
+    - not dmcrypt_journal_colocation
+    - not dmcrypt_dedicated_journal
 
 - name: verify only one osd scenario was chosen
   fail:
       or (raw_multi_journal and osd_directory)
       or (raw_multi_journal and bluestore)
       or (osd_directory and bluestore)
-      or (dmcrypt and journal_collocation)
-      or (dmcrypt and raw_multi_journal)
-      or (dmcrypt and osd_directory)
-      or (dmcrypt and bluestore)
+      or (dmcrypt_journal_colocation and journal_collocation)
+      or (dmcrypt_journal_colocation and raw_multi_journal)
+      or (dmcrypt_journal_colocation and osd_directory)
+      or (dmcrypt_journal_colocation and bluestore)
+      or (dmcrypt_dedicated_journal and journal_collocation)
+      or (dmcrypt_dedicated_journal and raw_multi_journal)
+      or (dmcrypt_dedicated_journal and osd_directory)
+      or (dmcrypt_dedicated_journal and bluestore)
 
 - name: verify devices have been provided
   fail:
index b53f7e8cfeed4b8e214403b94781846fade7c5ff..f2927b56ec7ea3e1f920f47f633081db64db4fc7 100644 (file)
@@ -77,13 +77,7 @@ osd_auto_discovery: false
 journal_collocation: false
 
 
-# II. Second scenario: single journal device for N OSDs
-# Use 'true' to enable this scenario
-
-# deprecated, please use scenario III with a single raw_journal_device
-
-
-# III. Third scenario: N journal devices for N OSDs
+# II. N journal devices for N OSDs
 # Use 'true' to enable this scenario
 #
 # In the following example:
@@ -101,7 +95,7 @@ raw_multi_journal: false
 #  - /dev/sdc
 
 
-# IV. Fourth scenario: use directory instead of disk for OSDs
+# III. Use directory instead of disk for OSDs
 # Use 'true' to enable this scenario
 
 osd_directory: false
@@ -110,15 +104,24 @@ osd_directory: false
 #  - /var/lib/ceph/osd/mydir2
 
 
-# V. Fith scenario: this will partition disks for BlueStore
+# IV. This will partition disks for BlueStore
 # Use 'true' to enable this scenario
 bluestore: false
 
 
-# VI. Sixth scenario: encrypt osd data and/or journal devices with dm-crypt.
+# V. Encrypt osd data and/or journal devices with dm-crypt.
+# Keys are stored into the monitors k/v store
+# Use 'true' to enable this scenario
+# Both journal and data are stored on the same dm-crypt encrypted device
+dmcrypt_journal_colocation: false
+
+
+# VI. Encrypt osd data and/or journal devices with dm-crypt.
 # Keys are stored into the monitors k/v store
 # Use 'true' to enable this scenario
-dmcrypt: false
+# Journal and osd data are separated, each with their own dm-crypt device
+# You must use raw_journal_devices and set your journal devices
+dmcrypt_dedicated_journal: false
 
 
 ##########
index 34dde8f5ef6835ed352e8ee3d5e282c0de2320e9..4219e005ffed66c39f90d5530d610f7ac80910aa 100644 (file)
     - not item.0.get("skipped")
     - item.0.get("rc", 0) != 0
     - not osd_auto_discovery
+    - raw_multi_journal
+
+- name: automatically activate osd disk(s) without partitions (dmcrypt)
+  command: ceph-disk activate --dmcrypt "/dev/{{ item.key }}"
+  ignore_errors: true
+  with_dict: ansible_devices
+  when:
+    - ansible_devices is defined
+    - item.value.removable == "0"
+    - item.value.partitions|count == 0
+    - osd_auto_discovery
+    - dmcrypt_journal_colocation
+
+- name: activate osd(s) when device is a disk (dmcrypt)
+  command: ceph-disk activate --dmcrypt {{ item.1 | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
+  with_together:
+    - combined_ispartition_results.results
+    - devices
+  changed_when: false
+  failed_when: false
+  register: activate_osd_disk_dmcrypt
+  when:
+    - not item.0.get("skipped")
+    - item.0.get("rc", 0) != 0
+    - not osd_auto_discovery
+    - dmcrypt_dedicated_journal
+
+# NOTE (leseb): we must do this because of
+# https://github.com/ansible/ansible/issues/4297
+- name: combine ispartition results
+  set_fact:
+    combined_activate_osd_disk_results: "{{ activate_osd_disk if not dmcrypt_journal_colocation else activate_osd_disk_dmcrypt }}"
 
 - name: fail if ceph-disk cannot create an OSD
   fail:
     msg: "ceph-disk failed to create an OSD"
   when:
     " 'ceph-disk: Error: ceph osd create failed' in item.get('stderr', '') "
-  with_items: "{{activate_osd_disk.results}}"
+  with_items: "{{combined_activate_osd_disk_results.results}}"
 
 # NOTE (leseb): this task is for partitions because we don't explicitly use a partition.
 - name: activate osd(s) when device is a partition
index 76bc44cdbb69b9c17687e5bba2e176eba0757e2b..d965a558c86cf7e86a01bc4621a85bbb9a67f095 100644 (file)
     - osd_objectstore == 'bluestore'
     - not osd_containerized_deployment
 
-- include: ./scenarios/dmcrypt.yml
+- include: ./scenarios/dmcrypt-journal-colocation.yml
   when:
-    - dmcrypt
+    - dmcrypt_journal_colocation
+    - not osd_containerized_deployment
+
+- include: ./scenarios/dmcrypt-dedicated-journal.yml
+  when:
+    - dmcrypt_dedicated_journal
     - not osd_containerized_deployment
 
 - include: ./docker/main.yml
index 64430f0f861df1733e4c8e5b6039a02eaf7da5d3..9e2afda17ad03c76038755bc874f92cb534f2d45 100644 (file)
   when:
     cephx
 
+- name: copy ceph admin key when using dmcrypt
+  set_fact:
+    copy_admin_key: true
+  when:
+    - dmcrypt_journal_colocation or dmcrypt_dedicated_journal
+
 - name: copy osd bootstrap key
   copy:
     src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}"
diff --git a/roles/ceph-osd/tasks/scenarios/dmcrypt-dedicated-journal.yml b/roles/ceph-osd/tasks/scenarios/dmcrypt-dedicated-journal.yml
new file mode 100644 (file)
index 0000000..effc39d
--- /dev/null
@@ -0,0 +1,29 @@
+---
+## SCENARIO 6: DMCRYPT N JOURNAL DEVICES FOR N OSDS
+
+- include: ../check_devices.yml
+
+# NOTE (leseb): the prepare process must be parallelized somehow...
+# if you have 64 disks with 4TB each, this will take a while
+# since Ansible will sequential process the loop
+
+# NOTE (alahouze): if the device is a partition, the parted command below has
+# failed, this is why we check if the device is a partition too.
+- name: prepare osd disk(s)
+  command: "ceph-disk prepare --dmcrypt --cluster {{ cluster }} {{ item.2 }} {{ item.3 }}"
+  with_together:
+    - combined_parted_results.results
+    - combined_ispartition_results.results
+    - devices
+    - raw_journal_devices
+  changed_when: false
+  when:
+    - not item.0.get("skipped")
+    - not item.1.get("skipped")
+    - item.0.get("rc", 0) != 0
+    - item.1.get("rc", 0) != 0
+    - raw_multi_journal
+    - not osd_auto_discovery
+    - dmcrypt_dedicated_journal
+
+- include: ../activate_osds.yml
diff --git a/roles/ceph-osd/tasks/scenarios/dmcrypt-journal-colocation.yml b/roles/ceph-osd/tasks/scenarios/dmcrypt-journal-colocation.yml
new file mode 100644 (file)
index 0000000..534fd3c
--- /dev/null
@@ -0,0 +1,36 @@
+---
+## SCENARIO 5: DMCRYPT
+
+- include: ../check_devices.yml
+
+# NOTE (leseb): the prepare process must be parallelized somehow...
+# if you have 64 disks with 4TB each, this will take a while
+# since Ansible will sequential process the loop
+
+# NOTE (alahouze): if the device is a partition, the parted command below has
+# failed, this is why we check if the device is a partition too.
+- name: automatic prepare osd disk(s) without partitions (dmcrypt)
+  command: ceph-disk prepare --dmcrypt --cluster "{{ cluster }}" "/dev/{{ item.key }}"
+  with_dict: ansible_devices
+  when:
+    - ansible_devices is defined
+    - item.value.removable == "0"
+    - item.value.partitions|count == 0
+    - dmcrypt_journal_colocation
+    - osd_auto_discovery
+
+- name: manually prepare osd disk(s) (dmcrypt)
+  command: ceph-disk prepare --dmcrypt --cluster "{{ cluster }}" "{{ item.2 }}"
+  with_together:
+    - combined_parted_results.results
+    - combined_ispartition_results.results
+    - devices
+  when:
+    - not item.0.get("skipped")
+    - not item.1.get("skipped")
+    - item.0.get("rc", 0) != 0
+    - item.1.get("rc", 0) != 0
+    - dmcrypt_journal_colocation
+    - not osd_auto_discovery
+
+- include: ../activate_osds.yml
diff --git a/roles/ceph-osd/tasks/scenarios/dmcrypt.yml b/roles/ceph-osd/tasks/scenarios/dmcrypt.yml
deleted file mode 100644 (file)
index 835b7e4..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
----
-## SCENARIO 5: DMCRYPT
-
-- include: ../check_devices.yml
-
-# NOTE (leseb): the prepare process must be parallelized somehow...
-# if you have 64 disks with 4TB each, this will take a while
-# since Ansible will sequential process the loop
-
-# NOTE (alahouze): if the device is a partition, the parted command below has
-# failed, this is why we check if the device is a partition too.
-- name: automatic prepare osd disk(s) without partitions
-  command: ceph-disk prepare --dmcrypt --cluster "{{ cluster }}" "/dev/{{ item.key }}"
-  register: prepared_osds
-  with_dict: ansible_devices
-  when:
-    - ansible_devices is defined
-    - item.value.removable == "0"
-    - item.value.partitions|count == 0
-    - bluestore
-    - osd_auto_discovery
-
-- name: manually prepare osd disk(s)
-  command: ceph-disk prepare --dmcrypt --cluster "{{ cluster }}" "{{ item.2 }}"
-  with_together:
-    - combined_parted_results.results
-    - combined_ispartition_results.results
-    - devices
-  when:
-    - not item.0.get("skipped")
-    - not item.1.get("skipped")
-    - item.0.get("rc", 0) != 0
-    - item.1.get("rc", 0) != 0
-    - bluestore
-    - not osd_auto_discovery
-
-- include: ../activate_osds.yml