5 # Copyright 2010, Tom Hughes
 
   7 # Licensed under the Apache License, Version 2.0 (the "License");
 
   8 # you may not use this file except in compliance with the License.
 
   9 # You may obtain a copy of the License at
 
  11 #     https://www.apache.org/licenses/LICENSE-2.0
 
  13 # Unless required by applicable law or agreed to in writing, software
 
  14 # distributed under the License is distributed on an "AS IS" BASIS,
 
  15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16 # See the License for the specific language governing permissions and
 
  17 # limitations under the License.
 
  23   update-notifier-common
 
  26 file "/etc/motd.tail" do
 
  30 apt_update "/etc/apt/sources.list" do
 
  34 archive_host = if node[:country]
 
  35                  "#{node[:country]}.archive.ubuntu.com"
 
  40 template "/etc/apt/sources.list" do
 
  41   source "sources.list.erb"
 
  45   variables :archive_host => archive_host, :codename => node[:lsb][:codename]
 
  46   notifies :update, "apt_update[/etc/apt/sources.list]", :immediately
 
  49 repository_actions = Hash.new do |_, repository|
 
  50   node[:apt][:sources].include?(repository) ? :add : :remove
 
  53 apt_repository "brightbox-ruby-ng" do
 
  54   action repository_actions["brightbox-ruby-ng"]
 
  55   uri "ppa:brightbox/ruby-ng"
 
  58 apt_repository "ubuntugis-stable" do
 
  59   action repository_actions["ubuntugis-stable"]
 
  60   uri "ppa:ubuntugis/ppa"
 
  63 apt_repository "ubuntugis-unstable" do
 
  64   action repository_actions["ubuntugis-unstable"]
 
  65   uri "ppa:ubuntugis/ubuntugis-unstable"
 
  68 apt_repository "openstreetmap" do
 
  69   action repository_actions["openstreetmap"]
 
  70   uri "ppa:osmadmins/ppa"
 
  73 apt_repository "squid2" do
 
  74   action repository_actions["squid2"]
 
  75   uri "ppa:osmadmins/squid2"
 
  78 apt_repository "squid3" do
 
  79   action repository_actions["squid3"]
 
  80   uri "ppa:osmadmins/squid3"
 
  83 apt_repository "management-component-pack" do
 
  84   action repository_actions["management-component-pack"]
 
  85   uri "https://downloads.linux.hpe.com/SDR/repo/mcp"
 
  86   distribution "#{node[:lsb][:codename]}/current-gen9"
 
  87   components ["non-free"]
 
  88   key "C208ADDE26C2B797"
 
  91 apt_repository "hwraid" do
 
  92   action repository_actions["hwraid"]
 
  93   uri "https://hwraid.le-vert.net/ubuntu"
 
  94   distribution "precise"
 
  96   key "6005210E23B3D3B4"
 
  99 apt_repository "nginx" do
 
 100   action repository_actions["nginx"]
 
 102   uri "https://nginx.org/packages/ubuntu"
 
 104   key "ABF5BD827BD9BF62"
 
 107 apt_repository "elasticsearch5.x" do
 
 108   action repository_actions["elasticsearch5.x"]
 
 109   uri "https://artifacts.elastic.co/packages/5.x/apt"
 
 110   distribution "stable"
 
 112   key "D27D666CD88E42B4"
 
 115 apt_repository "elasticsearch6.x" do
 
 116   action repository_actions["elasticsearch6.x"]
 
 117   uri "https://artifacts.elastic.co/packages/6.x/apt"
 
 118   distribution "stable"
 
 120   key "D27D666CD88E42B4"
 
 123 apt_repository "passenger" do
 
 124   action repository_actions["passenger"]
 
 125   uri "https://oss-binaries.phusionpassenger.com/apt/passenger"
 
 127   key "561F9B9CAC40B2F7"
 
 130 apt_repository "postgresql" do
 
 131   action repository_actions["postgresql"]
 
 132   uri "https://apt.postgresql.org/pub/repos/apt"
 
 133   distribution "#{node[:lsb][:codename]}-pgdg"
 
 135   key "7FCC7D46ACCC4CF8"
 
 138 apt_repository "mediawiki" do
 
 139   action repository_actions["mediawiki"]
 
 140   uri "https://releases.wikimedia.org/debian"
 
 141   distribution "jessie-mediawiki"
 
 143   key "90E9F83F22250DD7"
 
 146 package "unattended-upgrades"
 
 148 if Dir.exist?("/usr/share/unattended-upgrades")
 
 149   auto_upgrades = if node[:apt][:unattended_upgrades][:enable]
 
 150                     IO.read("/usr/share/unattended-upgrades/20auto-upgrades")
 
 152                     IO.read("/usr/share/unattended-upgrades/20auto-upgrades-disabled")
 
 155   file "/etc/apt/apt.conf.d/20auto-upgrades" do
 
 159     content auto_upgrades
 
 163 template "/etc/apt/apt.conf.d/60chef" do
 
 164   source "apt.conf.erb"