]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Allow to override systemd service instance id 1983/head
authorJan Provaznik <jprovazn@redhat.com>
Wed, 4 Oct 2017 11:09:43 +0000 (13:09 +0200)
committerJan Provaznik <jprovazn@redhat.com>
Fri, 6 Oct 2017 06:20:37 +0000 (08:20 +0200)
It's useful to have constant service instance id when ceph-nfs
is managed by pacemaker.

group_vars/nfss.yml.sample
roles/ceph-defaults/templates/restart_nfs_daemon.sh.j2
roles/ceph-nfs/defaults/main.yml
roles/ceph-nfs/tasks/start_nfs.yml
roles/ceph-nfs/templates/ceph-nfs.service.j2

index eb0aa08a67b66c029f2d3c92aec4fa3ebe97ebfe..e2aacdc49249b62c13fdcc01b34c4ffc0786db72 100644 (file)
@@ -23,6 +23,13 @@ dummy:
 # service is managed by pacemaker
 #ceph_nfs_enable_service: true
 
+# ceph-nfs systemd service uses ansible's hostname as an instance id,
+# so service name is ceph-nfs@{{ ansible_hostname }}, this is not
+# ideal when ceph-nfs is managed by pacemaker across multiple hosts - in
+# such case it's better to have constant instance id instead which
+# can be set by 'ceph_nfs_service_suffix'
+# ceph_nfs_service_suffix: ansible_hostname
+
 #######################
 # Access type options #
 #######################
index cbc78e9899f5581d2c827387589353590aa0f7aa..22f974d98b0964a133eb01de30576bfb3def596d 100644 (file)
@@ -2,12 +2,12 @@
 
 RETRIES="{{ handler_health_nfs_check_retries }}"
 DELAY="{{ handler_health_nfs_check_delay }}"
-NFS_NAME="{{ ansible_hostname }}"
+NFS_NAME="ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }}"
 PID=/var/run/ganesha.pid
 
 # First, restart the daemon
 {% if containerized_deployment -%}
-systemctl restart ceph-nfs@${NFS_NAME}
+systemctl restart $NFS_NAME
 COUNT=10
 # Wait and ensure the pid exists after restarting the daemon
 while [ $RETRIES -ne 0 ]; do
index 6025d7e311dca62198f99aa5fce288de53882b25..d947c10039ca884cf7c56ee618f965c6a5bc5d77 100644 (file)
@@ -15,6 +15,13 @@ copy_admin_key: false
 # service is managed by pacemaker
 ceph_nfs_enable_service: true
 
+# ceph-nfs systemd service uses ansible's hostname as an instance id,
+# so service name is ceph-nfs@{{ ansible_hostname }}, this is not
+# ideal when ceph-nfs is managed by pacemaker across multiple hosts - in
+# such case it's better to have constant instance id instead which
+# can be set by 'ceph_nfs_service_suffix'
+# ceph_nfs_service_suffix: ansible_hostname
+
 #######################
 # Access type options #
 #######################
index da5e4c3d7b675b5ed625752abfcf8453f47ef94f..7f83499fc31164e90b59e5aa777a0c35a0f9fef5 100644 (file)
@@ -32,7 +32,7 @@
 
 - name: systemd start nfs container
   systemd:
-    name: "ceph-nfs@{{ ansible_hostname }}.service"
+    name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }}
     state: started
     enabled: yes
     daemon_reload: yes
index fadfc3499269c52a0066e9e53a4ab6884a0d70c3..151407c68dc7caa02a98bdef69f61eab30692198 100644 (file)
@@ -22,7 +22,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \
   -e CLUSTER={{ cluster }} \
   -e CEPH_DAEMON=NFS \
   {{ ceph_nfs_docker_extra_env }} \
-  --name=ceph-nfs-{{ ansible_hostname }} \
+  --name=ceph-nfs-{{ ceph_nfs_service_suffix | default(ansible_hostname) }} \
   {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
 ExecStopPost=-/usr/bin/docker stop ceph-nfs-%i
 Restart=always