Anybody got any idea on this?
I am really stuck with this one.

On Apr 30, 4:51 pm, Peter Horvath <peter.horvat...@googlemail.com>
wrote:
> Hi,
>
> I have a modul which created the vhosts and based on the variables defined
> there i am creating nagios defacement host cfg.
> My problem is that I can't conditionally decide if the file should be
> created, based on the variable which will get content in the node config:
> When the condition get evaluated $monstring still empty since it gets its
> content in the node config later, so no file will be created.
> If i remove the condition there will be hundreds of nagios cfg which should
> not be created.
> Can you give me some idea how can i make this work, so blog file gets
> created and blog1 not.
>
> *This is the important part of my resource type*
> *
> *
> define vhost ($servername = "${hostname}.${domain}", $serveralias = [
> "www.${hostname}.${domain}" ], $inorout = "1", $owner = "root", $group =
> "root", $enabled = "link", $rewrite = "", $ssl = "false", $cacert = "",
> $certchain = "", $certfile = "", $keyfile = "", $pringo = "false",
> $pringodir = "pringo4", $staging = "false", $mode = '755', $monstring = '' )
>
> if ! $monstring == "" {
>  file{"/root/${servername}.cfg":
>                         ensure          => present,
>                         content         =>
> template("${module_name}/defacementmon.erb"),
>                 }
>
> }
>
> *node config:*
>
> import "apache2/vhost.pp"
>
>         vhost{'blog.domain.com':
>                 servername              => 'blog.domain.com',
>                 serveralias             => [ 'prod-blog.domain.com' ],
>                 enabled                 => 'link',
>                 require                 => Mount['/var/www'],
>                 monstring               => 'string',
>                 inorout                 => '0';
>         }
>
> vhost{'blog1.domain.com':
>                 servername              => 'blog1.domain.com',
>                 serveralias             => [ 'prod-blog1.domain.com' ],
>                 enabled                 => 'link',
>                 require                 => Mount['/var/www'],
>                 inorout                 => '0';
>         }
>
> I hope it is understandable, my english is not the best.
> Peter

-- 
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