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,22 +27,26 @@ end
# Main Part
# -------------------------------------------
# Download:
execute "wget #{download_url} -O #{node['consul-template']['tmp_path']}"
# バージョン確認して、アップデート必要かどうか確認
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']}"
# Unzip:
execute "unzip -qo #{node['consul-template']['tmp_path']}" do
cwd '/opt/consul/bin/'
end
# Unzip:
execute "unzip -qo #{node['consul-template']['tmp_path']}" do
cwd '/opt/consul/bin/'
end
file '/opt/consul/bin/consul-template' do
owner 'root'
group 'root'
mode '755'
end
file '/opt/consul/bin/consul-template' do
owner 'root'
group 'root'
mode '755'
end
# Create link:
link '/usr/local/bin/consul-template' do
user 'root'
to '/opt/consul/bin/consul-template'
# Create link:
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,22 +27,27 @@ end
# Main Part
# -------------------------------------------
# Download:
execute "wget #{download_url} -O #{node['consul']['tmp_path']}"
# バージョン確認して、アップデート必要かどうか確認
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']}"
# Unzip:
execute "unzip -qo #{node['consul']['tmp_path']}" do
cwd '/opt/consul/bin/'
# Unzip:
execute "unzip -qo #{node['consul']['tmp_path']}" do
cwd '/opt/consul/bin/'
end
file '/opt/consul/bin/consul' do
owner 'root'
group 'root'
mode '755'
end
# Create link:
link '/usr/local/bin/consul' do
user 'root'
to '/opt/consul/bin/consul'
end
end
file '/opt/consul/bin/consul' do
owner 'root'
group 'root'
mode '755'
end
# Create link:
link '/usr/local/bin/consul' do
user 'root'
to '/opt/consul/bin/consul'
end

View File

@ -50,12 +50,17 @@ rescue
raise 'Cannot connect to http://github.com.'
end
# Download `nginx-build`:
execute "wget #{nginxbuild} -O #{TARBALL}"
execute "tar xf #{TARBALL} && chown webadm:webadm #{NGINXBUILD}" do
user USER
cwd WORKDIR
# バージョン確認して、アップデート必要かどうか確認
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}"
execute "tar xf #{TARBALL} && chown webadm:webadm #{NGINXBUILD}" do
user USER
cwd WORKDIR
end
end
# Deploy `configure.sh`:

View File

@ -1,6 +1,9 @@
prometheus_url = ''
prometheus_bin = ''
vtag = ''
tag = ''
# Calculate the Download URL:
begin
require 'net/http'
@ -22,28 +25,33 @@ rescue
raise 'Cannot connect to http://github.com.'
end
# Download:
TMP = "/tmp/#{prometheus_bin}"
execute "wget #{prometheus_url} -O #{TMP}"
# バージョン確認して、アップデート必要かどうか確認
result = run_command("prometheus --version 2>&1 | grep #{tag}", error: false)
if result.exit_status != 0
# Download:
TMP = "/tmp/#{prometheus_bin}"
# Install:
directory node['prometheus']['storage'] do
owner 'root'
group 'root'
mode '755'
end
execute "tar zxf #{TMP} -C #{node['prometheus']['storage']} --strip-components 1"
# Change Owner and Permissions:
file "#{node['prometheus']['storage']}prometheus" do
owner 'root'
group 'root'
mode '755'
end
# Create Link
link "#{node['prometheus']['location']}prometheus" do
to "#{node['prometheus']['storage']}prometheus"
execute "wget #{prometheus_url} -O #{TMP}"
# Install:
directory node['prometheus']['storage'] do
owner 'root'
group 'root'
mode '755'
end
execute "tar zxf #{TMP} -C #{node['prometheus']['storage']} --strip-components 1"
# Change Owner and Permissions:
file "#{node['prometheus']['storage']}prometheus" do
owner 'root'
group 'root'
mode '755'
end
# Create Link
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,28 +24,32 @@ rescue
raise 'Cannot connect to http://github.com.'
end
# Download:
TMP = "/tmp/#{node_exporter_bin}"
# バージョン確認して、アップデート必要かどうか確認
result = run_command("node_exporter --version 2>&1 | grep #{tag}", error: false)
if result.exit_status != 0
# Download:
TMP = "/tmp/#{node_exporter_bin}"
execute "wget #{node_exporter_url} -O #{TMP}"
execute "wget #{node_exporter_url} -O #{TMP}"
# Install:
directory node['node_exporter']['storage'] do
owner 'root'
group 'root'
mode '755'
end
execute "tar zxf #{TMP} -C #{node['node_exporter']['storage']} --strip-components 1"
# Change Owner and Permissions:
file "#{node['node_exporter']['storage']}node_exporter" do
owner 'root'
group 'root'
mode '755'
end
# Create Link
link "#{node['node_exporter']['location']}node_exporter" do
to "#{node['node_exporter']['storage']}node_exporter"
# Install:
directory node['node_exporter']['storage'] do
owner 'root'
group 'root'
mode '755'
end
execute "tar zxf #{TMP} -C #{node['node_exporter']['storage']} --strip-components 1"
# Change Owner and Permissions:
file "#{node['node_exporter']['storage']}node_exporter" do
owner 'root'
group 'root'
mode '755'
end
# Create Link
link "#{node['node_exporter']['location']}node_exporter" do
to "#{node['node_exporter']['storage']}node_exporter"
end
end