I would suggest you approach the problem this way:

bundle common hostinfo {

 vars:

       hati::
           "ip" string => "192.168.1.2";

       srv1::
           "ip" string => "192.168.1.3";
}

bundle agent test
{
   classes:
       "ok" expression => "any";

   reports:

       ok::
           "$(hostinfo.ip)";
}

On Thu, Dec 2, 2010 at 9:25 AM, Daniel Dehennin <
[email protected]> wrote:

> Hello,
>
> I have a common bundle per host to store per host variables like ip
> addresses.
>
> I would like to use $(sys.host) to reference the scope of a variable,
> the following does not work:
>
> ===== promises.cf
> body common control
> {
>    bundlesequence => { "test" };
>    version => "0.0.1";
> }
>
> bundle common hati
> {
>    vars:
>        hati::
>            "ip" string => "192.168.1.2";
> }
>
> bundle common srv1
> {
>    vars:
>
>        srv1::
>            "ip" string => "192.168.1.3";
> }
>
> bundle agent test
> {
>    classes:
>        "ok" expression => "any";
>
>    reports:
>
>        ok::
>            "$($(sys.host)_ip)";
> }
> =====
>
> This results in
>
> ===== /usr/sbin/cf-agent -K -I
> R: $(hati_ip)
> =====
>
> Thanks.
>
> --
> Daniel Dehennin
> Récupérer ma clef GPG:
> gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1
>
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
>
>
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to