ubuntuにItamaeをインストール
- sudo apt-get install rubygems
- gem install itamae
- itamae # インストール確認
- ヘルプ的なのが出ずにスタックトレースが出た
- ライブラリがよくないようなので入れ直して回避
- gem uninstall thor
- gem install thor -v 0.19.1
- ベストプラクティスな感じでコードを配置
- cookbooks, roles
- Serverspec の test 用に spec も
- root@ubuntu の ~/.ssh/private_key に
- ~/.ssh/config に Serverspec 用の定義を追加
Host personal-centos
HostName 192.168.33.31
Port 22
User vagrant
IdentityFile ~/.ssh/private_key
ItamaeでインストールとServerspecテスト
INFO : Starting Itamae...
INFO : Recipe: /root/ItamaePractice/roles/deploy.rb
INFO : Recipe: /root/ItamaePractice/cookbooks/fabric/default.rb
INFO : package[openssl-devel] installed will change from 'false' to 'true'
INFO : execute[install fabric] executed will change from 'false' to 'true'
- テストコードを自動生成後に調整
- apt install ruby-bundler
- bundle exec serverspec-init
root@personal-ubuntu:~/ItamaePractice# bundle exec serverspec-init
Select OS type:
1) UN*X
2) Windows
Select number: 1
Select a backend type:
1) SSH
2) Exec (local)
Select number: 1
Vagrant instance y/n: n
Input target host name: personal-centos
+ spec/personal-centos/
+ spec/personal-centos/sample_spec.rb
+ spec/spec_helper.rb
+ Rakefile
+ .rspec
- テスト実行
- cd ItamaePractice
- rake spec
Command "fab -V"
stdout
should contain "Fabric 1.13.1"
Finished in 0.96617 seconds (files took 0.3601 seconds to load)
1 example, 0 failures
コメント
ToDo