Puppet Function: to_yaml

Defined in:
modules/stdlib/lib/puppet/functions/to_yaml.rb
Function type:
Ruby 4.x API

Overview

to_yaml(Any $data)String

Examples:

how to output YAML

# output yaml to a file
  file { '/tmp/my.yaml':
    ensure  => file,
    content => to_yaml($myhash),
  }

Parameters:

  • data (Any)

Returns:



11
12
13
14
15
16
17
18
19
20
21
22
# File 'modules/stdlib/lib/puppet/functions/to_yaml.rb', line 11

Puppet::Functions.create_function(:to_yaml) do
  # @param data
  #
  # @return [String]
  dispatch :to_yaml do
    param 'Any', :data
  end

  def to_yaml(data)
    data.to_yaml
  end
end