The new command line option is not something I want.
Why not just return non-zero if any host has failures?
Both ansible and ansible-playbook should be included, and it shouldn't
require any changes to the core.
On Fri, Sep 14, 2012 at 4:35 PM, Brice Burgess <
bric...@gmail.com> wrote:
> I've introduced a feature that allows ansible-playbook to return non-zero
> exit codes via a command line option, and wanted to gather the community's
> response before submitting a pull request.
>
> You can see the commit (against Ansible 0.7) here:
>
https://github.com/briceburg/ansible/commit/ab550bee941d12164eeea6a6caa8817c8febead4
>
> In a nutshell it adds the`--host-failure-threshold` command line option,
> which when set, will direct the playbook to exit with a non-zero return if a
> defined amount of host failures have been reached. The command line option
> accepts 'any', 'all', or a specific number of host failures to allow before
> triggering the command to exit as an error. It is disabled by default (e.g.
> doesn't break existing scripts, and always returns 0). Please none that
> 'any' is equivalent to --host-failure-threshold=0, and that 'all' is
> equivalent to --host-failure-threshold=[number of hosts in playbook - 1].
>
> The reason *I* needed this change was we needed Jenkins to fail a build if
> the [ansible-playbook based] deployment had a task failure.
>
> Do you think this patch is OK as-is? Any features to change? I'd like to add
> unit-tests, although was unable to get them to run. What about also allowing
> it for the standalong [non playbook] ansible command?
>
> Thanks,
>
> ~ Brice