Forum: Cfengine Help
Subject: Re: how to build a slist from array volumes?
Author: phnakarin
Link to topic: https://cfengine.com/forum/read.php?3,20899,20903#msg-20903

I'm not quite sure how many ip addresses you would get from $(sys.ipv4) alone. 
I usually specify an interface name to sys.ipv4 to get its ip address in return 
such $(sys.ipv4). 

One possible way to do what you want should be like the following code; Firstly 
we create a list of ip addresses then grep to an variable.


bundle agent test
{
 vars:
  linux::
   "all_ips"  slist => { "$(sys.ipv4)","$(sys.ipv4)","$(sys.ipv4)" };
   "mngmt_ip" slist => grep("10.0.50.*","all_ips");

 reports:
  linux::
   "--> $(mngmt_ip)";
}


Cheers,
--Nakarin

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to