yum module: add support for check_mode /w yum package groups

Hello ansible community!

This is my first post and first pull request: 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,

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!