# {{ ansible_managed }} [Unit] Description=Ceph OSD {% if container_binary == 'docker' %} After=docker.service Requires=docker.service {% else %} After=network.target {% endif %} {% 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 %} [Service] EnvironmentFile=-/etc/environment ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-osd-%i ExecStartPre=-/usr/bin/{{ container_binary }} rm -f ceph-osd-%i ExecStart={% if ceph_osd_numactl_opts != "" %} numactl \ {{ ceph_osd_numactl_opts }} \ {% endif %} /usr/bin/{{ container_binary }} run \ --rm \ --net=host \ --privileged=true \ --pid=host \ --ipc=host \ {% if osd_objectstore == 'filestore' -%} --memory={{ ceph_osd_docker_memory_limit }} \ {% endif -%} {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version('13', '>=')) or container_binary == 'podman' -%} --cpus={{ cpu_limit }} \ {% else -%} --cpu-quota={{ cpu_limit * 100000 }} \ {% endif -%} {% 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 -%} -v /dev:/dev \ -v /etc/localtime:/etc/localtime:ro \ -v /var/lib/ceph:/var/lib/ceph:z \ -v /etc/ceph:/etc/ceph:z \ -v /var/run/ceph:/var/run/ceph:z \ -v /var/run/udev/:/var/run/udev/ \ -v /var/log/ceph:/var/log/ceph:z \ {% if ansible_distribution == 'Ubuntu' -%} --security-opt apparmor:unconfined \ {% endif -%} {{ container_env_args }} \ -e CLUSTER={{ cluster }} \ {% 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 -%} -v /run/lvm/:/run/lvm/ \ -e CEPH_DAEMON=OSD_CEPH_VOLUME_ACTIVATE \ -e CONTAINER_IMAGE={{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \ -e OSD_ID=%i \ --name=ceph-osd-%i \ {{ ceph_osd_docker_extra_env }} \ {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} ExecStop=-/usr/bin/{{ container_binary }} stop ceph-osd-%i KillMode=none Restart=always RestartSec=10s TimeoutStartSec=120 TimeoutStopSec=15 [Install] WantedBy=multi-user.target