Getting complete package update information

The following playbook gets packages available for update, returning package name and version:

Hi,

A quick look at the packages shows they are security fixes, if you add security: yes does that solve your issue ?

Steve.

Stephen, if you mean add that parameter to the dnf module, like this:

dnf:
list: updates
security: yes

it didn’t work.

Stephen, if you mean add that parameter to the dnf module, like this:

      dnf:
        list: updates
        security: yes

I would expect that to report *only* security updates, not to report
those *as well*. Security updates would be among the normal update
list.

I suspect you're running into the "dnf update" command applying not
merely required, but recommended updates.

it didn't work.

Hi,

A quick look at the packages shows they are security fixes, if you add `security: yes` does that solve your issue ?

Steve.

The following playbook gets packages available for update, returning package name and version:

---

- hosts: all
  gather_facts: false

  vars:
    my_packages: "{{ dict(packages.results|groupby('name')) }}"

  tasks:

    - name: Check packages to upgrade
      dnf:
        list: updates
      register: packages

    - name: Show packages to upgrade
      debug:
        msg: |
          {% for name,versions in my_packages.items() %}
          {% set max_ver=versions|map(attribute='version')|max %}
          {% set p=versions|selectattr('version', '==', max_ver)|list %}
          {{ name }}-{{ p.0.version }}-{{ p.0.release }}
          {% endfor %}

This.... is not going to work, it won't pick up the dependencies of
your package dependencies, as you've discovered. Updates to one
package can even conflict with and force a rollback of another
package. Frankly, why not just use a "dnf check-update" command?

Thanks, Nico. dnf check-update doesn’t quite return the values that I’m looking for.