From cb2f425bbce20bbb6a89a1d5529b2ea09a620727 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 18 Feb 2024 11:17:11 +0900 Subject: [PATCH 1/5] Install `mise`. --- cookbooks/kazu634/default.rb | 2 ++ .../files/etc/apt/sources.list.d/mise.list | 1 + cookbooks/kazu634/mise.rb | 27 +++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 cookbooks/kazu634/files/etc/apt/sources.list.d/mise.list create mode 100644 cookbooks/kazu634/mise.rb diff --git a/cookbooks/kazu634/default.rb b/cookbooks/kazu634/default.rb index 13ebf98..4021165 100644 --- a/cookbooks/kazu634/default.rb +++ b/cookbooks/kazu634/default.rb @@ -5,3 +5,5 @@ include_recipe './ssh.rb' include_recipe './vim.rb' include_recipe './mc.rb' + +include_recipe './mise.rb' diff --git a/cookbooks/kazu634/files/etc/apt/sources.list.d/mise.list b/cookbooks/kazu634/files/etc/apt/sources.list.d/mise.list new file mode 100644 index 0000000..1d0b734 --- /dev/null +++ b/cookbooks/kazu634/files/etc/apt/sources.list.d/mise.list @@ -0,0 +1 @@ +deb [signed-by=/etc/apt/keyrings/mise-archive-keyring.gpg arch=amd64] https://mise.jdx.dev/deb stable main diff --git a/cookbooks/kazu634/mise.rb b/cookbooks/kazu634/mise.rb new file mode 100644 index 0000000..469ab03 --- /dev/null +++ b/cookbooks/kazu634/mise.rb @@ -0,0 +1,27 @@ +directory '/etc/apt/keyrings/' do + owner 'root' + group 'root' + mode '0755' +end + +execute 'wget -qO - https://mise.jdx.dev/gpg-key.pub | gpg --dearmor | tee /etc/apt/keyrings/mise-archive-keyring.gpg' do + not_if 'test -f /etc/apt/keyrings/mise-archive-keyring.gpg' +end + +remote_file '/etc/apt/sources.list.d/mise.list' do + owner 'root' + group 'root' + mode '0644' +end + +execute 'apt update' do + not_if 'which mise' +end + +package 'mise' + + +# For Ruby installation: +%w( git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev ).each do |p| + package p +end From d2af0aa76a55db8dc9d2dc40917c1dd09ac7979b Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 31 Mar 2024 09:52:24 +0900 Subject: [PATCH 2/5] Add `.mise.toml`. --- .mise.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .mise.toml diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 0000000..c8650bc --- /dev/null +++ b/.mise.toml @@ -0,0 +1,2 @@ +[tools] +ruby = "3.2.2" From c19e8caa73600698c1723f7bbe3f778f80bd6d96 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 31 Mar 2024 17:23:40 +0900 Subject: [PATCH 3/5] For `vault agent` to function properly, add `HOME` environment variable. --- cookbooks/consul/files/etc/default/vault-agent-consul-jwt | 1 + 1 file changed, 1 insertion(+) diff --git a/cookbooks/consul/files/etc/default/vault-agent-consul-jwt b/cookbooks/consul/files/etc/default/vault-agent-consul-jwt index 2fc3ddc..6e8b836 100644 --- a/cookbooks/consul/files/etc/default/vault-agent-consul-jwt +++ b/cookbooks/consul/files/etc/default/vault-agent-consul-jwt @@ -1 +1,2 @@ VAULT_ADDR="http://192.168.10.142:8200" +HOME="/tmp" From 55b473a646e6ace39a07a5e36e666e9537f7c068 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 31 Mar 2024 20:07:39 +0900 Subject: [PATCH 4/5] Update sources.list and GPG key for Vector. --- .../files/etc/apt/sources.list.d/vector.list | 1 + cookbooks/vector/install.rb | 21 +++++++------------ .../etc/apt/sources.list.d/timber-vector.list | 3 --- 3 files changed, 8 insertions(+), 17 deletions(-) create mode 100644 cookbooks/vector/files/etc/apt/sources.list.d/vector.list delete mode 100644 cookbooks/vector/templates/etc/apt/sources.list.d/timber-vector.list diff --git a/cookbooks/vector/files/etc/apt/sources.list.d/vector.list b/cookbooks/vector/files/etc/apt/sources.list.d/vector.list new file mode 100644 index 0000000..5170350 --- /dev/null +++ b/cookbooks/vector/files/etc/apt/sources.list.d/vector.list @@ -0,0 +1 @@ +deb [signed-by=/usr/share/keyrings/datadog-archive-keyring.gpg] https://apt.vector.dev/ stable vector-0 diff --git a/cookbooks/vector/install.rb b/cookbooks/vector/install.rb index 8d1b39f..2b6b06f 100644 --- a/cookbooks/vector/install.rb +++ b/cookbooks/vector/install.rb @@ -1,20 +1,13 @@ -KEY='https://repositories.timber.io/public/vector/gpg.3543DB2D0A2BC4B8.key' - -execute "wget -O /tmp/vector.key #{KEY}" do - not_if 'apt-key list | grep "1E46 C153"' +%w("DATADOG_APT_KEY_CURRENT.public" "DATADOG_APT_KEY_C0962C7D.public" "DATADOG_APT_KEY_F14F620E.public").each do |key| + execute "wget -O /tmp/#{key} https://keys.datadoghq.com/#{key}" + execute "cat /tmp/#{key} | gpg --import --batch --no-default-keyring --keyring /usr/share/keyrings/datadog-archive-keyring.gpg" end -execute 'apt-key add /tmp/vector.key' do - not_if 'apt-key list | grep "1E46 C153"' -end - -# Retrieve the Ubuntu code: -DIST = run_command('lsb_release -cs').stdout.chomp - # Deploy the `apt` sources: -template '/etc/apt/sources.list.d/timber-vector.list' do - action :create - variables(distribution: DIST) +remote_file '/etc/apt/sources.list.d/vector.list' do + owner 'root' + group 'root' + mode '0644' end execute 'apt update' do diff --git a/cookbooks/vector/templates/etc/apt/sources.list.d/timber-vector.list b/cookbooks/vector/templates/etc/apt/sources.list.d/timber-vector.list deleted file mode 100644 index a692b57..0000000 --- a/cookbooks/vector/templates/etc/apt/sources.list.d/timber-vector.list +++ /dev/null @@ -1,3 +0,0 @@ -deb https://repositories.timber.io/public/vector/deb/ubuntu <%= @distribution %> main - -deb-src https://repositories.timber.io/public/vector/deb/ubuntu <%= @distribution %> main From aac5e559162c61d64065c0128554a747cacfa19e Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 31 Mar 2024 20:09:40 +0900 Subject: [PATCH 5/5] Update comment of `ubuntu.rake`. --- tasks/ubuntu.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/ubuntu.rake b/tasks/ubuntu.rake index 0a2cea7..657ab29 100755 --- a/tasks/ubuntu.rake +++ b/tasks/ubuntu.rake @@ -1,6 +1,6 @@ #!/usr/bin/env rake -desc 'Invoke itamae command for the first time' +desc 'Invoke itamae command for AWS Environment for the first time' task :ubuntu do node = `ls -1 nodes/*.json | xargs -I % basename % .json | fzf` node.chomp!