厨师和邮递员;如何指定密码? [英] Chef and postgres; how do I specify the password?

查看:72
本文介绍了厨师和邮递员;如何指定密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是厨师的新手,我正在尝试解释文档。我已经将opscode postgresql食谱添加到了我的Chef-solo环境。 postgresql似乎可以正常安装和启动,但是很遗憾,我无法登录服务器,使其几乎无法使用。

I'm new to chef, and I'm trying to interprete the documentation. I've added the opscode postgresql recipe to my chef-solo environment. postgresql seems to install and launch just fine, but unfortunately I can't log in to the server, rendering it pretty much unusable.

文档中提到了这一点:


在使用
Chef-client时,以下节点属性存储在Chef Server中。由于chef-solo不会连接到服务器或根本不保存节点对象
,要使密码在chef-solo
运行中始终存在,必须在使用的json_attribs文件中指定它们。对于
例如:

The following node attribute is stored on the Chef Server when using chef-client. Because chef-solo does not connect to a server or save the node object at all, to have the password persist across chef-solo runs, you must specify them in the json_attribs file used. For Example:



{
  "postgresql": {
    "password": {
      "postgres": "iloverandompasswordsbutthiswilldo"
    }
  },
  "run_list": ["recipe[postgresql::server]"]
}

但是,我不知道 json_attribs文件是什么。食谱本身不包含此类文件,我尝试了Google搜索,但没有结果。我还尝试创建这样的文件并将其粘贴在目录结构中的随机位置,但是当然不起作用。

However, I don't know what "the json_attribs" file is. The recipe itself doesn't contain such a file, and I tried googling, with no results. I also tried creating such a file and sticking it in random spots in my directory structure, but of course that didn't work.

然后没有用 ,我的意思是我调出了无业游民的身份,将其缩进去,然后尝试使用 psql -U postgres -W,然后输入我创建的密码...但始终会收到验证错误。还要注意,我知道我为密码提供的值(例如,在上面的示例中代替 iloverandompasswordsbutthiswilldo)应该是密码的MD5哈希,而不是明文,因此正是我所提供的。

And by "didn't work", I mean that I brought vagrant up, ssh'ed in, and tried "psql -U postgres -W" and then entering the password I'd created... but always get an authentication error. Note also that I understand that the value I provide for the password (e.g. in place of "iloverandompasswordsbutthiswilldo" in the example above) is supposed to be an MD5 hash of the password, not plaintext, so that's what I'd provided.

推荐答案

由于您使用的是Vagrant,因此应在Vagrantfile中适当地将以下内容添加到 config.vm中.provision:chef_solo do | chef | 部分(也存在一个或多个 chef.add_recipe 调用):

Since you are using Vagrant you should propably add something like the following to your Vagrantfile into the config.vm.provision :chef_solo do |chef| section (where one or more chef.add_recipe calls exists too):

config.vm.provision :chef_solo do |chef|
  # other stuff... like: chef.add_recipe "postgresql::server"
  chef.json = {
    "postgresql" => {
      "password" => {
        "postgres" => "iloverandompasswordsbutthiswilldo"
      }
    }
  }
end

chef.json 散列是所有节点特定属性的存放地,在Vagrant运行的供应期间将其移交给Chef-solo,请参见流浪文档以获取更多信息。

The chef.json hash is the place where all your node specific attributes go and which is handed over to chef-solo during the provision run by Vagrant, see Vagrant doc for more information.

这篇关于厨师和邮递员;如何指定密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