On 3/16/2010 2:06 PM, Simon Mügge wrote:
Hi there!

Context: HowTo define a somewhat generic serviceinstance

Ive got:
#define.pp
define service::instance ( $instancename, $instanceip ) {
        #do stuff
}

#class.pp
class serviceA {
        service::instance{"funnyname":
                instancename =>  ["somenameA", "realnameA"],
                instanceip =>        ["1.2.3.4", "2.3.4.5", "3.4.5.6"],
        }
}

which wich works, but (depending on the usecase) is damn ugly and does
not exactly handle the way I want it to..

id like to be able to do:
#define.pp
define service::instance ( $instancename, ${${instancename}_ip} ) {
        #do stuff
}

#class.pp
class serviceA {
        service::instance{"funnyname":
                instancename =>  ["somenameA", "realnameA"],
                somenameA_ip =>  "1.2.3.4",
                realnameA_ip =>  ["2.3.4.5", "3.4.5.6"],
        }
}

But puppet does NOT seem to like this construct "${${instancename}
_ip}" (and I cant really blame it..) - does anyone have a hint as to
how to do this?

The proper syntax would be

> class serviceA {
>    service::instance{
>            "somenameA":
>                    ip =>  "1.2.3.4";
>            "realnameA":
>                    ip =>  ["2.3.4.5", "3.4.5.6"];
>    }
> }

or

> class serviceA {
>    service::instance{
>            "funnyname":
>                    public => "somenameA",
>                    public_ip => "1.2.3.4",
>                    realnames => "realnameA",
>                    real_ips =>  ["2.3.4.5", "3.4.5.6"];
>    }
> }

(where public_ip and real_ips would be hardcoded names)

depending on your use case.

if you can describe your particular case in more depth, perhaps there are other, better methods to implement this.


Regards, David
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

       FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-us...@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