LoginSignup
2
2

More than 5 years have passed since last update.

zerocook.sh(仮)

Last updated at Posted at 2015-10-20

knife-zero/chef-zero(chef-server)のQUERYはどうも好きになれない
knife-soloやchef-soloのようにもっと気軽に単一ホストに流したい

 ⇒ bootstrapで出来たnodeファイルに対して実行してみました

Usage
# 単一ノード
./zerocook.sh -W --sudo nodes/test-app01.json

# 複数ノード
./zerocook.sh -W --sudo nodes/test-app01.json nodes/test-db01.json

# 複数ノード2
./zerocook.sh -W --sudo nodes/test-app*
zerocook.sh
#!/bin/sh

for opts in $@
do
  if [ -e $opts ];then
    QUERY=(${QUERY[@]} "ipaddress:`grep '"ipaddress":' $opts|grep -Po '\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b'`")
  else
    OPTS=(${OPTS[@]} $opts)
  fi
done

knife zero converge ''"${QUERY[*]}"'' ${OPTS[@]}
  • bootstrapした後に使います
  • gnu-grepが必要です
  • automatic.ipaddressでホストを特定しています
    • AWSとかでEIPに向けて使う場合は適当に変更してく下さい
  • その他適当にオプションやクエリ部分を変更して使って下さい
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2