Ray
2014-Feb-13 23:18 UTC
[Puppet Users] How to apply template based on a string in a file
Newbie question:
I need to be able to apply a specific template based on whether a string is
found in an
existing file on the client or not. I tried the following (found an example
somewhere... it does not work.. always falls into the first condition)
What would be the correct way to check for the value in the file?
if "grep STANDARD /var/adm/buildIT/ServerBuild.dat 2>/dev/null"
{
file { '/etc/openssh/sshd_config':
ensure => file,
backup => false,
content => template("sshdconfig/sshdconfigsol.erb"),
notify => Service['ssh']
}
service { 'ssh':
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
}
}
else
{
file { '/etc/openssh/sshd_config':
ensure => file,
backup => false,
content => template("sshdconfig/sshdconfigsolpm.erb"),
notify => Service['ssh']
}
service { 'ssh':
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
}
}
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/e502a7ac-cebc-4454-900e-d504f2a89956%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.