You might be better off putting together a custom fact about this. Then you can 
check fact(s) on the host(s) without trying to manage-but-not-manage something 
inside puppet.

On Thu, Dec 27, 2012 at 11:15:14AM -0800, pdiddy wrote:
>    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
>    [1]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.
> 
> References
> 
>    Visible links
>    1. https://groups.google.com/d/msg/puppet-users/-/M8gmxMKkp58J

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
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