ansible yum module question

Hey folks,
Is there a way that I can yum install every RPM package that live in a certain directory on my target machine?

For example, I am trying to translate the following command into an ansible command:

yum -y localinstall /mnt/iso/Packages/*.rpm

Using the most obvious solution in my playbook:

command: yum -y localinstall /mnt/iso/Packages/*.rpm

ansbile reports a change, but when I check the system the packages are not installed.

I’ve also tried:

yum: name=/mnt/iso/Packages/*.rpm state=present

and I still get an this error:

TASK: [installing all from iso packages] **********************************************
failed: [192.168.56.101] => {“changed”: false, “failed”: true, “rc”: 0, “results”: }
msg: No Package file matching ‘/mnt/iso/Packages/*.rpm’ found on system

FATAL: all hosts have already failed – aborting

Any ideas on how I can accomplish this?

ansible --version
ansible 1.7 (devel 82fd70b74d) last updated 2014/05/06 05:18:42 (GMT -600)

Thanks!

Nic

Shelling out to the yum command could be used to do this, yes, though you will first need to make sure the RPMs are present on the remote machine.

“ansbile reports a change, but when I check the system the packages are not installed.”

ansible will always report a change when a command runs, try running it by hand and see what happens?

Usage of “changed_when” can be used to control the “changed” response in Ansible.

For your last question, the yum module will not take local RPM path wildcards.