ceph-ansible/roles/ceph-osd/tasks/activate_osds.yml

65 lines
1.8 KiB
YAML

---
# NOTE (leseb) : 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.1 | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
with_together:
- ispartition.results
- devices
changed_when: false
failed_when: false
when: item.0.rc != 0
# NOTE (leseb): 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
changed_when: false
failed_when: false
when: item.0.rc == 0
- include: osd_fragment.yml
when: crush_location
- name: start and add that the osd service(s) to the init sequence (before infernalis)
service:
name: ceph
state: started
enabled: yes
when:
ansible_distribution != "Ubuntu" and
not is_ceph_infernalis
- name: get osd id (for or after infernalis)
shell: "ls /var/lib/ceph/osd/ |grep -oh '[0-9]*'"
changed_when: false
failed_when: false
register: osd_id
when:
ansible_distribution != "Ubuntu" and
is_ceph_infernalis
- name: enable osd service instance(s) (for or after infernalis)
file:
src: /usr/lib/systemd/system/ceph-osd@.service
dest: /etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item }}.service
state: link
with_items: osd_id.stdout_lines
failed_when: false
when:
ansible_distribution != "Ubuntu" and
is_ceph_infernalis
- name: start and add that the osd service(s) to the init sequence (for or after infernalis)
service:
name: ceph-osd@{{ item }}
state: started
enabled: yes
with_items: osd_id.stdout_lines
changed_when: false
when:
ansible_distribution != "Ubuntu" and
is_ceph_infernalis