Playbook not idempotent because operation is not, any way to workaround?

I am experimenting a playbook and one task failed during its execution

----- my playbook -----

  • name: yum install epel packages

yum: name=http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm state=present

In this case it sounds like yum has had an issue and got itself in a
mess, it's not really
something Ansible can do much about as it delegates to yum to handle this.

If it requires user intervention to solve, that's where ad-hoc
commands come in.

ansible all -a "sudo yum get_your_act_together"

Yep, this isn’t really an idempotence question, this is how to deal with an error question.

See details here:

https://www.google.com/search?q=database+disk+image+is+malformed

The suggestion seems to be to rebuild your package database.

This is not something we’d want the yum module to do automatically.