2013-08-18 113 views
0

我正在学习厨师,并通过#learnchef tutorials,特别是EC2多节点EC2之一。我正在努力理解特定章节中的含义。厨师和多节点ec2教程

在第10条,它说:

Next, we need to drop configuration files for Redis, specifically, we need the hostname. We can leverage Chef search for this: 

redis_server = search(:node, 'role:redis').first 

template "#{node['my_app']['root']}/shared/config/redis.yml" do 
    source  'config/redis.yml.erb' 
    owner   node['apache']['user'] 
    group   node['apache']['group'] 
    mode   '0755' 
    variables(
    :host => redis_server['ec2']['local_ipv4'] 
) 
end 

然后,Add the associated template in templates/default/config/redis.yml.erb:

# This file was created by Chef for <%= node['fqdn'] %> 
# Do NOT modify this file by hand! 

host: "<%= @host %>" 

很显然,我明白了后者,但它是什么意思: “降配置文件的Redis”?

我应该将某些东西当作命令运行,还是需要在我的食谱文件中执行?

+1

您是否找到解决此问题的解决方案?回答你自己的问题是可以的。请不要忘记标记答案是正确的! :) – sethvargo

回答

1

当他们说drop时,他们的意思是在/templates/default/config/redis.yml.erb中设置模板文件,并允许Chef recipe在机器上创建安装redis。