On Aug 8, 4:48 pm, Steve <some1youk...@gmail.com> wrote:
> I'm trying to write a script that runs command based on version of
> Redhat OS. For example, if the RHEL version is 6.0, it will run
> command. I was able to write file read script in ruby that would read
> file and execute but it didn't seem to work in puppet script. Has
> anyone done something like this?
>
> $redhat_version_file = "/etc/redhat-release"
> $redhat_version = "File.read($redhat_version_file)"
> if ($redhat_version =~ /6.0/) { command }
>
> or
>
> $redhat_version_file = "/etc/redhat-release"
> if ( File.open($redhat_version_file).read().include? "6.0") {command}


You haven't provided enough information for me to fully understand
what you already tried, but it sounds like maybe you wrote a Puppet
manifest in Puppet's Ruby DSL (as opposed to its traditional DSL).  In
that case, you need to understand that the manifest runs where the
node's catalog is compiled, which in a client / server setup is on the
server.  That is not what you want for the kind of problem you
describe.

In general, the way to provide node state information to Puppet is via
facts -- custom facts if those you need are not already provided by
Facter.  These are fairly easy to write and distribute.


John

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

Reply via email to