Created
July 29, 2014 17:27
-
-
Save bageljp/969613dbecc19a80c130 to your computer and use it in GitHub Desktop.
chefでconf一式を反映させたい ref: http://qiita.com/bageljp@github/items/16808a4c32270edb0ba3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Chef::Config[:cookbook_path].each{|elem| | |
if File.exists?(File.join(elem, "/nginx/templates/default/", node['nginx']['template_dir'])) | |
conf_dir = File.join(elem, "/nginx/templates/default/", node['nginx']['template_dir']) | |
Dir.chdir conf_dir | |
confs = Dir::glob("**/*") | |
confs.each do |t| | |
if File::ftype("#{conf_dir}/#{t}") == "file" | |
template "/etc/nginx/#{t}" do | |
owner "root" | |
group "root" | |
mode 00644 | |
source "#{node['nginx']['template_dir']}/#{t}" | |
notifies :restart, "service[nginx]" | |
end | |
else | |
directory "/etc/nginx/#{t}" do | |
owner "root" | |
group "root" | |
mode 00755 | |
end | |
end | |
end | |
end | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ tree nginx/templates/default/conf_web | |
nginx/templates/default/conf_web | |
├── conf.d | |
│ ├── ssl.conf | |
│ └── virtual.conf | |
├── fastcgi.conf | |
├── fastcgi_params | |
├── nginx.conf | |
├── scgi_params | |
├── conf.d | |
│ ├── server.key | |
│ └── server.crt | |
└── uwsgi_params |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment