itamae/cookbooks/consul/install.rb

23 lines
494 B
Ruby
Raw Normal View History

2024-04-06 08:24:01 +00:00
# apt source:
SRC = 'https://apt.releases.hashicorp.com/gpg'
DEST = '/usr/share/keyrings/hashicorp-archive-keyring.gpg'
2019-03-03 08:50:49 +00:00
2024-04-06 08:24:01 +00:00
execute "wget -O- #{SRC} | gpg --dearmor -o #{DEST}" do
not_if "test -e #{DEST}"
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
execute 'apt update' do
not_if 'which consul'
end
2020-11-22 07:00:00 +00:00
package 'consul'