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

View File

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

View File

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

View File

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

View File

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