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
|
2019-11-05 15:37:15 +00:00
|
|
|
|
2022-08-11 03:21:34 +00:00
|
|
|
execute 'apt update' do
|
|
|
|
not_if 'which consul'
|
|
|
|
end
|
2020-11-22 07:00:00 +00:00
|
|
|
|
|
|
|
package 'consul'
|