diff --git a/attributes/default.rb b/attributes/default.rb index d4e834f..b24821e 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -2,7 +2,9 @@ default[:nginx][:version] = "1.4.1" if node[:platform_version].to_f < 12.04 default[:nginx][:apt_packages] = %w[nginx-common nginx-full nginx] default[:nginx][:apt_keyserver] = "keyserver.ubuntu.com" - +default[:nginx][:apt_key] = "C300EE8C" +default[:nginx][:apt_uri] = "http://ppa.launchpad.net/nginx/stable/ubuntu" +default[:nginx][:distribution] = node[:lsb][:codename] default[:nginx][:dir] = "/etc/nginx" default[:nginx][:log_dir] = "/var/log/nginx" default[:nginx][:access_log_format] = "default" diff --git a/recipes/default.rb b/recipes/default.rb index 671fc43..fdab931 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,11 +1,11 @@ include_recipe "apt" apt_repository "nginx" do - uri "http://ppa.launchpad.net/nginx/stable/ubuntu" - distribution node[:nginx][:distribution] - components node[:nginx][:components] - keyserver node[:nginx][:apt_keyserver] - key "C300EE8C" + uri node[:nginx][:apt_uri] + distribution node[:nginx][:distribution] + components node[:nginx][:components] + keyserver node[:nginx][:apt_keyserver] + key node[:nginx][:apt_key] action :add end @@ -17,7 +17,7 @@ end end -%w[nginx nginx-common nginx-full].each do |nginx_package| +node[:nginx][:apt_packages].each do |nginx_package| bash "freeze #{nginx_package}" do code "echo #{nginx_package} hold | dpkg --set-selections" only_if "[ $(dpkg --get-selections | grep -c '#{nginx_package}\W*hold') = 0 ]"