Merge branch 'consider-version-when-downloading' of kazu634/itamae into master

This commit is contained in:
Kazuhiro MUSASHI 2019-11-08 01:34:02 +09:00 committed by Gitea
commit 4b157c3f5d
5 changed files with 111 additions and 80 deletions

View File

@ -2,6 +2,7 @@
# Calculating the latest `consul-template` version:
# -------------------------------------------
download_url = ''
tag_version = ''
begin
require 'net/http'
@ -26,6 +27,9 @@ end
# Main Part
# -------------------------------------------
# バージョン確認して、アップデート必要かどうか確認
result = run_command("consul-template --version 2>&1 | grep #{tag_version}", error: false)
if result.exit_status != 0
# Download:
execute "wget #{download_url} -O #{node['consul-template']['tmp_path']}"
@ -45,3 +49,4 @@ link '/usr/local/bin/consul-template' do
user 'root'
to '/opt/consul/bin/consul-template'
end
end

View File

@ -2,6 +2,7 @@
# Calculating the latest `consul` version:
# -------------------------------------------
download_url = ''
tag_version = ''
begin
require 'net/http'
@ -26,6 +27,9 @@ end
# Main Part
# -------------------------------------------
# バージョン確認して、アップデート必要かどうか確認
result = run_command("consul version | grep #{tag_version}", error: false)
if result.exit_status != 0
# Download:
execute "wget #{download_url} -O #{node['consul']['tmp_path']}"
@ -45,3 +49,5 @@ link '/usr/local/bin/consul' do
user 'root'
to '/opt/consul/bin/consul'
end
end

View File

@ -50,6 +50,10 @@ rescue
raise 'Cannot connect to http://github.com.'
end
# バージョン確認して、アップデート必要かどうか確認
result = run_command("/home/webadm/nginx-build/nginx-build --version | grep #{tag_version}", error: false)
if result.exit_status != 0
# Download `nginx-build`:
execute "wget #{nginxbuild} -O #{TARBALL}"
@ -57,6 +61,7 @@ execute "tar xf #{TARBALL} && chown webadm:webadm #{NGINXBUILD}" do
user USER
cwd WORKDIR
end
end
# Deploy `configure.sh`:
remote_file "#{WORKDIR}/configure.sh" do

View File

@ -1,6 +1,9 @@
prometheus_url = ''
prometheus_bin = ''
vtag = ''
tag = ''
# Calculate the Download URL:
begin
require 'net/http'
@ -22,6 +25,10 @@ rescue
raise 'Cannot connect to http://github.com.'
end
# バージョン確認して、アップデート必要かどうか確認
result = run_command("prometheus --version 2>&1 | grep #{tag}", error: false)
if result.exit_status != 0
# Download:
TMP = "/tmp/#{prometheus_bin}"
@ -47,3 +54,4 @@ end
link "#{node['prometheus']['location']}prometheus" do
to "#{node['prometheus']['storage']}prometheus"
end
end

View File

@ -1,6 +1,9 @@
node_exporter_url = ''
node_exporter_bin = ''
tag = ''
vtag = ''
# Calculate the Download URL:
begin
require 'net/http'
@ -21,6 +24,9 @@ rescue
raise 'Cannot connect to http://github.com.'
end
# バージョン確認して、アップデート必要かどうか確認
result = run_command("node_exporter --version 2>&1 | grep #{tag}", error: false)
if result.exit_status != 0
# Download:
TMP = "/tmp/#{node_exporter_bin}"
@ -46,3 +52,4 @@ end
link "#{node['node_exporter']['location']}node_exporter" do
to "#{node['node_exporter']['storage']}node_exporter"
end
end