Merge pull request #89 from Sysnove/partitions

Allow devices to be partition instead of disks
pull/95/head
Leseb 2014-07-08 10:27:11 +02:00
commit e8d60215cd
3 changed files with 105 additions and 18 deletions

View File

@ -21,6 +21,13 @@
# I believe it's safer
#
- name: Check if the device is a partition or a disk
shell: echo '{{ item }}' | egrep '/dev/[a-z]{3}[0-9]$'
ignore_errors: true
with_items: devices
register: ispartition
changed_when: False
- name: If partition named 'ceph' exists
shell: parted --script {{ item }} print | egrep -sq '^ 1.*ceph'
ignore_errors: True
@ -29,7 +36,7 @@
changed_when: False
# Prepare means
# - create GPT partition
# - create GPT partition for a disk, or a loop label for a partition
# - mark the partition with the ceph type uuid
# - create a file system
# - mark the fs as ready for ceph consumption
@ -41,12 +48,16 @@
# 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 {{ item.1 }}
when: item.0.rc != 0 and journal_collocation
command: ceph-disk prepare {{ item.2 }}
when: (item.0.rc != 0 or item.1.rc != 0) and journal_collocation
ignore_errors: True
with_together:
- parted.results
- ispartition.results
- devices
# Activate means:
@ -56,9 +67,27 @@
# - start ceph-osd
#
- name: Activate OSD(s)
command: ceph-disk activate {{ item }}1
with_items: devices
# This task is for disk devices only because of the explicit use of the first
# partition.
- name: Activate OSD(s) when device is a disk
command: ceph-disk activate {{ item.2 }}1
with_together:
- parted.results
- ispartition.results
- devices
when: item.0.rc == 0 and item.1.rc != 0
ignore_errors: True
changed_when: False
# This task is for partitions because we don't explicitly use a partition.
- name: Activate OSD(s) when device is a partition
command: ceph-disk activate {{ item.1 }}
with_together:
- ispartition.results
- devices
when: item.0.rc == 0
ignore_errors: True
changed_when: False

View File

@ -21,6 +21,13 @@
# I believe it's safer
#
- name: Check if the device is a partition or a disk
shell: echo '{{ item }}' | egrep '/dev/[a-z]{3}[0-9]$'
ignore_errors: true
with_items: devices
register: ispartition
changed_when: False
- name: If partition named 'ceph' exists
shell: parted --script {{ item }} print | egrep -sq '^ 1.*ceph'
ignore_errors: True
@ -29,7 +36,7 @@
changed_when: False
# Prepare means
# - create GPT partition
# - create GPT partition for a disk, or a loop label for a partition
# - mark the partition with the ceph type uuid
# - create a file system
# - mark the fs as ready for ceph consumption
@ -41,12 +48,16 @@
# 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 {{ item.1 }} {{ raw_journal_device }}
when: item.0.rc != 0 and raw_journal
command: ceph-disk prepare {{ item.2 }} {{ raw_journal_device }}
when: (item.0.rc != 0 or item.1.rc != 0) and raw_journal
ignore_errors: True
with_together:
- parted.results
- ispartition.results
- devices
# Activate means:
@ -56,9 +67,27 @@
# - start ceph-osd
#
- name: Activate OSD(s)
command: ceph-disk activate {{ item }}1
with_items: devices
# This task is for disk devices only because of the explicit use of the first
# partition.
- name: Activate OSD(s) when device is a disk
command: ceph-disk activate {{ item.2 }}1
with_together:
- parted.results
- ispartition.results
- devices
when: item.0.rc == 0 and item.1.rc != 0
ignore_errors: True
changed_when: False
# This task is for partitions because we don't explicitly use a partition.
- name: Activate OSD(s) when device is a partition
command: ceph-disk activate {{ item.1 }}
with_together:
- ispartition.results
- devices
when: item.0.rc == 0
ignore_errors: True
changed_when: False

View File

@ -21,6 +21,13 @@
# I believe it's safer
#
- name: Check if the device is a partition or a disk
shell: echo '{{ item }}' | egrep '/dev/[a-z]{3}[0-9]$'
ignore_errors: true
with_items: devices
register: ispartition
changed_when: False
- name: If partition named 'ceph' exists
shell: parted --script {{ item }} print | egrep -sq '^ 1.*ceph'
ignore_errors: True
@ -29,7 +36,7 @@
changed_when: False
# Prepare means
# - create GPT partition
# - create GPT partition for a disk, or a loop label for a partition
# - mark the partition with the ceph type uuid
# - create a file system
# - mark the fs as ready for ceph consumption
@ -41,12 +48,16 @@
# 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 {{ item.1 }} {{ item.2 }}
when: item.0.rc != 0 and raw_multi_journal
command: ceph-disk prepare {{ item.2 }} {{ item.3 }}
when: (item.0.rc != 0 or item.1.rc != 0) and raw_multi_journal
ignore_errors: True
with_together:
- parted.results
- ispartition.results
- devices
- raw_journal_devices
@ -57,9 +68,27 @@
# - start ceph-osd
#
- name: Activate OSD(s)
command: ceph-disk activate {{ item }}1
with_items: devices
# This task is for disk devices only because of the explicit use of the first
# partition.
- name: Activate OSD(s) when device is a disk
command: ceph-disk activate {{ item.2 }}1
with_together:
- parted.results
- ispartition.results
- devices
when: item.0.rc == 0 and item.1.rc != 0
ignore_errors: True
changed_when: False
# This task is for partitions because we don't explicitly use a partition.
- name: Activate OSD(s) when device is a partition
command: ceph-disk activate {{ item.1 }}
with_together:
- ispartition.results
- devices
when: item.0.rc == 0
ignore_errors: True
changed_when: False