---
+- name: create /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}
+ file:
+ path: "/var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}"
+ state: directory
+ owner: "{{ ceph_uid }}"
+ group: "{{ ceph_uid }}"
+ mode: "{{ ceph_directories_mode }}"
+
- name: create rbd target log directories
file:
path: '/var/log/{{ item }}'
ExecStartPre=-/usr/bin/{{ container_binary }} stop rbd-target-api
{% endif %}
ExecStartPre=-/usr/bin/{{ container_binary }} rm rbd-target-api
+ExecStartPre=-/usr/bin/sh -c "if ! grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then mount -t configfs none /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
ExecStart=/usr/bin/{{ container_binary }} run --rm \
{% if container_binary == 'podman' %}
-d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
-v /lib/modules:/lib/modules \
-v /etc/ceph:/etc/ceph \
-v /var/log/rbd-target-api:/var/log/rbd-target-api:z \
- -e CLUSTER={{ cluster }} \
- -e CEPH_DAEMON=RBD_TARGET_API \
- -e CONTAINER_IMAGE={{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
+ -v /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}:/sys/kernel/config \
--name=rbd-target-api \
+ --entrypoint=/usr/bin/rbd-target-api \
{{ 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 %}
ExecStopPost=-/usr/bin/{{ container_binary }} stop rbd-target-api
{% endif %}
+ExecStopPost=-/usr/bin/sh -c "if grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then umount /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
KillMode=none
Restart=always
RestartSec=10s
ExecStartPre=-/usr/bin/{{ container_binary }} stop rbd-target-gw
{% endif %}
ExecStartPre=-/usr/bin/{{ container_binary }} rm rbd-target-gw
+ExecStartPre=-/usr/bin/sh -c "if ! grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then mount -t configfs none /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
ExecStart=/usr/bin/{{ container_binary }} run --rm \
{% if container_binary == 'podman' %}
-d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
-v /lib/modules:/lib/modules \
-v /etc/ceph:/etc/ceph \
-v /var/log/rbd-target-gw:/var/log/rbd-target-gw:z \
- -e CLUSTER={{ cluster }} \
- -e CEPH_DAEMON=RBD_TARGET_GW \
- -e CONTAINER_IMAGE={{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
+ -v /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}:/sys/kernel/config \
--name=rbd-target-gw \
+ --entrypoint=/usr/bin/rbd-target-gw \
{{ 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 %}
ExecStopPost=-/usr/bin/{{ container_binary }} stop rbd-target-gw
{% endif %}
+ExecStopPost=-/usr/bin/sh -c "if grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then umount /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
KillMode=none
Restart=always
RestartSec=10s
ExecStartPre=-/usr/bin/{{ container_binary }} stop tcmu-runner
{% endif %}
ExecStartPre=-/usr/bin/{{ container_binary }} rm tcmu-runner
+ExecStartPre=-/usr/bin/sh -c "if ! grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then mount -t configfs none /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
ExecStart=/usr/bin/{{ container_binary }} run --rm \
{% if container_binary == 'podman' %}
-d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
-v /lib/modules:/lib/modules \
-v /etc/ceph:/etc/ceph \
-v /var/log/tcmu-runner:/var/log/tcmu-runner:z \
- -e CLUSTER={{ cluster }} \
- -e CEPH_DAEMON=TCMU_RUNNER \
- -e CONTAINER_IMAGE={{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
+ -v /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}:/sys/kernel/config \
--name=tcmu-runner \
- {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
+ --entrypoint=tcmu-runner \
+ {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
+ --tcmu-log-dir /var/log/tcmu-runner
{% if container_binary == 'podman' %}
ExecStop=-/usr/bin/sh -c "/usr/bin/{{ container_binary }} rm -f `cat /%t/%n-cid`"
{% else %}
ExecStopPost=-/usr/bin/{{ container_binary }} stop tcmu-runner
{% endif %}
+ExecStopPost=-/usr/bin/sh -c "if grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then umount /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
KillMode=none
Restart=always
RestartSec=10s