itamae/cookbooks/consul/install.rb

21 lines
452 B
Ruby
Raw Normal View History

2020-11-22 07:00:00 +00:00
# Install `Consul`:
KEYSRV = "https://apt.releases.hashicorp.com/gpg"
ID = "A3219F7B"
2019-03-03 08:50:49 +00:00
2020-11-22 07:00:00 +00:00
execute "apt-key adv --keyserver #{KEYSRV} --recv-keys #{ID}" do
2020-11-22 08:25:09 +00:00
not_if 'apt-key list | grep HashiCorp'
2019-03-03 08:50:49 +00:00
end
2020-11-22 07:00:00 +00:00
# Retrieve the Ubuntu code:
DIST = run_command('lsb_release -cs').stdout.chomp
2019-03-03 08:50:49 +00:00
2020-11-22 07:00:00 +00:00
# Deploy the `apt` sources:
2021-04-30 05:50:09 +00:00
template '/etc/apt/sources.list.d/hashicorp.list' do
2020-11-22 07:00:00 +00:00
action :create
variables(distribution: DIST)
2019-03-03 08:50:49 +00:00
end
2020-11-22 07:00:00 +00:00
execute 'apt update'
package 'consul'