

But you can debug the entire packages registered var to see all available information and use it in whatever best way. Note: I made a quickNdirty template to have an output that looks more or less like the one from dnf check-update in a debug task. So this is how I would get the required information. But it basically accepts the same values described for the yum module The module has a list parameter for which the documentation is a bit sparse. The only quirk in my case is that dnf check-updates returns with rc=100 which needs to be ignored if you don't wont to end the playbook on what ansible considers a failure.īut I don't think using shell or command is the right way to deal with your requirement anyway.Īnsible provides a dnf module you can use to handle your packages.


I get the same output in both cases if I test against a fedora:latest docker image. I have no idea why stdout does not contain the same information in your example. How can I make available update list visible during Ansible run? I tried using the shell module instead of the command module but it made no difference. Verbose mode wont show package list either. 'Last metadata expiration check: 0:13:15 ago on. Stdout: 'Last metadata expiration check: 0:13:15 ago on. Last metadata expiration check: 0:19:37 ago on. If I run the same command directly in the target machine shell I get the expected result: ~]$ dnf check-update I have the following Ansible code for checking available updates on a Rocky linux server and showing them to user: - name: Check updates
