]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Expose /var/run/ceph
authorSébastien Han <seb@redhat.com>
Thu, 12 Apr 2018 13:52:30 +0000 (15:52 +0200)
committerSébastien Han <seb@redhat.com>
Fri, 20 Apr 2018 13:48:32 +0000 (15:48 +0200)
Useful for softwares that do data collection/monitoring like collectd.
They can connect to the socket and then retrieve information.

Even though the sockets are exposed now, I'm keeping the docker exec to
check the socket, this will allow newer version of ceph-ansible to work
with older versions.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1563280
Signed-off-by: Sébastien Han <seb@redhat.com>
15 files changed:
roles/ceph-defaults/tasks/create_ceph_initial_dirs.yml
roles/ceph-defaults/templates/restart_osd_daemon.sh.j2
roles/ceph-mds/templates/ceph-mds.service.j2
roles/ceph-mgr/tasks/docker/copy_configs.yml
roles/ceph-mgr/templates/ceph-mgr.service.j2
roles/ceph-mon/tasks/docker/copy_configs.yml
roles/ceph-mon/templates/ceph-mon.service.j2
roles/ceph-nfs/templates/ceph-nfs.service.j2
roles/ceph-osd/tasks/copy_configs.yml
roles/ceph-osd/templates/ceph-osd-run.sh.j2
roles/ceph-rbd-mirror/tasks/docker/copy_configs.yml
roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2
roles/ceph-restapi/tasks/docker/copy_configs.yml
roles/ceph-rgw/tasks/docker/copy_configs.yml
roles/ceph-rgw/templates/ceph-radosgw.service.j2

index e53fc2a88e1928aed4aa1a07d3bbf15fe319df70..a20f9a4537b445f3854d59df4840099e25df52f2 100644 (file)
@@ -19,7 +19,7 @@
   file:
     path: "{{ item }}"
     state: directory
-    owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
-    group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
+    owner: "{{ ceph_uid }}"
+    group: "{{ ceph_uid }}"
     mode: 0755
   with_items: "{{ ceph_directories }}"
