LoginSignup
2
2

More than 5 years have passed since last update.

serverspec-runner使ってみた

Last updated at Posted at 2016-09-26

ubuntu16.04.1で動作確認しましたが、
(gemで入れたものとaptで入れたものは名前が変わっているのかそもまま動かなくてつらみ。
SpecInfraSpecinfra になっていたり、DetectOSがDetectOsだったり)

参考

インストール

gem install serverspec-runner
  • /usr/local/bin/serverspec-runnerが入る。
mkdir test; cd test
serverspec-runner -r .
# yを入力

設定

  • vim ./scenario.yml
scenario.yml
  example:
    - anyhost-01
  ---
  anyhost-01:
-   host:        127.0.0.1
+   host:        192.168.0.9
実行
serverspec-runner -t mkd
  • 実行される spec ファイルは spec/example/default.rb
結果
|description                                                      | result |
|:----------------------------------------------------------------|:------:|
|example@anyhost-01(192.168.0.9)                                  |        |
|  User "root"                                                    |        |
|    should exist                                                 |   OK   |
|    should have uid 0                                            |   OK   |
|    should have home directory "/root"                           |   OK   |
|  Group "root"                                                   |        |
|    should have gid 0                                            |   OK   |
|  Filesystem                                                     |        |
|    File "/"                                                     |        |
|      should be mounted                                          |   OK   |
|  Host "www.google.com"                                          |        |
|    should be resolvable                                         |   OK   |
|    should be reachable                                          |   OK   |
|  Command "dmesg | grep "FAIL\|Fail\|fail\|ERROR\|Error\|error"" |        |
|    exit_status                                                  |        |
|      should not eq 0                                            |   NG   |
コンソール向けに出力
serverspec-runner -t aa

スクリーンショット_2016-09-26_09-19-55.png

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