Difference between revisions of "Hosts.xml"
(→hosts.xml structure) |
(→Quick examples) |
||
Line 39: | Line 39: | ||
<blockquote style="background: white; border: 1px solid black; padding: 1em;"> | <blockquote style="background: white; border: 1px solid black; padding: 1em;"> | ||
− | <host name="'''b. '''" profile-id="'''profile1'''" /> | + | <host name="'''b.*'''" profile-id="'''profile1'''" /> |
</blockquote> | </blockquote> | ||
Line 46: | Line 46: | ||
<blockquote style="background: white; border: 1px solid black; padding: 1em;"> | <blockquote style="background: white; border: 1px solid black; padding: 1em;"> | ||
− | <host name="'''. '''" profile-id="'''profile'''" /> | + | <host name="'''.*'''" profile-id="'''profile'''" /> |
</blockquote> | </blockquote> | ||
Line 53: | Line 53: | ||
<blockquote style="background: white; border: 1px solid black; padding: 1em;"> | <blockquote style="background: white; border: 1px solid black; padding: 1em;"> | ||
− | <host name="'''b. '''" profile-id="'''profile2'''" /><br> | + | <host name="'''b.*'''" profile-id="'''profile2'''" /><br> |
<host name="'''bronek1'''" profile-id="'''profile1'''" /><br> | <host name="'''bronek1'''" profile-id="'''profile1'''" /><br> | ||
− | <host name="'''bron. '''" profile-id="'''profile3'''" /><br> | + | <host name="'''bron.*'''" profile-id="'''profile3'''" /><br> |
</blockquote> | </blockquote> | ||
Revision as of 17:03, 12 February 2008
hosts.xml is a file which defines the hosts and associated profiles, which these hosts will use.
This file has to be placed in the same directory as wpkg.js. Alternatively it may be stored in a subdirectory named hosts with an individual filename e.g. room1.xml, room2.xml.
WPKG will not work without this file.
Profiles are defined in profiles.xml file, and they describe software packages, which will be installed on hosts.
hosts.xml structure
The structure of hosts.xml is as follows:
<wpkg>
<host name="host1" profile-id="custom1" />
<host name="host2" profile-id="custom2" />
</wpkg>
Which means, that a hostname with a name host1 will use a profile custom1, and a hostname with a name host2 will use a profile custom2.
If you have more hosts, or want to group them, it would be unwise to edit dozens of host entries just to attach them all to one or two profiles. That's why you can use Regular Expression Syntax.
Quick examples
Below is a quick explanation on the usage of regular expression within the hosts.xml file.
<host name="b[0-9] " profile-id="profile" />
works for: b1, b10, b100
does not work for: bubu, b, x, x1, x10, x100
<host name="b.*" profile-id="profile1" />
works for "b10", "b12345", "bubu" etc.
<host name=".*" profile-id="profile" />
works for *all* hosts - use with care (!), place at the bottom of hosts.xml (see below why . regular expression match should be placed at the end of the hosts.xml file).
<host name="b.*" profile-id="profile2" />
<host name="bronek1" profile-id="profile1" />
<host name="bron.*" profile-id="profile3" />
Normally, hosts are parsed from top to the bottom, except when the hostname is not a regular expression. So the host bronek1 will match profile1, even though it also matches b. and bron. (which are regular expressions).
See also
- profiles.xml - defines the profiles.
- packages.xml - defines the list of packages.
- wpkg.js - WPKG engine.