LoginSignup
14
13

More than 5 years have passed since last update.

itamaeでrbenv+mysql環境構築

Last updated at Posted at 2015-03-04

久しぶりにchefを触ろうと思ったらディレクトリの構成とか、これなんだっけ?ってなったのでitamae使ってみました。

環境

  • CentOS6.5
  • ruby1.9.3
  • Mysql5.6

Itamae準備

Gemfile
source 'https://rubygems.org'
gem 'itamae'
gem 'itamae-plugin-recipe-rtn_rbenv'
$ bundle install --path=vendor/bundle

レシピ作成

rbenvはitamae-plugin-recipe-rtn_rbenvを使用させていただきました。

mysqlは別recipe

mysql_for65.rb
execute 'yum -y remove mysql*'

package 'http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm'

%w( mysql-community-server mysql-community-devel ).each do |pkg|
  package pkg
end

service 'mysqld' do
  action :start
end

実行用のrecipe

default.rb

include_recipe 'rtn_rbenv::user'
include_recipe './mysql_for65.rb'

nodeの準備

node.json
{
    "rtn_rbenv": {
        "user": "vagrant",
        "versions": {
            "1.9.3-p484": ["bundler"]
        },
        "global": "1.9.3-p484"
    }
}

実行

$ bundle exec itamae ssh -j node.json -h hogehoge -p 22 -u fugafuga recipes/default.rb

これからこっち使おう!

参考サイト

14
13
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
14
13