#!/bin/sh
T=$1
N=$2

# start nfs-ganesha
/usr/bin/{{ container_binary }} run --rm --net=host \
{% if container_binary == 'podman' %}
  -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
{% endif %}
--pids-limit={{ 0 if container_binary == 'podman' else -1 }} \
-v /var/lib/ceph:/var/lib/ceph:z \
-v /etc/ceph:/etc/ceph:z \
-v /var/lib/nfs/ganesha:/var/lib/nfs/ganesha:z \
-v /etc/ganesha:/etc/ganesha:z \
-v /var/run/ceph:/var/run/ceph:z \
-v /var/log/ceph:/var/log/ceph:z \
-v /var/log/ganesha:/var/log/ganesha:z \
{% if ceph_nfs_dynamic_exports | bool %}
--privileged \
-v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket \
{% endif -%}
-v /etc/localtime:/etc/localtime:ro \
{{ ceph_nfs_docker_extra_env }} \
--entrypoint=/usr/bin/ganesha.nfsd \
--name=ceph-nfs-{{ ceph_nfs_service_suffix | default(ansible_facts['hostname']) }} \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-F -L STDOUT "${GANESHA_EPOCH}"
