# Getting complete package update information

**URL:** <https://forum.ansible.com/t/getting-complete-package-update-information/38702>\
**Category:** Ansible Project\
**Created:** [February 28, 2024, 2:25pm UTC](https://forum.ansible.com/t/getting-complete-package-update-information/38702 "2024-02-28T14:25:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dyioulos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dyioulos/32/8363_2.png) [@dyioulos](https://forum.ansible.com/u/dyioulos)\
**Post date:** [February 28, 2024, 2:25pm UTC](https://forum.ansible.com/t/getting-complete-package-update-information/38702/1 "2024-02-28T14:25:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mahespth](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mahespth/32/252_2.png) [@mahespth](https://forum.ansible.com/u/mahespth)\
**Post date:** [February 28, 2024, 3:23pm UTC](https://forum.ansible.com/t/getting-complete-package-update-information/38702/2 "2024-02-28T15:23:52Z")

</div>

Hi,

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

Steve.

---

<div class="post-metadata">

**Author:** ![dyioulos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dyioulos/32/8363_2.png) [@dyioulos](https://forum.ansible.com/u/dyioulos)\
**Post date:** [February 28, 2024, 8:42pm UTC](https://forum.ansible.com/t/getting-complete-package-update-information/38702/3 "2024-02-28T20:42:27Z")

</div>

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

**dnf:**  
**list: updates**  
**security: yes**

it didn’t work.

---

<div class="post-metadata">

**Author:** ![Nico\_Kadel-Garcia](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nico_kadel-garcia/32/9998_2.png) [@Nico\_Kadel-Garcia](https://forum.ansible.com/u/Nico_Kadel-Garcia)\
**Post date:** [March 1, 2024, 12:37am UTC](https://forum.ansible.com/t/getting-complete-package-update-information/38702/4 "2024-03-01T00:37:40Z")

</div>

> Stephen, if you mean add that parameter to the dnf module, like this:
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dnf:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list: updates  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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  
> > &nbsp;&nbsp;gather\_facts: false
> > 
> > &nbsp;&nbsp;vars:  
> > &nbsp;&nbsp;&nbsp;&nbsp;my\_packages: "{{ dict(packages.results|groupby('name')) }}"
> > 
> > &nbsp;&nbsp;tasks:
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;- name: Check packages to upgrade  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dnf:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list: updates  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;register: packages
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;- name: Show packages to upgrade  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;debug:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msg: |  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{% for name,versions in my\_packages.items() %}  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{% set max\_ver=versions|map(attribute='version')|max %}  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{% set p=versions|selectattr('version', '==', max\_ver)|list %}  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ name }}-{{ p.0.version }}-{{ p.0.release }}  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{% 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?

---

<div class="post-metadata">

**Author:** ![dyioulos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dyioulos/32/8363_2.png) [@dyioulos](https://forum.ansible.com/u/dyioulos)\
**Post date:** [March 6, 2024, 1:43pm UTC](https://forum.ansible.com/t/getting-complete-package-update-information/38702/5 "2024-03-06T13:43:40Z")

</div>

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