2017-02-08 05:00:53 +08:00
|
|
|
#!/bin/bash
|
|
|
|
# {{ ansible_managed }}
|
|
|
|
|
2018-07-17 00:09:33 +08:00
|
|
|
|
2017-06-26 21:40:30 +08:00
|
|
|
########
|
|
|
|
# MAIN #
|
|
|
|
########
|
2019-04-05 21:45:28 +08:00
|
|
|
{% set cpu_limit = ansible_processor_vcpus|int if ceph_osd_docker_cpu_limit|int > ansible_processor_vcpus|int else ceph_osd_docker_cpu_limit|int %}
|
2017-02-08 05:00:53 +08:00
|
|
|
|
2019-03-09 16:24:46 +08:00
|
|
|
{% if ceph_osd_numactl_opts != "" %}
|
|
|
|
numactl \
|
|
|
|
{{ ceph_osd_numactl_opts }} \
|
|
|
|
{% endif %}
|
2018-11-08 17:02:37 +08:00
|
|
|
/usr/bin/{{ container_binary }} run \
|
2017-02-08 05:00:53 +08:00
|
|
|
--rm \
|
|
|
|
--net=host \
|
2017-06-26 21:40:30 +08:00
|
|
|
--privileged=true \
|
2019-02-14 17:23:19 +08:00
|
|
|
--pid=host \
|
2019-02-28 20:13:35 +08:00
|
|
|
--ipc=host \
|
2019-02-25 22:19:44 +08:00
|
|
|
{% if osd_objectstore == 'filestore' -%}
|
2017-09-06 16:53:30 +08:00
|
|
|
--memory={{ ceph_osd_docker_memory_limit }} \
|
2019-02-25 22:19:44 +08:00
|
|
|
{% endif -%}
|
2018-11-27 00:22:04 +08:00
|
|
|
{% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
|
2019-04-05 21:45:28 +08:00
|
|
|
--cpus={{ cpu_limit }} \
|
2017-09-06 16:53:30 +08:00
|
|
|
{% else -%}
|
2019-04-05 21:45:28 +08:00
|
|
|
--cpu-quota={{ cpu_limit * 100000 }} \
|
2017-09-06 16:53:30 +08:00
|
|
|
{% endif -%}
|
2017-12-12 05:17:22 +08:00
|
|
|
{% if ceph_osd_docker_cpuset_cpus is defined -%}
|
|
|
|
--cpuset-cpus='{{ ceph_osd_docker_cpuset_cpus }}' \
|
|
|
|
{% endif -%}
|
|
|
|
{% if ceph_osd_docker_cpuset_mems is defined -%}
|
|
|
|
--cpuset-mems='{{ ceph_osd_docker_cpuset_mems }}' \
|
|
|
|
{% endif -%}
|
2017-07-25 23:54:26 +08:00
|
|
|
-v /dev:/dev \
|
|
|
|
-v /etc/localtime:/etc/localtime:ro \
|
2018-04-17 21:32:53 +08:00
|
|
|
-v /var/lib/ceph:/var/lib/ceph:z \
|
|
|
|
-v /etc/ceph:/etc/ceph:z \
|
2018-04-12 21:52:30 +08:00
|
|
|
-v /var/run/ceph:/var/run/ceph:z \
|
2019-06-04 01:15:30 +08:00
|
|
|
-v /var/run/udev/:/var/run/udev/ \
|
2017-04-19 17:12:04 +08:00
|
|
|
{% if ansible_distribution == 'Ubuntu' -%}
|
|
|
|
--security-opt apparmor:unconfined \
|
|
|
|
{% endif -%}
|
2018-11-30 18:20:03 +08:00
|
|
|
{% if dmcrypt -%}
|
2017-07-25 23:54:26 +08:00
|
|
|
-e OSD_DMCRYPT=1 \
|
2018-11-30 18:20:03 +08:00
|
|
|
{% else -%}
|
2017-07-25 23:54:26 +08:00
|
|
|
-e OSD_DMCRYPT=0 \
|
2017-02-08 05:00:53 +08:00
|
|
|
{% endif -%}
|
2017-07-25 23:54:26 +08:00
|
|
|
-e CLUSTER={{ cluster }} \
|
2017-10-23 21:57:24 +08:00
|
|
|
{% if (ceph_tcmalloc_max_total_thread_cache | int) > 0 and osd_objectstore == 'filestore' -%}
|
|
|
|
-e TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES={{ ceph_tcmalloc_max_total_thread_cache }} \
|
|
|
|
{% endif -%}
|
2019-01-16 17:27:23 +08:00
|
|
|
-v /run/lvm/:/run/lvm/ \
|
2018-07-09 22:58:35 +08:00
|
|
|
-e CEPH_DAEMON=OSD_CEPH_VOLUME_ACTIVATE \
|
2018-09-29 00:07:08 +08:00
|
|
|
-e OSD_ID="$1" \
|
|
|
|
--name=ceph-osd-"$1" \
|
2017-02-08 05:00:53 +08:00
|
|
|
{{ ceph_osd_docker_extra_env }} \
|
|
|
|
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
|