I am fairly new to DSP and am experimenting as I follow along with the Puppet Tutorial
Playing off of the Task 1 in the Conditionals section...
my conditionals.pp worked as the example gave; however I was wanting to add on the "else" statement what the "uptime" is and then to state when the device was last rebooted.
if $::uptime_hours < 2 {
$myuptime = "Uptime is less than two hours. \n"
}
elsif $::uptime_hours < 5 {
$myuptime = "Uptime is less than five hours. \n"
}
else {
$reboot_time = "${who -b}"
$myuptime = "Uptime is greater than 4 hours. \n
Your uptime is $uptime.\n
Your last reboot was $reboot_time."
}
file {'/root/conditionals.txt':
ensure => present,
content => $myuptime,
}
My output ends up being
Uptime is greater than 4 hours.
Your uptime is 4 days.
Your last reboot was { -b}.
Again, I'm just learning here ...
how would I go about adding the "bash command to pull the "who -b" and echoing it to the appropriate spot?