In my attributes file for postgresql recipe I have:
default[\'postgresql\'][\'pg_hba\'] = {
:comment => \'# IPv4 lo
Your problem is here:
node['postgresql']['pg_hba'] << {
This way you're accessing the attribute for reading.
Assuming you want to stay at default level you have to use default method like this:
node.default['postgresql']['pg_hba'] << { ... }
This will call default method (like in attribute file) to add the entry.
For this to work the first attribute declaration should be an array (or a hash of hash) like this:
default['postgresql']['pg_hba'] = [{ # notice the [ opening an array
:comment => '# IPv4 local connections',
:type => 'host',
:db => 'all',
:user => 'all',
:addr => '127.0.0.1/32',
:method => 'md5'
}] # Same here to close the array