Forum: Cfengine Help
Subject: Re: Hostname based classes and virtual machines in Cfengine 3
Author: toddnni
Link to topic: https://cfengine.com/forum/read.php?3,22131,22132#msg-22132

I also faced the same problem on the FreeBSD host system. As a solution I 
created my own hostname classes which I define from the IP addresses 
($(sys.ipv4)) . I use the IP address as a basis because that is the way I want 
it.

Regarding to your question, you may create a class from the 'hostname' 
command's output like this

bundle common hostname_def {
vars:
  any::
    "hostname" string => execresult("/bin/hostname","noshell");
classes:
  any::
    "host_$(hostname)"
      comment => "My own hostname definition.";
}


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

Reply via email to