Thanks for the reply!

On Tuesday, December 20, 2016 at 4:45:18 PM UTC-8, Ben Friedman wrote:
>
> I'm not sure there's any way to persist state between program executions 
> except by saving that state offline like you are doing.


Yes, I recognize that. That's why I labeled this an enhancement request, 
and why I brought the discussion here, rather than just posting a bug 
report. I'm guessing either other people have run into the same problem and 
found better solutions, or have the same need of an enhancement.
 

> That being said, I think the goal of ansible is to write your play in a 
> way that sets the state of a system accordingly. For instance, use a 
> handler that only gets invoked when a task is changed. If apache hasn't 
> been changed in any way, the 'restart apache' handler doesn't run.
>

Yes, and I'm tossing in a notion that part of the "system state" that 
ansible stores is persistent variables whose values persist *until a 
playbook has run to successful completion.* Since Ansible cannot be 
"transactional" in its operation, registering variables always has failure 
modes. The smaller the range of those failure modes, the better off the 
ecosystem will be.

Some of Ansible's operations (such as a service restart, or command 
operations) may leave the target system in exactly the same configured / 
operational state, but they do have side-effects (like dropping 
connections, momentarily). Those side effects may be worth avoiding....
 

> If you're storing state offline, you'll have to write your play to check 
> that data store for state. You might as well write the play in a way that 
> checks the target state before taking action, if needed.
>

As I indicated in my examples, that's exactly what I do. However, that 
makes my playbooks more complicated, more error prone, and harder to 
understand. And since I don't think I'm the only one with this problem, it 
strikes me that it could work well as an enhancement to Ansible itself.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/32fffd9d-3c91-415f-b0b0-e206436f11c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to