Querying Version of Single Installed Package

In light of the recent glibc issue. I’ve been trying to use ansible to query the installed version of glibc, can anyone suggest something I might be missing here.

Option 1: ansible all -m yum -a “list=installed”

Unfortunately the list option to the yum module doesn’t seem to accept any further arguments and hence can only return all installed packages. Not ideal. The output is nice though as it’s JSON with lots of information.

Option 2: ansible all -a “rpm -q glibc”

Works but it feels like this would be a useful thing to be able to do via the package modules?

Carwyn

This is similar in the salt world:

https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.yumpkg.html#salt.modules.yumpkg.info_installed

Hi Carwyn,

I would consider creating custom Ansible fact for this task.

But there are still some possible drawbacks

  1. there can be lot of packages on machine (1900 on my laptop, 450 on random server) and you have to ask your packaging system (took ~0.5-2 seconds).
  2. this long lost of packages and its version have to be transfered from target machine to your managing machine. It also needs some time.

So I would probably consider creating custom fact only for packages you are interest in - like glibc, openssl, and similar fragile components.

Have a nice day

–Věroš