When using reloaded or restarted, you're changing something, and therefore it would never be idempotent by definition.
(Ok, mathematically, "idempotence" means you can re-run an operation N times in sequence and the result is the same as running it once. If you're saying you can't call something idempotent if it changes something, I don't understand.)
Anyway, "idempotence" is of course a desirable property, but perhaps not the term I should have used here.
I had thought a central idea of system configuration systems was to be able to say "put the system in state X", and have it taken care if, whichever state it was in to start with (or fail noisily if it cannot be). This is in fact a different thing to idempotence. However, I believe it *is* what Ansible, Puppet, Chef et al. aspire to, correct?
If so then I think my point stands.
Also typically reload doesn't start the service if it's not up, but instead issues a HUP to the process so it reloads, so the behavior you describe above is exactly what I would expect.
I totally understand and agree with this in the context of simply running "service <blah> reload" from the command line.
However, I would expect Ansible to do more than that to ensure that I don't have to nanny it into doing what I actually intend. In the case of 'reload' this would be to ensure the service is running, *and* if it is, issue a HUP to ensure it reloads its configuration gracefully. On the command line I'd do exactly the same - start it first. It makes little sense HUP a service I haven't already started.
My point is not that I can't work around what Ansible does now with more long-winded constructions, but that surely Ansible *ought* to just do what I want, taking care of the details for me? What use is a "reload" option which doesn't start the service first?
> State=restarted does this
True, and probably what I shall in fact do in practice. Debian services typically don't even have the 'reloaded' operation, so if I want my playbooks to run on both I presume I shall need to use 'restart' anyway.
But it is still different: it *restarts* a service, and in the case of services like Apache, this might be too heavy-handed compared to a reload/HUP, and introduce unwanted downtime on a busy site.
Thanks,
N