LoginSignup
0
2

More than 5 years have passed since last update.

AnsibleでgrepがどうしてもFAILEDになるのでググってみた貴方へ

Last updated at Posted at 2017-07-08

こういうやつ。
思わずググってしまいました。

$ ansible test -m shell -a 'egrep -i "warn|error|crit|fail|fatal" /var/log/messages'
192.168.59.103 | FAILED | rc=1 >>


そ、そんなバカな
俺のgrepがエラーになるなんて。。

・・・

・・・

・・・

これはマッチする行がないだけですね。。
| wc -lを付けてあげると平穏が訪れました。

$ ansible test -m shell -a 'egrep -i "warn|error|crit|fail|fatal" /var/log/messages | wc -l'
192.168.59.103 | SUCCESS | rc=0 >>
0

ふぅ...

0
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
0
2