serverspec-runner使ってみた
7079 ワード
ubuntu16.04.1で動作確認しましたが、
(gemで入れたものとaptで入れたものは名前が変わっているのかそもまま動かなくてつらみ。
SpecInfra
が Specinfra
になっていたり、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
Author And Source
この問題について(serverspec-runner使ってみた), 我々は、より多くの情報をここで見つけました https://qiita.com/tukiyo3/items/10154c8f41f33a7f29f2著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .