ansible/ansible — pull request #8631 by jfchevrette (2014-08-14 19:42:59+00:00)
Title: add support for check_mode /w yum package groups

Currently, when using check_mode with a 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 we would install through you (minus those excluded)