kolla-ansible/ansible/roles/ceph/tasks/bootstrap_osds.yml
Stephen Hindle cadf8afdcf Read GPT label using sgdisk rather than udev
The Ceph osd bootstrap/startup logic depends upon reading/writing
partition names.  Some older versions of udev have trouble reading these
(/dev/disk/by-label is missing).

To work around this, we shell out to sgdisk and scrape the partition
name data directly.

Co-authored-by: Paul Bourke <paul.bourke@oracle.com>
Closes-Bug: 1585185
Change-Id: I362b3f8e91de79687fc84e256996fbcaf303b6af
2016-07-07 10:26:34 +01:00

88 lines
3.7 KiB
YAML

---
- name: Looking up disks to bootstrap for Ceph OSDs
command: docker exec -t kolla_toolbox sudo -E /usr/bin/ansible localhost
-m find_disks
-a "partition_name='KOLLA_CEPH_OSD_BOOTSTRAP' match_mode='prefix'"
register: osd_lookup
changed_when: "{{ osd_lookup.stdout.find('localhost | SUCCESS => ') != -1 and (osd_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
failed_when: osd_lookup.stdout.split()[2] != 'SUCCESS'
- name: Parsing disk info for Ceph OSDs
set_fact:
osds_bootstrap: "{{ (osd_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).disks|from_json }}"
- name: Looking up disks to bootstrap for Ceph Cache OSDs
command: docker exec -t kolla_toolbox sudo -E /usr/bin/ansible localhost
-m find_disks
-a "partition_name='KOLLA_CEPH_OSD_CACHE_BOOTSTRAP' match_mode='prefix'"
register: osd_cache_lookup
changed_when: "{{ osd_cache_lookup.stdout.find('localhost | SUCCESS => ') != -1 and (osd_cache_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
failed_when: osd_cache_lookup.stdout.split()[2] != 'SUCCESS'
- name: Parsing disk info for Ceph Cache OSDs
set_fact:
osds_cache_bootstrap: "{{ (osd_cache_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).disks|from_json }}"
- name: Bootstrapping Ceph OSDs
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
detach: False
environment:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
OSD_DEV: "{{ item.1.device }}"
OSD_PARTITION: "{{ item.1.partition }}"
OSD_PARTITION_NUM: "{{ item.1.partition_num }}"
JOURNAL_DEV: "{{ item.1.journal_device }}"
JOURNAL_PARTITION: "{{ item.1.journal }}"
JOURNAL_PARTITION_NUM: "{{ item.1.journal_num }}"
USE_EXTERNAL_JOURNAL: "{{ item.1.external_journal | bool }}"
OSD_FILESYSTEM: "{{ ceph_osd_filesystem }}"
OSD_INITIAL_WEIGHT: "{{ osd_initial_weight }}"
HOSTNAME: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}"
image: "{{ ceph_osd_image_full }}"
labels:
BOOTSTRAP:
name: "bootstrap_osd_{{ item.0 }}"
privileged: True
restart_policy: "never"
volumes:
- "{{ node_config_directory }}/ceph-osd/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "/dev/:/dev/"
- "kolla_logs:/var/log/kolla/"
with_indexed_items: "{{ osds_bootstrap|default([]) }}"
- name: Bootstrapping Ceph Cache OSDs
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
detach: False
environment:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
CEPH_CACHE:
OSD_DEV: "{{ item.1.device }}"
OSD_PARTITION: "{{ item.1.partition }}"
OSD_PARTITION_NUM: "{{ item.1.partition_num }}"
JOURNAL_DEV: "{{ item.1.journal_device }}"
JOURNAL_PARTITION: "{{ item.1.journal }}"
JOURNAL_PARTITION_NUM: "{{ item.1.journal_num }}"
USE_EXTERNAL_JOURNAL: "{{ item.1.external_journal | bool }}"
OSD_FILESYSTEM: "{{ ceph_osd_filesystem }}"
OSD_INITIAL_WEIGHT: "{{ osd_initial_weight }}"
HOSTNAME: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}"
image: "{{ ceph_osd_image_full }}"
labels:
BOOTSTRAP:
name: "bootstrap_osd_cache_{{ item.0 }}"
privileged: True
restart_policy: "never"
volumes:
- "{{ node_config_directory }}/ceph-osd/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "/dev/:/dev/"
- "kolla_logs:/var/log/kolla/"
with_indexed_items: "{{ osds_cache_bootstrap|default([]) }}"