Here is a series of example configurations for Bcfg2, each introducing another layer of functionality.
Our example starts with the bare minimum configuration setup. We have a client, a profile group, a list of packages, and a base configuration.
Metadata/clients.xml:
<Clients version='3.0'>
<Client profile='fedora' pingable='N' pingtime='0' name='foo.bar.com'/>
</Clients>
Metadata/groups.xml:
<Groups version='3.0'>
<Group profile='true' name='fedora' toolset='rh'/>
</Groups>
Base/base.xml:
<Base>
<Group name='fedora'>
<Package name='ntp'/>
</Group>
</Base>
Pkgmgr/packages.xml:
<PackageList type='rpm' priority='0'>
<Package name='ntp' version='4.2.0.a.20050816-11.FC5'/>
</PackageList>
Configure the service, and add it to the base.
Svcmgr/services.xml:
<Services priority='0'>
<Service name='ntpd' status='on'/>
</Services>
Base/base.xml:
<Base>
<Group name='fedora'>
<Package name='ntp'/>
<Service name='ntpd'/>
</Group>
</Base>
Setup an etc/ directory structure, and add it to the base.:
# cat Cfg/etc/ntp.conf/ntp.conf
server ntp1.utexas.edu
Base/base.xml:
<Base>
<Group name='fedora'>
<Package name='ntp'/>
<Service name='ntpd'/>
<Path name='/etc/ntp.conf'/>
</Group>
</Base>
The above configuration layout works fine for a single service, but that method of organization would quickly become a nightmare as you approach the number of packages, services, and config files required to represent a fully configured host. Bundles allow the grouping of related configuration entries that are used to provide a single service. This is done for several reasons:
The config file, package, and service are really all related components describing the idea of an ntp client, so they should be logically grouped together. We use a bundle to accomplish this.
Bundler/ntp.xml:
<Bundle name='ntp' version='2.0'>
<Package name='ntp'/>
<Service name='ntpd'/>
<Path name='/etc/ntp.conf'/>
</Bundle>
After this bundle is created, it must be associated with a group (or groups). Add a bundle child element to the group(s) which should install this bundle.
Metadata/groups.xml:
<Groups>
...
<Group name='fedora'>
<Bundle name='ntp'/>
</Group>
...
</Groups>
Once this bundle is created, a client reconfigure will install these entries. If any are modified, then the ntpd service will be restarted. If you only want ntp configurations to be updated (and nothing else), the bcfg2 client can be run with a -b <bundle name> option that will only update entries in the specified bundle.