Postgresql 厨师长solo未更新postgres pg_hba.conf
我正在使用Chef Solo提供一个流浪虚拟机。以下是相关的文件片段:Postgresql 厨师长solo未更新postgres pg_hba.conf,postgresql,chef-infra,access-control,Postgresql,Chef Infra,Access Control,我正在使用Chef Solo提供一个流浪虚拟机。以下是相关的文件片段: chef.run_list = [ "databox::default", "mydbstuff" ] chef.json = { "postgresql": { "config" : { "listen_addresses": "*" }, "pg_hba": [ {"type": "local",
chef.run_list = [
"databox::default",
"mydbstuff"
]
chef.json = {
"postgresql": {
"config" : {
"listen_addresses": "*"
},
"pg_hba": [
{"type": "local", "db": "all", "user": "postgres", "addr": null, "method": "ident"},
{"type": "local", "db": "all", "user": "all", "addr": null, "method": "md5"},
{"type": "host", "db": "all", "user": "all", "addr": "127.0.0.1/32", "method": "md5"},
{"type": "host", "db": "all", "user": "all", "addr": "::1/128", "method": "md5"},
{"type": "local", "db": "all", "user": "vagrant", "addr": null, "method": "ident"},
{"type": "host", "db": "all", "user": "all", "addr": "192.168.248.1/24", "method": "md5"}
]
},
"databox": {
"db_root_password": "abc123",
"databases": {
"postgresql": [
{ "username": "db1", "password": "abc123", "database_name": "db1" },
{ "username": "db2", "password": "abc123", "database_name": "db2" }
]
}
}
}
mydbstuff::default
配方如下所示:
postgresql_connection_info = {
:host => "localhost",
:port => node['postgresql']['config']['port'],
:username => 'postgres',
:password => node['postgresql']['password']['postgres']
}
postgresql_database_user 'vagrant' do
connection postgresql_connection_info
password 'vagrant'
action :create
end
node['databox']['databases']['postgresql'].each do |db|
postgresql_database_user 'vagrant' do
connection postgresql_connection_info
action :grant
database_name db.database_name
end
end
我正在尝试允许本地vagrant
用户在没有密码的情况下进行连接,以及允许来自VirtualBox专用网络的任何用户进行连接。我的chef.json
中的pg_hba
数组有四行是从默认配置复制的,还有两行是我想做的其他事情。如果我手动将这两行添加到pg_hba.conf
文件中,它们就可以正常工作
问题是我的更改实际上没有写入
pg_hba.conf
文件。是什么阻止了它们被编写?似乎数据盒食谱使用了节点。设置了
,而不仅仅是修改它需要的部分
我已提交项目以更改此行为,以便可以向文件中添加其他条目。我在chef solo中遇到了同样的问题。我的解决方法是为pg_hba.conf创建一个模板,并在recipe执行结束时替换