Use `eget` to download and install `consul-template`.

This commit is contained in:
Kazuhiro MUSASHI 2024-06-10 11:45:12 +09:00
parent 4f2aeaac41
commit 6bc876df6f
2 changed files with 4 additions and 9 deletions

View File

@ -1,10 +1,12 @@
# -------------------------------------------
# Specifying the default settings:
# -------------------------------------------
node.reverse_merge!({
'consulTemplate' => {
'baseUrl' => 'https://releases.hashicorp.com/consul-template/',
'version' => '0.25.2',
'version' => `curl -s https://releases.hashicorp.com/consul-template/ | htmlq -t 'a' | grep consul-template | head -n 1 | sed -e 's/^[^_]*_//g'`.chomp!,
'zipPrefix' => 'consul-template_',
'zipPostfix' => '_linux_amd64.zip',
'storage' => '/opt/consul-template/consul-template',

View File

@ -5,20 +5,13 @@ consulTemplate_url = "#{node['consulTemplate']['baseUrl']}#{node['consulTemplate
result = run_command('which consul-template', error: false)
if result.exit_status != 0
# Download:
TMP = "/tmp/#{consulTemplate_zip}"
execute "wget #{consulTemplate_url} -O #{TMP}"
directory '/opt/consul-template' do
owner 'root'
group 'root'
mode '0755'
end
execute "unzip #{TMP} -d /opt/consul-template/" do
not_if 'test -e /opt/consul-template/consul-template'
end
execute "eget #{consulTemplate_url} --to /opt/consul-template/"
# Change Owner and Permissions:
file "#{node['consulTemplate']['storage']}" do