It is common to integrate CFEngine with external data sources. External data sources could be hand edited data files, the cached result of an API call or generated by other tooling. This is especially useful for integrating CFEngine with other infrastructure components like a CMDB.

CFEngine can load structured data defined in JSON, YAML, CSV using the readjson(), readyaml(), readcsv() and readdata() functions or by custom parsing with data_resdstringarray() and data_readstringarrayidx().

Additionally CFEngine provides the augments file as a way to define variables and classes that are available from the beginning of policy evaluation.

The augments file can be distributed globally as part of your policy by creating def.json in the root of your masterfiles, or it could be generated by the agent itself for use in subsequent runs.

If the augments file is generated on the agent itself we recommend doing so from a separate policy like update.cf.