Configuration file syntax
Puppet supports two formats for configuration files: valid JSON and Human-Optimized Config Object Notation (HOCON), which is a JSON superset. We've provided these syntax examples to guide you when you're writing configuration files.
For details about HOCON itself, refer to the HOCON documentation.
Brackets
JSON example with brackets:
{ "authorization": { "version": 1 } }
In HOCON, you can omit the brackets ({ }
) around the root object.
For example:
"authorization": { "version": 1 }
Quotation marks
With JSON, wrap keys in double quotes. Quotation marks around values depends on the value type, such as an integer or string. For example:
"authorization": { "version": 1 }
In HOCON, double quotes around keys and string values are usually optional. However,
double quotes are required if the string contains any of these characters:
*
, ^
, +
, :
,
or =
For example:
authorization: { version: 1 }
Commas
In JSON, use commas to separate items in a map or array.
JSON map example:
rbac: { password-reset-expiration: 24, session-timeout: 60, failed-attempts-lockout: 10, }
JSON array example:
http-client: { ssl-protocols: [TLSv1, TLSv1.1, TLSv1.2, TLSv1.3] }
When writing a map or array in HOCON, you can use a new line instead of a comma.
HOCON map example:
rbac: { password-reset-expiration: 24 session-timeout: 60 failed-attempts-lockout: 10 }
HOCON array example:
http-client: { ssl-protocols: [ TLSv1 TLSv1.1 TLSv1.2 ] }
Comments
JSON does not support comments.
In HOCON, you can use //
or #
to delineate
comments. Inline comments are supported. For
example:
authorization: { version: 1 rules: [ { # Allow nodes to retrieve their own catalog match-request: { path: "^/puppet/v3/catalog/([^/]+)$" type: regex method: [get, post] } } ] }