How to manage Windows XP desktop systems under CFEngine. Together with Perl and sufficient application of force, CFEngine can manage user accounts, printer configuration, local group policy edits, and software installation. Additional infrastructure management pieces for the site in question included:
The work documented here was done primarily by Alex Dioso to support Windows XP Professional desktop systems in the department of Genome Sciences.
Also consider WPKG for software management on Windows.
CFEngine on Windows requires:
Install these via Unattended to automate host setup. Another option: use nLite to create a custom Windows installation CD, or create install images if the supported hardware has been standardized (via Norton Ghost or similar).
Other concerns:
Files on the (Unix) CFEngine server (and the recommended supporting version control repository) will still have : in their names. On Windows systems with the above patch applied, the : will be converted to + when copied to or used on Windows.
CFEngine configuration tips and example for Windows. These notes rely on CFEngine Classes for class naming conventions and how the configuration files use import.
In update.conf and cfagent.conf, consider setting the following variables. cf_install_dir varies by platform, as does the “default group for the superuser account”.
control:
compiled_on_cygwin::
cf_install_dir = ( /usr/sbin )
zerogroup = ( Administrators )
Consider shortening the long compiled_on_cygwin class to windows:
classes:
compiled_on_cygwin::
windows = ( compiled_on_cygwin )
Also create classes for different releases and revisions of Windows, to allow actions to target only Windows XP, or Windows XP service pack 1. These classes may require FileExists calls or shell scripts to set.
Ensure directories copied (for example in update.conf) have a trailing slash after the source directory path:
copy:
any::
# note the trailing slash:
/var/cfengine/inputs/
dest=${workdir}/inputs backup=false recurse=inf
type=checksum encrypt=true
server=cfengine.example.org
copy:
compiled_on_cygwin::
/usr/bin/gawk.exe
dest=/usr/bin/awk.exe
owner=root group=${zerogroup} mode=700
recurse=1
backup=false
server=localhost
type=checksum
Configuration example adapted from the main cf.windows configuration file. cfagent.conf, when read by cfagent, imports the cf.windows file after parsing other configuration files.
import:
any::
# main config, groups (classes) definitions, site-wide actions
cf.main
cf.groups
cf.site
# contains application-specific imports
cf.applications
compiled_on_cygwin::
cf.windows
CFEngine should be run by two different methods, to ensure CFEngine will still run should one method fails. Scheduled tasks were found to randomly corrupt themselves.
Use schedule_cfexecd.pl and the statements in the cf.windows configuration file to run cfexecd as a Windows service.
The install_software.pl script can install software. See the cf.windows configuration file for examples.
To create *.msi installers, use either Visual Studio (long and difficult) or the freeware software Advanced Installer.
Copying *.reg files based on CFEngine classes, then applying these files may be sufficient. Other tasks may require a script to make the necessary modifications, such as vscan_whitelist.pl.
lgp_edit.pl in conjunction with module:policy is another method. The source code for module:policy is available by request.