Yum Local Install Variable

All;

I am building an RPM for a machine using rpm-build. I then need to take the rpm it built, and I want to use yum to install that. Below is my .yml playbook and the error that accompanies trying to install it. Any thoughts would be greatly appreciated. Thanks!!

32 - name: retrieve rpmbuild file
33 shell: ls /root/rpmbuild/RPMS/x86_64/iomemory-vsl-$(uname -r)*.rpm
34 register: fusionIORPM
35 tags:
36 - fusionIO2
37
38 - name: install rpm
39 yum: name={{ fusionIORPM.stdout_lines }} state=present
40 tags:
41 - fusionIO2

TASK: [server1 | retrieve rpmbuild file] ***************************************
changed: [server1]

TASK: [server1 | install rpm] **************************************************
failed: [server1] => {“failed”: true, “item”: “”}
msg: Error from repoquery: [‘/usr/bin/repoquery’, ‘–show-duplicates’, ‘–plugins’, ‘–quiet’, ‘-q’, ‘–disablerepo=*’, ‘–pkgnarrow=installed’, ‘–qf’, ‘%{name}-%{version}-%{release}.%{arch}’, ‘[u/root/rpmbuild/RPMS/x86_64/iomemory-vsl-2.6.32-431.el6.x86_64-2.3.11.183-1.0.el6.x86_64.rpm]’]: Traceback (most recent call last):
File “/usr/bin/repoquery”, line 1241, in
main(sys.argv)
File “/usr/bin/repoquery”, line 1235, in main
repoq.runQuery(regexs)
File “/usr/bin/repoquery”, line 805, in runQuery
pkgs = self.matchPkgs(items, plain_pkgs=plain_pkgs)
File “/usr/bin/repoquery”, line 742, in matchPkgs
pkgs = self.returnPkgList(patterns=items)
File “/usr/bin/repoquery”, line 700, in returnPkgList
ygh = self.doPackageLists(what, **kwargs)
File “/usr/lib/python2.6/site-packages/yum/init.py”, line 2396, in doPackageLists
ignore_case=ic)
File “/usr/lib/python2.6/site-packages/yum/rpmsack.py”, line 622, in returnPackages
rpats = self._compile_patterns(patterns, ignore_case)
File “/usr/lib/python2.6/site-packages/yum/rpmsack.py”, line 549, in _compile_patterns
ret.append((qpat, re.compile(fnmatch.translate(pat))))
File “/usr/lib64/python2.6/re.py”, line 190, in compile
return _compile(pattern, flags)
File “/usr/lib64/python2.6/re.py”, line 245, in _compile
raise error, v # invalid expression
sre_constants.error: bad character range

FATAL: all hosts have already failed – aborting

So yum isn’t liking some of the output of the previous step and is choking on it.

Do this:

  • debug: var=fusionIORPM

Though really I think you’re using yum a bit non-natively.

It would be better to run createrepo and make a repository, configure the repository and then you can just say you want fusionIO installed versus needing to specify a version. (or even that you want the latest)

This way you can also avoid compiling on each individual box – yum mirrors are really easy to set up and just require HTTP.

Where would I put that, in the .yml ?

Also…I understand your point, but as far as “natively”…the documentation says that it supports installing from a local RPM. Also, I need to build the RPM manually on the box due to the fact that they (fusionIO) do not offer a pre-built RPM version for the kernel version that I am currently running.

Yep between the two tasks that are there.

– Michael

Also worth noting:

changed: [server1] => {“changed”: true, “cmd”: "ls /root/rpmbuild/RPMS/x86_64/iomemory-vsl-$(uname -r)*.rpm ", “delta”: “0:00:00.005180”, “end”: “2013-12-13 13:38:28.657420”, “item”: “”, “rc”: 0, “start”: “2013-12-13 13:38:28.652240”, “stderr”: “”, “stdout”: “/root/rpmbuild/RPMS/x86_64/iomemory-vsl-2.6.32-431.el6.x86_64-2.3.11.183-1.0.el6.x86_64.rpm”}

so it seems the value is being populated properly.

Another thing worth noting (sorry for the multiple posts)

REMOTE_MODULE yum name=[u’/root/rpmbuild/RPMS/x86_64/iomemory-vsl-2.6.32-431.el6.x86_64-2.3.11.183-1.0.el6.x86_64.rpm’] state=present

so it seems OK?

Not sure where that “u” comes from in the beginning tho…

Also…I understand your point, but as far as “natively”…the documentation says that it supports installing from a local RPM. Also, I need to build the RPM manually on the box due to the fact that they (fusionIO) do not offer a pre-built RPM version for the kernel version that I am currently running.

sorry about the sideway comment: but you could build RPM on any box with that kernel (and make it explicitely depend on that kernel) and distribute it via Yum like Michael suggested. Are you running custom kernel (non-RPM’ed)? you can still make a dependancy on /boot/vmlinuz-X.Y.Z-foo image if that’s your fancy.

Another thing worth noting (sorry for the multiple posts)

<server1> REMOTE_MODULE yum
name=[u'/root/rpmbuild/RPMS/x86_64/iomemory-vsl-2.6.32-431.el6.x86_64-2.3.11.183-1.0.el6.x86_64.rpm']
state=present

so it seems OK?

It does not seem OK. You provide a list as the package-name, not a string. So instead of using fusionIORPM.stdout_lines, you should use fusionIORPM.stdout, but be sure the ouput only contains a single file !

Not sure where that "u" comes from in the beginning tho....

The "u" indicates it is a unicode string. Doesn't matter here.

Thanks for the advice.

  1. using .stdout instead of .stdout.lines worked just fine with regards to the actual command listed above. Thanks!! :slight_smile:

  2. yes, I could build it out and throw it up on a repo (we even have a local repo at our location), but this gives me the ability to continually run this playbook against the server no matter what the kernel version

  3. thanks for the info about the “u” :slight_smile:

Thank you again for everyones help in this issue! :slight_smile: