We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6d47fd4 + b19ae68 commit 783f6b7Copy full SHA for 783f6b7
lib/facter/systemd.rb
@@ -0,0 +1,35 @@
1
+# Fact: systemd
2
+#
3
+# Purpose:
4
+# Determine whether SystemD is the init system on the node
5
6
+# Resolution:
7
+# Check the name of the process 1 (ps -p 1)
8
9
+# Caveats:
10
11
+
12
+# Fact: systemd-version
13
14
15
+# Determine the version of systemd installed
16
17
18
+# Check the output of systemctl --version
19
20
21
22
23
+Facter.add(:systemd) do
24
+ confine :kernel => :linux
25
+ setcode do
26
+ Facter::Core::Execution.exec('ps -p 1 -o comm=') == 'systemd'
27
+ end
28
+end
29
30
+Facter.add(:systemd_version) do
31
+ confine :systemd => true
32
33
+ Facter::Core::Execution.exec("systemctl --version | grep 'systemd' | awk '{ print $2 }'")
34
35
0 commit comments