How to check the result of a lineinfile task?

15 views
Skip to first unread message

Johannes Kastl

unread,
Jun 2, 2016, 3:10:46 PM6/2/16
to ansible...@googlegroups.com
Dear all,

how to check the result of a lineinfile task?

I got one that outputs the following:

> "backup": "",
> "changed": true,
> "diff": [
> {
> "after": "",
> "after_header": "/path/to/file (content)",
> "before": "",
> "before_header": "/path/to/file (content)"
> },
> {
> "after_header": "/path/to/file (file attributes)",
> "before_header": "/path/to/file (file attributes)"
> }
> ],
> "msg": "line added"

I see the line has been added, but there is no rc or similar. I could
test for '(changed==true and msg=="line added") or (changed==false)',
but that seems rather clunky. Any better ideas?

Johannes

signature.asc
Reply all
Reply to author
Forward
0 new messages