# {{ 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 {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid {% else %} ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-osd-%i {% endif %} 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 \ {% if container_binary == 'podman' %} -d --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \ {% endif %} --rm \ --net=host \ --privileged=true \ --pid=host \ --ipc=host \ {% if osd_objectstore == 'filestore' -%} --memory={{ ceph_osd_docker_memory_limit }} \ {% endif -%} --cpus={{ cpu_limit }} \ {% 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 }} {% if container_binary == 'podman' %} ExecStop=-/usr/bin/sh -c "/usr/bin/{{ container_binary }} rm -f `cat /%t/%n-cid`" {% else %} ExecStop=-/usr/bin/{{ container_binary }} stop ceph-osd-%i {% endif %} KillMode=none Restart=always RestartSec=10s TimeoutStartSec=120 TimeoutStopSec=15 {% if container_binary == 'podman' %} Type=forking PIDFile=/%t/%n-pid {% endif %} [Install] WantedBy=multi-user.target