summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ceph.spec.in5
-rw-r--r--debian/ceph-osd.install1
-rw-r--r--debian/control1
-rwxr-xr-xdebian/rules1
-rw-r--r--sudoers.d/ceph-osd-smartctl3
5 files changed, 11 insertions, 0 deletions
diff --git a/ceph.spec.in b/ceph.spec.in
index f42b5e3906d..4e016df0101 100644
--- a/ceph.spec.in
+++ b/ceph.spec.in
@@ -487,6 +487,7 @@ Group: System/Filesystems
%endif
Requires: ceph-base = %{_epoch_prefix}%{version}-%{release}
Requires: lvm2
+Requires: sudo
%description osd
ceph-osd is the object storage daemon for the Ceph distributed file
system. It is responsible for storing objects on a local file system
@@ -996,6 +997,9 @@ ln -sf %{_sbindir}/mount.ceph %{buildroot}/sbin/mount.ceph
# udev rules
install -m 0644 -D udev/50-rbd.rules %{buildroot}%{_udevrulesdir}/50-rbd.rules
+# sudoers.d
+install -m 0600 -D sudoers.d/ceph-osd-smartctl %{buildroot}%{_sysconfdir}/sudoers.d/ceph-osd-smartctl
+
#set up placeholder directories
mkdir -p %{buildroot}%{_sysconfdir}/ceph
mkdir -p %{buildroot}%{_localstatedir}/run/ceph
@@ -1516,6 +1520,7 @@ fi
%{_unitdir}/ceph-volume@.service
%attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/osd
%config(noreplace) %{_sysctldir}/90-ceph-osd.conf
+%{_sysconfdir}/sudoers.d/ceph-osd-smartctl
%post osd
%if 0%{?suse_version}
diff --git a/debian/ceph-osd.install b/debian/ceph-osd.install
index 39fc29bd59d..39420ca413a 100644
--- a/debian/ceph-osd.install
+++ b/debian/ceph-osd.install
@@ -19,3 +19,4 @@ usr/share/man/man8/ceph-volume-systemd.8
usr/share/man/man8/ceph-osd.8
usr/share/man/man8/ceph-bluestore-tool.8
etc/sysctl.d/30-ceph-osd.conf
+etc/sudoers.d/ceph-osd-smartctl
diff --git a/debian/control b/debian/control
index 783f2a95e25..708f64556e2 100644
--- a/debian/control
+++ b/debian/control
@@ -245,6 +245,7 @@ Package: ceph-osd
Architecture: linux-any
Depends: ceph-base (= ${binary:Version}),
lvm2,
+ sudo,
${misc:Depends},
${python:Depends},
${shlibs:Depends},
diff --git a/debian/rules b/debian/rules
index c5279c8267f..f1e3930a746 100755
--- a/debian/rules
+++ b/debian/rules
@@ -45,6 +45,7 @@ override_dh_auto_install:
install -D -m 644 udev/50-rbd.rules $(DESTDIR)/lib/udev/rules.d/50-rbd.rules
install -D -m 644 src/etc-rbdmap $(DESTDIR)/etc/ceph/rbdmap
install -D -m 644 etc/sysctl/90-ceph-osd.conf $(DESTDIR)/etc/sysctl.d/30-ceph-osd.conf
+ install -D -m 600 sudoers.d/ceph-osd-smartctl $(DESTDIR)/etc/sudoers.d/ceph-osd-smartctl
# doc/changelog is a directory, which confuses dh_installchangelogs
override_dh_installchangelogs:
diff --git a/sudoers.d/ceph-osd-smartctl b/sudoers.d/ceph-osd-smartctl
new file mode 100644
index 00000000000..a5cdb536398
--- /dev/null
+++ b/sudoers.d/ceph-osd-smartctl
@@ -0,0 +1,3 @@
+## allow ceph-osd (which runs as user ceph) to collect device health metrics
+
+ceph ALL=NOPASSWD: /usr/sbin/smartctl -a --json /dev/*