Help us understand the problem. What is going on with this article?

knife soloでdata_bagsを使う

More than 5 years have passed since last update.

秘密鍵を作成する

openssl rand -base64 512 | tr -d '\r\n' > data_bag_key

knife-solo_data_bagをインストール

gem install knife-solo_data_bag

data_bagsを作成する

knife solo data bag create staging leftronic --json '{"id": "leftronic", "key": "${leftronic_password}"}'
knife solo data bag create production leftronic --json '{"id": "leftronic", "key": "${leftronic_password}"}'

登録されているかどうか確認

knife solo data bag show staging leftronic

data_bagsをレシピから取得する

default.rb
data_bag = Chef::EncryptedDataBagItem.load("staging", "leftronic")
p data_bag['key']

templateで使用

default.rb
template "/etc/td-agent/conf.d/aggregate_pageview.conf" do
  mode "0644"
  source "aggregate_pageview.conf.erb"
  variables(:leftronic_key => data_bag['key'])  
end
toyama0919
Data Engineer.
dena_coltd
    Delight and Impact the World
https://dena.com/jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした