#
# Cookbook Name:: kosmos-base
# Recipe:: default
#
# Copyright 2015, Kosmos
#
# All rights reserved - Do Not Redistribute
#

include_recipe 'timezone-ii'

node.override['omnibus_updater']['version']              = '12.6.0'
node.override['omnibus_updater']['kill_chef_on_upgrade'] = false
include_recipe 'omnibus_updater'

package 'mailutils'
node.override['unattended-upgrades']['admin_email'] = 'ops@5apps.com'
include_recipe 'unattended-upgrades'

package 'ruby2.1'
package 'ruby2.1-dev'

package 'mosh'

include_recipe 'users::sysadmins'

node.override['authorization']['sudo']['passwordless'] = true
include_recipe 'sudo'

include_recipe 'kosmos-postfix'

node.override['set_fqdn'] = '*'
include_recipe 'hostname'

include_recipe 'kosmos-base::firewall'

package 'ca-certificates'

directory '/usr/local/share/ca-certificates/cacert' do
  action :create
end

['http://www.cacert.org/certs/root.crt', 'http://www.cacert.org/certs/class3.crt'].each do |cert|
  remote_file "/usr/local/share/ca-certificates/cacert/#{File.basename(cert)}" do
    source cert
    action :create_if_missing
    notifies :run, 'execute[update-ca-certificates]', :immediately
  end
end

execute 'update-ca-certificates' do
  action :nothing
end
