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

144 views
Skip to first unread message

Sean Bigdatafun

unread,
Apr 5, 2014, 2:50:12 PM4/5/14
to ansible...@googlegroups.com
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

--------------------------------

The above task failed for some reason, as log showed below.

failed: [ceph-osd1] => {"changed": true, "item": "", "rc": 1, "results": ["Loaded plugins: fastestmirror, security\nLoading mirror speeds from cached hostfile\n * base: ftp.osuosl.org\n * epel: linux.mirrors.es.net\n * extras: centosc5.centos.org\n * updates: centosz5.centos.org\n"]}

msg: Error: database disk image is malformed


At this point, it seems there is no way for me rerun the playbook to fix it because the yum repo info somehow got corrupted. Is there anyway to fix it? (Imagine there are tens of machines, I can't log into the machines and manually fix the repo by manually running yum commands)


If the above question sounds a reasonable question to Ansible, I'd like to go one step further. The idempotency is a goal for Ansible, how can I get it in a world that something weird could happen during software installation.




Dick Davies

unread,
Apr 6, 2014, 1:41:18 PM4/6/14
to ansible...@googlegroups.com
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"
> --
> 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/6236f3a7-d6c6-4783-96be-04b416677988%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Michael DeHaan

unread,
Apr 9, 2014, 9:35:05 AM4/9/14
to ansible...@googlegroups.com
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.



Reply all
Reply to author
Forward
0 new messages