# yum module: add support for check\_mode /w yum package groups

**URL:** <https://forum.ansible.com/t/yum-module-add-support-for-check-mode-w-yum-package-groups/16671>\
**Category:** Ansible Developer\
**Created:** [November 3, 2014, 6:10pm UTC](https://forum.ansible.com/t/yum-module-add-support-for-check-mode-w-yum-package-groups/16671 "2014-11-03T18:10:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jean-Francois\_Chevre](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@Jean-Francois\_Chevre](https://forum.ansible.com/u/Jean-Francois_Chevre)\
**Post date:** [November 3, 2014, 6:10pm UTC](https://forum.ansible.com/t/yum-module-add-support-for-check-mode-w-yum-package-groups/16671/1 "2014-11-03T18:10:20Z")

</div>

Hello ansible community!

This is my first post and first pull request: [https://github.com/ansible/ansible-modules-core/pull/264](https://github.com/ansible/ansible-modules-core/pull/264)

FYI: I had sent a pull request before the ansible repos reorganizations and I have just had some time to re-submit my pull request.

Currently, when using check\_mode with a yum package group (@group), ansible will return changed=True all the time. This is inconvenient when running in check\_mode to see if your hosts configs are proper. In my use case, I have a playbook that I run in check\_mode every morning and an email report is sent if I have any non-compliant hosts/tasks. (changed != 0)

This pull request adds check\_mode support for package groups with state=installed or state=latest

Checking for package removal is tricky and I have not found a clean way to implement this. Ideas are welcome.

There is no way to ask yum or repoquery directly if a package group has installable packages or updateable packages. The way this is implemented is by expanding the package group using ‘repoquery’ and by passing the list of packages to is\_installed which will return wether or not it has any packages that would be installed. Since repoquery will list ALL member packages even though they are excluded in yum.conf, there is a need to use both is\_installed and is\_available to ensure we only check for those packages yum would normally install (taking into account the excluded ones)

Ideas and criticism on my first pull request is greatly appreciated!

Thanks,

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [November 4, 2014, 9:01pm UTC](https://forum.ansible.com/t/yum-module-add-support-for-check-mode-w-yum-package-groups/16671/2 "2014-11-04T21:01:55Z")

</div>

In queue for review, we have a large backlog of things so based on priority it may be a while before we get to this.

on the outset it doesn’t look particularly intrusive, though since it deals with yum (one of the most critical modules) we’ll want to test and explore thoroughly.

Thanks for submitting this!
