Print hiera config to multiple lines in config file managed by puppet

puppetvagrant

In my yaml file I have multiple values that need to be printed out into an ini file managed by another php module. I can grab the values through heira and output them to the ini file but it's in the wrong format. Each item in the yaml file has to be separated by a line, how do I achieve this?

Here is my yaml file:

---
nginx:
  phpini:
    - display_errors = On
    - error_reporting = -1
    - date.timezone = "Europe/London"
    - sendmail_path = "/usr/bin/env /usr/local/bin/catchmail"
    - xdebug.default_enable = 1
    - xdebug.remote_autostart = 0
    - xdebug.remote_connect_back = 1
    - xdebug.remote_enable = 1
    - xdebug.remote_handler = "dbgp"
    - xdebug.remote_port = 9000

And this is my manifest why I've tried a few different things without any success:

php::ini { 'php.ini':
  value => [
    $nginx['phpini']
  ],
  require => Package["php5-cli"]
}

Where value is I need to output each value from phpini to a separate line.

Update:

Here is the template file that's being used:

; File Managed by Puppet

<% if @value != "" -%>
<% if @value.is_a? Array -%>
<% @value.each do |name| -%>
<%= name %>
<% end %>
<% else -%>
<%= value %>
<% end -%>
<% end -%>

So the template supports arrays (I think ruby isn't my strong point) but Heira is concatenating the array from the yaml. Calling the data using heira_array makes no difference.

Best Answer

Hiera is fetching as an array, but you're passing it to the template as a string with $nginx['phpini'].join("\n") - switch to passing the variable directly without manipulating it.