2017-02-08 05:00:53 +08:00
|
|
|
#!/bin/bash
|
|
|
|
# {{ ansible_managed }}
|
|
|
|
|
2017-06-26 21:40:30 +08:00
|
|
|
|
|
|
|
#############
|
|
|
|
# FUNCTIONS #
|
|
|
|
#############
|
|
|
|
|
|
|
|
function create_dev_list {
|
|
|
|
local regex
|
|
|
|
local disks
|
|
|
|
regex="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
|
|
|
|
# we use the prepare container to find the partitions to expose
|
2017-07-07 23:46:31 +08:00
|
|
|
disks=$(docker logs ceph-osd-prepare-{{ ansible_hostname }}-devdev${1} |& grep -Eo /dev/disk/by-partuuid/${regex} | uniq)
|
2017-06-26 21:40:30 +08:00
|
|
|
for disk in $disks; do
|
|
|
|
DEVICES="--device $disk "
|
2017-02-08 05:00:53 +08:00
|
|
|
done
|
2017-06-26 21:40:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
create_dev_list $1
|
|
|
|
|
|
|
|
|
|
|
|
########
|
|
|
|
# MAIN #
|
|
|
|
########
|
2017-02-08 05:00:53 +08:00
|
|
|
|
|
|
|
/usr/bin/docker run \
|
|
|
|
--rm \
|
|
|
|
--net=host \
|
2017-06-26 21:40:30 +08:00
|
|
|
--privileged=true \
|
2017-04-19 17:12:04 +08:00
|
|
|
{% if ansible_distribution == 'Ubuntu' -%}
|
|
|
|
--security-opt apparmor:unconfined \
|
|
|
|
{% endif -%}
|
2017-02-08 05:00:53 +08:00
|
|
|
--pid=host \
|
2017-04-13 01:57:33 +08:00
|
|
|
{% if not containerized_deployment_with_kv -%}
|
2017-02-08 05:00:53 +08:00
|
|
|
-v /var/lib/ceph:/var/lib/ceph \
|
|
|
|
-v /etc/ceph:/etc/ceph \
|
|
|
|
{% else -%}
|
|
|
|
-e KV_TYPE={{kv_type}} \
|
|
|
|
-e KV_IP={{kv_endpoint}} \
|
|
|
|
-e KV_PORT={{kv_port}} \
|
|
|
|
{% endif -%}
|
2017-07-09 17:40:40 +08:00
|
|
|
-v /dev:/dev \
|
2017-02-08 05:00:53 +08:00
|
|
|
-v /etc/localtime:/etc/localtime:ro \
|
|
|
|
--device=/dev/${1} \
|
|
|
|
--device=/dev/${1}1 \
|
2017-07-27 23:05:59 +08:00
|
|
|
{% if dedicated_devices|length > 0 -%}
|
|
|
|
-e OSD_JOURNAL={{ dedicated_devices[0] }} \
|
2017-02-08 05:00:53 +08:00
|
|
|
{% else -%}
|
|
|
|
--device=/dev/${1}2 \
|
|
|
|
{% endif -%}
|
|
|
|
-e OSD_DEVICE=/dev/${1} \
|
|
|
|
{{ ceph_osd_docker_extra_env }} \
|
2017-02-20 17:03:49 +08:00
|
|
|
--name=ceph-osd-{{ ansible_hostname }}-dev${1} \
|
2017-06-26 21:40:30 +08:00
|
|
|
-e CEPH_DAEMON=OSD_CEPH_DISK_ACTIVATE \
|
2017-02-08 05:00:53 +08:00
|
|
|
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
|