How do I check content of a file in puppet?
ex: I want to see if "PermitRootLogin" is "no" in /etc/ssh/sshd_config file
(RHEL). If it's "yes" i want to show it on compliance report. For now I
don't want make any changes to the sshd_config file through puppet.

Here is something I have:

define line($file, $line, $ensure = 'present') {
$line = "PermitRootLogin no"
$file = "/etc/ssh/sshd_config"
case $ensure {
default : { err ( "unknown ensure value ${ensure}" ) }
present: {
warning/flag code:
unless => "/bin/grep '${line}' '${file}'"

You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/M8gmxMKkp58J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 12 | next ›
Discussion Overview
grouppuppet-users @
postedDec 27, '12 at 7:18p
activeApr 9, '13 at 1:49a



site design / logo © 2022 Grokbase