body file control {
agent::
inputs => { @(my_autorun.inputs) };
}
bundle agent my_autorun {
meta:
"tags" slist => { "autorun" };
vars:
"bundle" slist => bundlesmatching(".*", "^(any|$(sys.class)|$(sys.uqhost))$");
"inputs" slist => findfiles("$(this.promise_dirname)/.*\*.cf");
methods:
"$(bundle)" usebundle => "$(bundle)";
reports:
inform_mode::
"autorun is executing";
"$(this.bundle): found bundle $(bundle)";
}
bundle agent my_any
{
meta:
"tags" slist => { "any" };
reports:
any::
"$(this.bundle): any bundle";
}
bundle agent my_solaris
{
meta:
"tags" slist => { "solaris" };
reports:
any::
"$(this.bundle): solaris bundle";
}
bundle agent my_aix
{
meta:
"tags" slist => { "aix" };
reports:
any::
"$(this.bundle): aix bundle";
}
bundle agent my_linux
{
meta:
"tags" slist => { "linux" };
reports:
any::
"$(this.bundle): linux bundle";
}
bundle agent my_host
{
meta:
"tags" slist => { "ahostname" };
reports:
any::
"$(this.bundle): host bundle";
}
I think that's really nice and readable :)
--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengin...@googlegroups.com.
To post to this group, send email to help-c...@googlegroups.com.
Visit this group at http://groups.google.com/group/help-cfengine.
For more options, visit https://groups.google.com/d/optout.
bundle agent my_autorun {
meta:
"tags" slist => { "autorun" };
vars:
"bundle_input" slist => bundlesmatching(".*", "^(any|$(sys.class)|$(sys.uqhost))$");
"inputs" slist => findfiles("$(this.promise_dirname)/.*\*.cf");
"bundle" slist => sort("bundle_input","lex");
methods:
"$(bundle)" usebundle => "$(bundle)";
}
bundle agent my_solaris
{
meta:
"tags" slist => { "shelley" };
reports:
any::
"$(this.bundle): solaris bundle";
}
bundle agent my_aix
{
meta:
"tags" slist => { "aix" };
reports:
any::
"$(this.bundle): aix bundle";
}
bundle agent my_linux
{
meta:
"tags" slist => { "linux" };
reports:
any::
"$(this.bundle): Linux bundle";
}
bundle agent my_any
{
meta:
"tags" slist => { "any" };
reports:
any::
"$(this.bundle): any bundle";
}
{
meta:
"tags" slist => { "any" };
reports:
any::
"$(this.bundle): global bundle";
}
bundle common 2_global
{
meta:
"tags" slist => { "any" };
reports:
any::
{
meta:
"tags" slist => { "any" };
reports:
any::
"$(this.bundle): last bundle";
}
bundle common zz2_last
{
meta:
"tags" slist => { "any" };
reports:
any::
"$(this.bundle): last bundle";
}
On May 14, 2015, at 10:10 AM, berntjernberg <bernt.j...@gmail.com> wrote:
methods:
"$(bundle)"
usebundle => "$(bundle)",
ifvarclass => "$(bundle)";
The idea behind the roadhow is to have a role based aproach, the role defines the machine. Classify takes care of deriving the roles from the host name standardized by the hostnaming convention. I hardly use classes in navigation, they have to be omnipresent and disclose the architecture, I prefer to use sys.variables and "soft" variables like the role.
The CFEngine now offers:
1. The plaform layer, CentOS x, Debian x and I am working on Suse.
2. The middleware layer
3. The applications
This will be demonstrated live at: https://www.nluug.nl/events/vj15/programma.html
You are more than welcome to introduce any improvements along the lines you mentioned in your post.
All very interesting. Do you have a github repo, like I have for The CFEngine Roadshow. https://github.com/Webhuis/CFEngine-Roadshow
It would give a better overview than snippets of code.
By now there are quite a number interesting frameworks available for CFEngine. I know Nick Anderson is trying to get this organized. Why don we not have a corner on http://cfengine.com which provides an overview of all these frameworks. It would help people to get going with CFEngine and ease the always difficult first steps.
It would give a better overview than snippets of code.
By now there are quite a number interesting frameworks available for CFEngine. I know Nick Anderson is trying to get this organized. Why don we not have a corner on http://cfengine.com which provides an overview of all these frameworks. It would help people to get going with CFEngine and ease the always difficult first steps.
body file control {
agent::
inputs => { @(my_autorun.inputs) };
}
bundle agent my_autorun
{
meta:
"tags" slist => { "autorun" };
vars:
# Match all (meta) tags in bundles.
#
# any = any
# $(sys.class) = linux|solaris|aix
# $(sys.flavour) = redhat_6|oracle_6|sunos_5.10|aix_6.1
# $(sys.uqhost) = unqualified hostname
# $(ostype) = redhat,oracle
# $(role) = role of server. Ex web, app, db
# $(function) = primary_kdc, primary_ldap, policy_server.
any::
"role" string => "none";
"function" string => "none";
"zone_type" string => "none";
"domain_type" string => "none";
"ostype" string => "none";
!pre_commit_check::
"dirs" slist => {
"global",
"any",
"$(sys.class)",
"$(sys.flavour)",
"$(ostype)"
};
pre_commit_check::
"dirs" slist => lsdir("$(this.promise_dirname)","[0-9A-z_]+","false");
# Function
ps01|tps01::
"function" string => "policy_server";
ldap01|tldap01::
"function" string => "primary_ldap";
kdc01::
"function" string => "primary_kdc";
# Role
web::
"role" string => "web";
app::
"role" string => "app";
db::
"role" string => "db";
# Global/local zone, control domain.
control_domain::
"domain_type" string => "control_domain";
zone_global::
"zone_type" string => "global_zone";
solaris.!zone_global::
"zone_type" string => "local_zone";
# ostype
ostype_oracle::
"ostype" string => "oracle";
ostype_redhat::
"ostype" string => "redhat";
# Search for matching meta tags.
any::
"bundle_input" slist => bundlesmatching(".*","^(any|$(sys.class)|$(sys.flavour)|$(sys.uqhost)|$(ostype)|$(role)|$(function)|$(zone_type)|$(domain_type))$");
"inputs_$(dirs)" slist => findfiles("$(this.promise_dirname)/$(dirs)/*\.cf");
"inputs_array[$(inputs_$(dirs))]" string => "true";
"inputs" slist => getindices("inputs_array");
list_populated::
"bundle" slist => sort("bundle_input","lex");
classes:
# Stop spam from sort function.
"list_populated" expression => isvariable("bundle_input");
# Create role class.
"web" or => { classmatch("web.*") };
"app" or => { classmatch("app.*") };
"db" or => { classmatch("db.*") };
# Solaris control domain.
"control_domain" expression => fileexists("/usr/sbin/ldm");
# Create ostype class
"$(sys.flavour)_class" expression => "any";
"ostype_oracle" expression => classmatch("oracle_.*_class");
"ostype_redhat" expression => classmatch("redhat_.*_class");
methods:
"$(bundle)" usebundle => "$(bundle)",
comment => "Run all discovered bundles";
reports:
inform_mode::
"autorun is executing";
"$(this.bundle): found bundle $(bundle)";
}
cf-agent -nKD pre_commit_check