So --check is a recently added "pseudo dry run" feature which I just
recently talked about.
So far, modules like file, template, and copy respond to --check and
will give you whether things would change or not, and the other
modules just get skipped over with --check.
Whether or not you are using --check, I just added a --diff flag
tonight, so far only to /usr/bin/ansible-playbook.
When this is run, for any template files, it will present a basic
unified diff of the changes made to those templates. To avoid running
against binary files, it is not implemented for file types.
I also suspect the output of diff mode is NOT optimal if running
against multiple machines at the same time (it might interlace), so it
is probably useful to use it with --limit.
Example, to put it all in perspective
ansible-playbook everything.yml --check # just see what might change
on all boxes
ansible-playbook everything.yml --check --limit foo.example.com # see
what might change on just one box
ansible-playbook everything.yml --check --diff # just see what might
change and show diffs on all boxes
ansible-playbook everything.yml --check --diff --limit foo.example.com
# be sane, just show diffs for that one box
There are TODO items here which I am hoping folks may want to help
with, namely, teaching other modules to respond to the "check"
attribute, just like file does now.
Minimally I think this should be done for service, yum, and apt, and
this would be pretty well decently complete.
Given lots of folks may have command tasks and when statements they
also want to simulate, perhaps we should also teach the command module
that when run in 'check' mode that it should return changed with a 0
(success) error code.
We can worry about the other modules having support for --check later,
I'm not super concerned about those. I think most people want to know
when files get modified out of band.