Simulation/report

Will there also be a simulation/report option available (like puppet --noop), so you could ‘see’ pretty much is going yo change, before you apply it?

Stefan

This is a good question. While it’s not something I originally planned for, but I think it’s very possible in the short term and we should do it soon. It should be very easy for us as there is nothing preventing it.

To do this, every module will need to take a “noop=1” flag. We have a ‘changed’ attribute already in use for notify handlers.

Of the modules we have so far:

service module – idea fits well, requires some small tweaks
copy module – idea fits well, requires some small tweaks
template module – idea fits well, requires some small tweaks
command module – this would probably should always return the ‘changed’ attribute.
ping, faster, ohai – these modules don’t make changes, requires no changes

The source code behind ansible-playbook changes a tiny amount, but the source code behind runner barely changes at all. These are just module flags.

I don’t see why not.

I’ve opened https://github.com/mpdehaan/ansible/issues/68 to track this – depending on how quickly we get to milestone 1, it could be in the 0.0.1 release.

I am also overdo for writing a guide on how to write modules for the docs folder. I’ve opened https://github.com/mpdehaan/ansible/issues/69 to track that. We are starting to have enough conventions that it makes sense to standardize:

all returns are hashes, potentially nested

rc – numeric return code, if applicable
failed – set as a hash key
msg – informational message, required if failed=True
ansible_job_id – used by async mode
changed – for idempotent modules, True/False depending on if a change happened
state – desired state. basically the “ensure=” line in Puppet speak, for services this has the value “started”, “stopped”, and “restarted”

There is already the ansible-modules(5) doc which should cover this in more detail for each module.

–Michael