.. -*- mode: rst -*- .. _server-plugins-grouping-metadata: ======== Metadata ======== The metadata mechanism has two types of information, client metadata and group metadata. The client metadata describes which top level group a client is associated with.The group metadata describes groups in terms of what bundles and other groups they include. Each aspect grouping and clients' memberships are reflected in the Metadata/groups.xml and Metadata/clients.xml files, respectively. Usage of Groups in Metadata =========================== Clients are assigned membership of groups in the Metadata descriptions. Clients can be directly assigned to 'profile' or 'public' groups. Client membership of all other groups is by those groups being associated with the profile or public groups. This file can be indirectly modified from clients through use of the -p flag to bcfg2. Clients are associated with profile groups in Metadata/clients.xml as shown below. Metadata/clients.xml ==================== The Metadata/clients.xml file contains the mappings of Profile Groups to clients. The file is just a series of tags, each of which describe one host. A sample file is below: .. code-block:: xml Clients Tag ----------- The Clients tag has the following possible attributes: +---------+-----------------------+--------+ | Name | Description | Values | +=========+=======================+========+ | version | Client schema version | String | +---------+-----------------------+--------+ Client Tag ---------- Each entry in clients.xml **must** have the following properties: +---------+---------------------------------------+--------+ | Name | Description | Values | +=========+=======================================+========+ | name | Host name of client. This needs to be | String | | | the name (possibly a FQDN) returned | | | | by a reverse lookup on the connecting | | | | IP address. | | +---------+---------------------------------------+--------+ | profile | Profile group name to associate this | String | | | client with. | | +---------+---------------------------------------+--------+ Additionally, the following properties can be specified: +----------+----------------------------------------+----------------+ | Name | Description | Values | +==========+========================================+================+ | Alias | Alternative name and address for the | XML Element | | | client. | | +----------+----------------------------------------+----------------+ | address | Establishes an extra IP address that | ip address | | | resolves to this client. | | +----------+----------------------------------------+----------------+ | location | Requires requests to come from an IP | fixed|floating | | | address that matches the client | | | | record. | | +----------+----------------------------------------+----------------+ | password | Establishes a per-node password that | String | | | can be used instead of the global | | | | password. | | +----------+----------------------------------------+----------------+ | pingable | If the client is pingable (deprecated; | Y|N | | | for old reporting system) | | +----------+----------------------------------------+----------------+ | pingtime | Last time the client was pingable | String | | | (deprecated; for old reporting system) | | +----------+----------------------------------------+----------------+ | secure | Requires the use of the per-client | true|false | | | password for this client. | | +----------+----------------------------------------+----------------+ | uuid | Establishes a per-node name that can | String | | | be used to bypass dns-based client | | | | resolution. | | +----------+----------------------------------------+----------------+ For detailed information on client authentication see :ref:`authentication` Metadata/groups.xml =================== The ``Metadata/groups.xml`` file contains Group and Profile definitions. Here's a simple ``Metadata/groups.xml`` file: .. code-block:: xml Nested/chained groups definitions are conjunctive (logical and). For instance, in the above example, a client associated with the Profile Group ``mail-server`` is also a member of the ``apache-server``, ``rhel-as-4-x86``, ``nfs-client``, ``server`` and ``rhel`` groups. Groups describe clients in terms for abstract, disjoint aspects. Groups can be combined to form complex descriptions of clients that use configuration commonality and inheritance. Groups have several attributes, described below: Metadata Groups Tag ------------------- The Groups tag has the following possible attributes: +----------+---------------------------------+--------+ | Name | Description | Values | +==========+=================================+========+ | version | Group schema version | String | +----------+---------------------------------+--------+ | origin | URL of master version | String | | | (for common repository) | | +----------+---------------------------------+--------+ | revision | Master version control revision | String | +----------+---------------------------------+--------+ Metadata Group Tag ------------------ The Group Tag has the following possible attributes: +----------+------------------------------------------+--------------+ | Name | Description | Values | +==========+==========================================+==============+ | name | Name of the group | String | +----------+------------------------------------------+--------------+ | profile | If a client can be directly associated | True|False | | | with this group | | +----------+------------------------------------------+--------------+ | public | If a client can freely associate itself | True|False | | | with this group. For use with the | | | | *bcfg2 -p* option on the client. | | +----------+------------------------------------------+--------------+ | category | A group can only contain one instance of | String | | | a group in any one category. This | | | | provides the basis for representing | | | | groups which are conjugates of one | | | | another in a rigorous way. It also | | | | provides the basis for negation. | | +----------+------------------------------------------+--------------+ | default | Set as the profile to use for clients | True|False | | | that are not associated with a profile | | | | in ``clients.xml`` | | +----------+------------------------------------------+--------------+ | comment | English text description of group | String | +----------+------------------------------------------+--------------+ Groups can also contain other groups and bundles. Use of XInclude =============== `XInclude `_ is a W3C specification for the inclusion of external XML documents into XML source files. Much like the use of ``#include`` in C, this allows complex definitions to be split into smaller, more manageable pieces. As of bcfg2-0.9.0pre1, the `Metadata`_ plugin supports the use of XInclude specifications to split the ``clients.xml`` and ``groups.xml`` files. This mechanism allows the following specification to produce useful results: .. code-block:: xml Each of the included groups files has the same format. These files are properly validated by ``bcfg2-repo-validate``. This mechanism is useful for composing group definitions from multiple sources, or setting different permissions in an svn repository. Probes ====== The metadata plugin includes client-side probing functionality. This is fully documented :ref:`here `. .. _server-plugins-grouping-metadata-clientmetadata: ClientMetadata ============== A special client metadata class is available to the TGenshi and TCheetah plugins. +----------------------+------------------------------------------------+-------------------+ | Attribute | Description | Value | +======================+================================================+===================+ | hostname | Client hostname | String | +----------------------+------------------------------------------------+-------------------+ | profile | Client profile | String | +----------------------+------------------------------------------------+-------------------+ | aliases | Client aliases | List | +----------------------+------------------------------------------------+-------------------+ | addresses | Adresses this client is known by | List | +----------------------+------------------------------------------------+-------------------+ | groups | Groups this client is a member of | List | +----------------------+------------------------------------------------+-------------------+ | categories | Categories of this clients groups | List | +----------------------+------------------------------------------------+-------------------+ | uuid | uuid identifier for this client | String | +----------------------+------------------------------------------------+-------------------+ | password | bcfg password for this client | String | +----------------------+------------------------------------------------+-------------------+ | connectors | connector plugins known to this client | List | +----------------------+------------------------------------------------+-------------------+ | query | MetadataQuery object | MetadataQuery | +----------------------+------------------------------------------------+-------------------+ | +------------------------------+------------------------------------------------+-------------------+ | Method | Description | Value | +==============================+================================================+===================+ | inGroup(group) | True if this client is a memnber of 'group' | Boolean | +------------------------------+------------------------------------------------+-------------------+ | group_in_category(category) | Returns the group in 'category' if the client | String | | | is a member of 'category', otherwise '' | | +------------------------------+------------------------------------------------+-------------------+ MetadataQuery ------------- This class provides query routines for the servers Metadata. +------------------------------+------------------------------------------------+-------------------+ | Method | Description | Value | +==============================+================================================+===================+ | by_name(client) | Get ClientMetadata object for 'client' | ClientMetadata | +------------------------------+------------------------------------------------+-------------------+ | names_by_groups(group) | | | +------------------------------+------------------------------------------------+-------------------+ | names_by_profiles(profile) | All clients names in 'profile' | List | +------------------------------+------------------------------------------------+-------------------+ | all_clients() | All known client hostnames | List | +------------------------------+------------------------------------------------+-------------------+ | all_groups() | All known group names | List | +------------------------------+------------------------------------------------+-------------------+ | all_groups_in_category(cat) | All groups in category 'cat' | List | +------------------------------+------------------------------------------------+-------------------+ | all() | Get ClientMetadata for all clients | List | +------------------------------+------------------------------------------------+-------------------+