Skip to content

Instantly share code, notes, and snippets.

@TAKAyukiatkwsk
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TAKAyukiatkwsk/9084484 to your computer and use it in GitHub Desktop.
Save TAKAyukiatkwsk/9084484 to your computer and use it in GitHub Desktop.
chef-soloでArchLinuxにいろいろ設定したかった...
  • paravirtual の arch linux AMI からインスタンスを作る
  • chef solo で準備
  • knife solo prepare でリモートサーバーにchef をインストールする
  • Arch linux だとうまくいかない
  • リモートサーバー上で直接Chefをインストールすることにした
  • curl -L https://www.opscode.com/chef/install.sh | bash してもコケる
  • gem からインストールする
  • まずは ruby をインストール
  • pacman -S extra/ruby
2013-10-29
The in-EC2 mirrors are currently offline, and may not be up again anytime soon. I've received offers from people to host package mirrors for the EC2-specific packages, and I will update this page as needed. Users should migrate to one of the official public Arch Linux mirrors for every repository except 'ec2'.

https://www.uplinklabs.net/projects/arch-linux-on-ec2/

  • /etc/pacman.d/mirrorlist にJapanのミラーを追加する
  • pacman -Syy でアップデート
  • gem install chef
  • export PATH=$PATH:/root/.gem/ruby/2.0.0/bin
knife --version
Chef: 11.8.0
$ knife solo cook root@hostname
ERROR: RuntimeError: Couldn't find Chef >=0.10.4 on 54.238.207.190. Please run `knife solo prepare root@54.238.207.190` to ensure Chef is installed and up to date.

knife solo cook --no-chef-check root@54.238.207.190 で実行するが...

ERROR: RuntimeError: Failed to launch command ["rsync", "-rL", "--rsh=ssh root@54.238.207.190", "--delete", "--exclude=revision-deploys", "--exclude=tmp", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/Users/takayuki_atkwsk/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/knife-solo-0.4.0/lib/knife-solo/
  • なぜかコケる

  • ハマったので方針転換しましょう

  • 最終的にはリモートサーバーにcookbookを配置して、リモートサーバーで knife solo cook すればいい

    • それ mina でできそう
  • まずはリモートサーバー上で knife solo cook して nginx 立ち上がるか確認してみる

  • chef-work1というレポジトリをつくって bitbucketにpushした

  • サーバーで bitbucket から pull する

  • git をインストールする pacman -S git

git clone git@bitbucket.org:TAKAyuki_atkwsk/chef-work1.git
cd chef-work1
chef-solo -c solo.rb -j nodes/web.json
ERROR: Cookbook nginx not found. If you're loading nginx from another cookbook, make sure you configure the dependency in your metadata
  • nginx の Cookbook がないのでberksコマンドでインストールする
  • まずは bundler をインストール
gem install bundle --no-ri --no-rdoc
bundle install --path vendor/bundle
bundle exec berks install --path cookbooks

またしても...

ERROR: Cookbook nginx not found. If you're loading nginx from another cookbook, make sure you configure the dependency in your metadata
  • cookbook_path を $HOME 使わないで /root/chef-work1/cookbooks に変更した
    • 進んだ!
ERROR: service[nginx] (nginx::package line 41) had an error: Chef::Exceptions::Service: Could not find /etc/rc.conf

systemd.rb を使ってほしいのだが、arch.rb を使っている...

:arch => {
:default => {
:package => Chef::Provider::Package::Pacman,
:service => Chef::Provider::Service::Arch,
:cron => Chef::Provider::Cron,
:mdadm => Chef::Provider::Mdadm
}
},
  • Chef::Provider::Service::Systemd を使ってほしい
  • fork した chef をインストールして使ってみるか...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment