Files
kayobe/ansible/roles/kolla-ceph/tasks/config.yml
Mark Goddard c4ffd39478 Switch to generic package module
This makes platform independence easier. There are some cases where we
still use the yum module, where we use yum-specific module parameters.

Also switch use of the state 'installed' to 'present', which is
supported by all the package modules, whereas installed is supported by
the yum module only.

Change-Id: Id1cf845adc7aa6565a7a570569c9a81a478560f0
2019-12-09 10:21:20 +00:00

86 lines
2.5 KiB
YAML

---
- name: Ensure required packages are installed
package:
name: parted
state: present
become: True
when: ceph_disks | length > 0
- name: Check the presence of a partition on the OSD disks
become: True
parted:
device: "{{ item.osd }}"
with_items: "{{ ceph_disks }}"
register: "disk_osd_info"
- name: Check the presence of a partition on the journal disks
become: True
parted:
device: "{{ item.journal }}"
with_items: "{{ ceph_disks }}"
register: "disk_journal_info"
when:
- item.journal is defined
- name: Fail if the Ceph OSD disks have already a partition
fail:
msg: >
The physical disk {{ item.item }} already has a partition.
Ensure that each disk in 'ceph_disks' does not have any partitions.
with_items: "{{ disk_osd_info.results }}"
when:
- item.partitions | length > 0
- not item.partitions.0.name.startswith('KOLLA_CEPH')
loop_control:
label: "{{item.item}}"
- name: Fail if the Ceph journal disks have already a partition
fail:
msg: >
The physical disk {{ item.item }} already has a partition.
Ensure that each disk in 'ceph_disks' does not have any partitions.
with_items: "{{ disk_journal_info.results }}"
when:
- item is not skipped
- item.partitions | length > 0
- not item.partitions.0.name.startswith('KOLLA_CEPH')
loop_control:
label: "{{item.item}}"
- name: Create tag partition for Ceph OSD
become: True
parted:
device: "{{ item.item.osd }}"
number: 1
label: gpt
name: "{{ part_label }}"
state: present
with_items: "{{ disk_osd_info.results }}"
when: item.partitions | length == 0
loop_control:
label: "{{item.item}}"
vars:
part_label: "{% if item.item.journal is defined %}{{ part_label_with_journal }}{% else %}KOLLA_CEPH_OSD_BOOTSTRAP{% endif %}"
part_label_with_journal: "KOLLA_CEPH_OSD_BOOTSTRAP_{{ (osd_id | hash('md5'))[:9] }}"
osd_id: "{{ item.item.osd | basename }}{{ ansible_hostname }}"
- name: Create tag partition for Ceph external journal
become: True
parted:
device: "{{ item.item.journal }}"
number: 1
label: gpt
name: "{{ part_label }}"
state: present
with_items: "{{ disk_journal_info.results }}"
when:
- item is not skipped
- item.partitions | length == 0
loop_control:
label: "{{item.item}}"
vars:
part_label: "KOLLA_CEPH_OSD_BOOTSTRAP_{{ (osd_id | hash('md5'))[:9] }}_J"
osd_id: "{{ item.item.osd | basename }}{{ ansible_hostname }}"