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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to