#
# Use Basho via APT to PACKAGECLOUD repository
#
package 'apt-transport-https' do
  action :install
end

apt_repository 'basho-riak' do
  uri          'https://packagecloud.io/basho/riak/ubuntu/'
  distribution node["lsb"]["codename"]
  components   ["main"]
  key          'https://packagecloud.io/gpg.key'

  action :add
end

package 'riak' do
  action :install
end

#
# - Stop riak service to customize configuration files
# - Don't enable riak service at server boot time
#
service 'riak' do
  supports :status => true, :restart => true
  action [:disable, :stop]
end

template "/etc/riak/riak.conf" do
  source "riak.conf.erb"
  owner  'riak'
  group  'riak'
  mode   0644
end

#
# Use Basho via APT to PACKAGECLOUD repository
#
package 'apt-transport-https' do
  action :install
end

apt_repository 'basho-riak' do
  uri          'https://packagecloud.io/basho/riak/ubuntu/'
  distribution node["lsb"]["codename"]
  components   ["main"]
  key          'https://packagecloud.io/gpg.key'

  action :add
end

package 'riak' do
  action :install
end

#
# - Stop riak service to customize configuration files
# - Don't enable riak service at server boot time
#
service 'riak' do
  supports :status => true, :restart => true
  action [:disable, :stop]
end

template "/etc/riak/riak.conf" do
  source "riak.conf.erb"
  owner  'riak'
  group  'riak'
  mode   0644
end

execute "remove Bashio APT package source" do
  command "rm -f /etc/apt/sources.list.d/basho-riak-source.list"
end

Remove packagecloud.io source after installing Riak
Remove packagecloud.io source after installing Riak

This caused issues with our APT cacher

See http://www.traviscistatus.com/incidents/wpfs5nz0ybks
