Forum: CFEngine Help
Subject: Re: How can I get the interface name of a certain IP address?
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,27650,27658#msg-27658
body common control {
bundlesequence => { "main", };
}
bundle agent main {
methods:
"any" usebundle => test;
}
bundle agent test
{
vars:
"dns_servers"
slist => { "192.168.1.1","192.168.1.2", "172.26.2.4" };
"nics"
slist => getindices("sys.ipv4");
"nic"
string => "$(sys.ipv4[$(nics)])",
ifvarclass => canonify("is_dns_server_$(sys.ipv4[$(nics)])");
classes:
"is_dns_server_$(sys.ipv4[$(nics)])"
expression => reglist("@(dns_servers)","$(sys.ipv4[$(nics)])");
"nic_is_defined"
expression => isvariable("nic");
reports:
nic_is_defined::
"nic => $(nic)";
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine