Hi,
can't see anything wrong off the top of my head except you use an import
statement instead of an include.
http://docs.puppetlabs.com/guides/language_guide.html#importing-manifests
Have you tried testing for a string like 'false'? Just to see if something odd
not going on.
>> $mode = '755', $monstring = 'false' )
>> if ! $monstring == "false" {
file{"/root/${servername}.cfg":
Not at a computer so can't test the code till tomorrow (that's about 8 hours
away).
Sorry,
Den
On 01/05/2012, at 22:24, Peter Horvath <[email protected]> wrote:
> Anybody got any idea on this?
> I am really stuck with this one.
>
> On Apr 30, 4:51 pm, Peter Horvath <[email protected]>
> 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 [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.
>
--
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.