mirror of https://github.com/ceph/ceph-ansible.git
64 lines
2.1 KiB
YAML
64 lines
2.1 KiB
YAML
|
---
|
||
|
## Deploy Ceph Oject Storage Daemon(s)
|
||
|
#
|
||
|
|
||
|
- name: Install dependancies
|
||
|
apt: pkg=parted state=present
|
||
|
|
||
|
- name: Copy OSD bootstrap key
|
||
|
copy: src=fetch/{{ hostvars[groups['mons'][0]]['ansible_hostname'] }}/var/lib/ceph/bootstrap-osd/ceph.keyring dest=/var/lib/ceph/bootstrap-osd/ceph.keyring owner=root group=root mode=600
|
||
|
when: cephx
|
||
|
|
||
|
- name: Set OSD bootstrap key permissions
|
||
|
file: path=/var/lib/ceph/bootstrap-osd/ceph.keyring mode=0600 owner=root group=root
|
||
|
when: cephx
|
||
|
|
||
|
# NOTE (leseb): current behavior of ceph-disk is to fail when the device is mounted "stderr: ceph-disk: Error: Device is mounted: /dev/sdb1"
|
||
|
# the return code is 1, which makes sense, however ideally if ceph-disk will detect a ceph partition
|
||
|
# it should exist we rc=0 and don't do anything unless we do something like --force
|
||
|
# As as a final word, I prefer to keep the partition check instead of running ceph-disk prepare with "ignore_errors: True"
|
||
|
# I believe it's safer
|
||
|
#
|
||
|
|
||
|
- name: If partition named 'ceph' exists
|
||
|
shell: parted {{ item }} print | egrep -sq '^ 1.*ceph'
|
||
|
ignore_errors: True
|
||
|
with_items: devices
|
||
|
register: parted
|
||
|
changed_when: False
|
||
|
|
||
|
# Prepare means
|
||
|
# - create GPT partition
|
||
|
# - mark the partition with the ceph type uuid
|
||
|
# - create a file system
|
||
|
# - mark the fs as ready for ceph consumption
|
||
|
# - entire data disk is used (one big partition)
|
||
|
# - a new partition is added to the journal disk (so it can be easily shared)
|
||
|
#
|
||
|
|
||
|
# 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
|
||
|
|
||
|
- name: Prepare OSD disk(s)
|
||
|
command: ceph-disk prepare {{ item.1 }} {{ journal_device }}
|
||
|
when: item.0.rc != 0
|
||
|
with_together:
|
||
|
- parted.results
|
||
|
- devices
|
||
|
|
||
|
# Activate means:
|
||
|
# - mount the volume in a temp location
|
||
|
# - allocate an osd id (if needed)
|
||
|
# - remount in the correct location /var/lib/ceph/osd/$cluster-$id
|
||
|
# - start ceph-osd
|
||
|
#
|
||
|
|
||
|
- name: Activate OSD(s)
|
||
|
command: ceph-disk activate {{ item }}1
|
||
|
with_items: devices
|
||
|
changed_when: False
|
||
|
|
||
|
- name: Start and add that the OSD service to the init sequence
|
||
|
service: name=ceph state=started enabled=yes
|