index b09b2a0209b49ffbe165a60f149d9843dd85cb05..c04151b19d38af9a5e2577a3c1a76c68447993f8 100644 (file)
@@ -28,6 +28,8 @@ check_pgs() {
 }
 
 wait_for_socket_in_docker() {
+  osd_mount_point=$(docker exec "$1" df --output=target | grep '/var/lib/ceph/osd/')
+  whoami=$(docker exec "$1" cat $osd_mount_point/whoami)
   if ! docker exec "$1" timeout 10 bash -c "while [ ! -e /var/run/ceph/*.asok ]; do sleep 1 ; done"; then
     echo "Timed out while trying to look for a Ceph OSD socket."
     echo "Abort mission!"
@@ -68,7 +70,8 @@ for unit in $(systemctl list-units | grep "loaded active" | grep -oE "ceph-osd@(
   {% if containerized_deployment -%}
   id=$(get_dev_name "$unit")
   container_id=$(get_docker_id_from_dev_name "$id")
-  osd_id=$(get_docker_osd_id "$container_id")
+  wait_for_socket_in_docker "$container_id"
+  osd_id=$whoami
   docker_exec="docker exec $container_id"
   {% else %}
   osd_id=$(echo ${unit#ceph-osd@} | grep -oE '[0-9]{1,2}')
index ce20f45b0610178b6597a5a36927bb20bdc633a4..1f6f01164843de7d6383a55e08ef81fa802f0526 100644 (file)
@@ -16,6 +16,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \
   {% if not containerized_deployment_with_kv -%}
   -v /var/lib/ceph:/var/lib/ceph:z \
   -v /etc/ceph:/etc/ceph:z \
+  -v /var/run/ceph:/var/run/ceph:z \
   {% else -%}
   -e KV_TYPE={{kv_type}} \
   -e KV_IP={{kv_endpoint}} \
index c1387cb272fb12676a165144409ae7476536ee0a..6163944565cee6f580c5ba1a8dabedd4d0b4299f 100644 (file)
@@ -58,4 +58,4 @@
     owner: "{{ bootstrap_dirs_owner }}"
     group: "{{ bootstrap_dirs_group }}"
     mode: "0600"
-  when: cephx
\ No newline at end of file
+  when: cephx
index 9970190f5a4ac099182f551bf7b0285cfa50a43d..5c4ef56b660fddd92a99e314428e88d3c6000299 100644 (file)
@@ -16,6 +16,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \
   {% if not containerized_deployment_with_kv -%}
   -v /var/lib/ceph:/var/lib/ceph:z \
   -v /etc/ceph:/etc/ceph:z \
+  -v /var/run/ceph:/var/run/ceph:z \
   {% else -%}
   -e KV_TYPE={{kv_type}} \
   -e KV_IP={{kv_endpoint}} \
index ab45c78beec2afbe94a1571cff974da3f8e1d0da..dd1d138089d6632bef9eac4f3be5f3ecbb3e94ba 100644 (file)
@@ -78,4 +78,4 @@
     - "{{ statconfig.results }}"
   when:
     - item.1.stat.exists == true
-    - not (item.0 | search("keyring"))
\ No newline at end of file
+    - not (item.0 | search("keyring"))
index 958b327dad8629dcb8fa230df5cab0cfdc286a70..23b10fd5884a398b31f10019e3a34fb38769220a 100644 (file)
@@ -16,6 +16,7 @@ ExecStart=/usr/bin/docker run --rm --name ceph-mon-%i --net=host \
 {% if not containerized_deployment_with_kv -%}
   -v /var/lib/ceph:/var/lib/ceph:z \
   -v /etc/ceph:/etc/ceph:z \
+  -v /var/run/ceph:/var/run/ceph:z \
 {% else -%}
   -e KV_TYPE={{kv_type}} \
   -e KV_IP={{kv_endpoint}}\
index 2131a694fd6ba510af7b7549f2de85362977d13e..77acbee90135517197d06adf0a9d72d017088e11 100644 (file)
@@ -11,8 +11,9 @@ ExecStart=/usr/bin/docker run --rm --net=host \
   {% if not containerized_deployment_with_kv -%}
   -v /var/lib/ceph:/var/lib/ceph:z \
   -v /etc/ceph:/etc/ceph:z \
-  -v /var/lib/nfs/ganesha:/var/lib/nfs/ganesha \
-  -v /etc/ganesha:/etc/ganesha \
+  -v /var/lib/nfs/ganesha:/var/lib/nfs/ganesha:z \
+  -v /etc/ganesha:/etc/ganesha:z \
+  -v /var/run/ceph:/var/run/ceph:z \
   {% if ceph_nfs_dynamic_exports %}
   --privileged \
   -v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket \
index 98f511a0ddf017af995f3c2f11fe35d17ea8366d..593e846ce06b400a91ce6a9f714f2904cbbc877b 100644 (file)
@@ -43,4 +43,4 @@
     group: root
     mode: 0644
   changed_when: false
-  with_items: "{{ ceph_config_keys }}"
\ No newline at end of file
+  with_items: "{{ ceph_config_keys }}"
index 19d2bf9fb5b89a05048953d9a564be62774a1133..02f6611b989ea9ff0afd88193495f0179740a5d6 100644 (file)
@@ -77,6 +77,7 @@ expose_partitions "$1"
   -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 \
   $DOCKER_ENV \
   {% if ansible_distribution == 'Ubuntu' -%}
   --security-opt apparmor:unconfined \
index f9479757f8745d7cc65ec31710331a5d1f695843..2133cbe4a181c01ac412814e62072c91c6ad4125 100644 (file)
@@ -36,4 +36,4 @@
     - "{{ statconfig.results }}"
   when:
     - not item.1.get('skipped')
-    - item.1.stat.exists == true
\ No newline at end of file
+    - item.1.stat.exists == true
index ac7bacc6c56fd1ef0f8f08d151af4408da45d453..4f966b2307b6eb3db33b4e78b05dacc4249dd9aa 100644 (file)
@@ -16,6 +16,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \
   {% if not containerized_deployment_with_kv -%}
   -v /var/lib/ceph:/var/lib/ceph:z \
   -v /etc/ceph:/etc/ceph:z \
+  -v /var/run/ceph:/var/run/ceph:z \
   {% else -%}
   -e KV_TYPE={{kv_type}} \
   -e KV_IP={{kv_endpoint}} \
index d0ae87ed5ed0811aad4c605809ef69e7033ebb17..d2c0aee094cdf2e1d19436061dbf40dcf956967e 100644 (file)
@@ -27,4 +27,4 @@
     - "{{ ceph_config_keys }}"
     - "{{ statconfig.results }}"
   when:
-    - item.1.stat.exists == true
\ No newline at end of file
+    - item.1.stat.exists == true
index 3a0ce913c6f64a140517b5d61cf5d1bdf6e23758..63e9f46bc20f62ca5e4babe6108e9d70de8464ba 100644 (file)
@@ -40,4 +40,4 @@
     - "{{ ceph_config_keys }}"
     - "{{ statconfig.results }}"
   when:
-    - item.1.stat.exists == true
\ No newline at end of file
+    - item.1.stat.exists == true
index bd23284ac0a4a7cf2c06596c145e33de4739e21e..6fcbb5f7d787b8d6aaffc66ed70d392bf521dcb8 100644 (file)
@@ -16,6 +16,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \
   {% if not containerized_deployment_with_kv -%}
   -v /var/lib/ceph:/var/lib/ceph:z \
   -v /etc/ceph:/etc/ceph:z \
+  -v /var/run/ceph:/var/run/ceph:z \
   {% else -%}
   -e KV_TYPE={{ kv_type }} \
   -e KV_IP={{ kv_endpoint }} \