ansible/ansible — pull request #7026 by brian-brazil (2014-04-16 17:11:18+00:00)
Title: Fix race conditions in monit module, and general monit cleanup

Environment: recent head on Ubuntu 12.04

The monit module has a number of race conditions that'll trigger if monit gets into the correct state too quickly. For example, if you set state=started and by the time the summary command is run and it's already in state 'Running'. This is causing failures on about 50% of my ansible runs that touch this code.

I also took care of the fixme by refactoring the status checking code, and exit codes are now also checked.
I've manually tested all code paths.

As a general module style question, should this module be checking that it worked or should it adopt a more fire and forget approach? There seems to be quite a bit of complexity added by this in this module, and I'm wondering if removing it would be better overall.