Hi Mohammed,
On Wed, Nov 9, 2016 at 2:08 PM, mohammed mathin <[email protected]>
wrote:
> Hi,
>
> My questing will be silly but sorry for that
>
> I facing problem on setting up the hostname based manifest
>
> My requirement is if the hostname match statment1 file need to be print.
>
> But in all the nodes statmen1 file is printing not sure where i have done
> mistake. hear the below my manifest file
>
>
> class pkg::statment {
> if ["$hostname" == "172.20.14.173"] {
>
This is incorrect syntax for what you would like to accomplish.
`["$hostname" == "172.20.14.173"]` creates an array containing a single
boolean (true if the strings compare or false if not).
The "if" expression is then given the array as the condition, which is
always "truthy", causing '/tmp/statment1' to always be created.
If you remove the surrounding brackets, the "if" expression will then use
the result of the equality operator as the condition, which is what you
want.
Thus, change `if ["$hostname" == "172.20.14.173"] ...` to `if $hostname ==
"172.20.14.173" ...` (you can probably omit the quotes around $hostname as
I suspect $hostname is already a string).
Cheers,
Peter
> file { '/tmp/statment1' :
> ensure => 'file',
> }
> }
> else {
> file { '/tmp/statment2' :
> ensure => 'file',
> }
> }
> }
>
>
> --
> 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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-users/7a6a23a8-1ac0-46d7-8b0e-13a04c82aa9f%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/7a6a23a8-1ac0-46d7-8b0e-13a04c82aa9f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
--
Peter Huene - Senior Software Engineer
[email protected] | @peterhuene
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/CACZQQfOc3yH48TRWzuQd5w_RC8kNPdfNXp_491%2B2jnf2G4M6mA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.