41 lines
1001 B
Ruby
41 lines
1001 B
Ruby
|
#
|
||
|
# Cookbook:: kosmos_zerotier
|
||
|
# Recipe:: zncui
|
||
|
#
|
||
|
|
||
|
package_path = "/opt/ztncui_#{node['ztncui']['version']}_amd64.deb"
|
||
|
|
||
|
remote_file package_path do
|
||
|
source "https://s3-us-west-1.amazonaws.com/key-networks/deb/ztncui/1/x86_64/ztncui_#{node['ztncui']['version']}_amd64.deb"
|
||
|
checksum node['ztncui']['checksum']
|
||
|
action :create_if_missing
|
||
|
notifies :run, 'bash[install_ztncui_package]', :immediately
|
||
|
end
|
||
|
|
||
|
bash 'install_ztncui_package' do
|
||
|
code "apt-get install -y #{package_path}"
|
||
|
action :nothing
|
||
|
end
|
||
|
|
||
|
service "ztncui" do
|
||
|
action [:enable, :start]
|
||
|
end
|
||
|
|
||
|
template '/opt/key-networks/ztncui/.env' do
|
||
|
source 'ztncui.env.erb'
|
||
|
mode '0644'
|
||
|
variables http_all_interfaces: node['ztncui']['http_all_interfaces']
|
||
|
notifies :restart, 'service[ztncui]', :delayed
|
||
|
end
|
||
|
|
||
|
include_recipe 'kosmos-base::firewall'
|
||
|
|
||
|
if node['ztncui']['http_allow_access_from']
|
||
|
firewall_rule 'zncui_http' do
|
||
|
port 3000
|
||
|
protocol :tcp
|
||
|
command :allow
|
||
|
source node['ztncui']['http_allow_access_from']
|
||
|
end
|
||
|
end
|