From 8d8a6affbd47d5f01b1268d61930571901ee5a23 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 16 Dec 2023 16:18:59 +0900 Subject: [PATCH] Install `cloudflared`. --- cookbooks/base/cloudflared.rb | 19 +++++++++++++++++++ cookbooks/base/default.rb | 3 +++ 2 files changed, 22 insertions(+) create mode 100644 cookbooks/base/cloudflared.rb diff --git a/cookbooks/base/cloudflared.rb b/cookbooks/base/cloudflared.rb new file mode 100644 index 0000000..907960e --- /dev/null +++ b/cookbooks/base/cloudflared.rb @@ -0,0 +1,19 @@ +URL='https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64' +BINARY='/usr/local/bin/cloudflared' + +[ + "wget #{URL} -O #{BINARY}", +].each do |cmd| + execute cmd do + user 'root' + cwd '/tmp/itamae_tmp/' + + not_if "test -e #{BINARY}" + end +end + +file "#{BINARY}" do + owner 'root' + group 'root' + mode '755' +end diff --git a/cookbooks/base/default.rb b/cookbooks/base/default.rb index c2824b7..162ddbd 100644 --- a/cookbooks/base/default.rb +++ b/cookbooks/base/default.rb @@ -66,6 +66,9 @@ include_recipe './lsyncd.rb' # Install starship command: include_recipe './starship.rb' +# Install cloudflared command: +include_recipe './cloudflared.rb' + # recipes for Ubuntu 20.04 and later case node['platform_version'] when "20.04", "22.04"