### Summary

See #74962 (feel free to re-open that one and close this one as a duplicate).

### Issue Type

Bug Report

### Component Name

yum

### Ansible Version

```console
$ ansible --version
ansible [core 2.11.6]
  config file = None
  configured module search path = ['/home/username/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/username/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/username/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/username/.local/bin/ansible
  python version = 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
  jinja version = 2.11.3
  libyaml = True
```


### Configuration

```console
$ ansible-config dump --only-changed
[nothing]
```


### OS / Environment

RHEL 7.9

### Steps to Reproduce

As part of the playbook, there are some tasks that install repo's and download RPM's:
<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: Register ansible Yum repository
  become: yes
  ansible.builtin.yum_repository:
    name: ansible-epel7
    description: Ansible Red Hat 7 EPEL
    baseurl: https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/
    gpgcheck: yes
    gpgkey: https://releases.ansible.com/keys/RPM-GPG-KEY-ansible-release.pub

- name: Download Ansible RPMs to local controller Ansible RPM repository
  include_tasks: yum-download.yml
  vars:
    rpm_name: ansible
```
and:
```yaml
- name: Register ansible-runner Yum repository
  become: yes
  ansible.builtin.yum_repository:
    name: ansible-runner
    description: Ansible target dependencies
    baseurl: https://releases.ansible.com/ansible-runner/rpm/epel-7-x86_64/
    gpgcheck: yes
    gpgkey: https://releases.ansible.com/keys/RPM-GPG-KEY-ansible-release.pub

- name: Download pexpect RPMs
  include_tasks: yum-download.yml
  vars:
    rpm_name: python2-pexpect
```
with `yum-download.yml` as:
```yaml
- name: 'Download {{ rpm_name }} RPMs using yum'
  become: yes
  ansible.builtin.yum:
    name: '{{ rpm_name }}'
    download_only: yes
    download_dir: '{{local_rpm_repo_folder}}'
  environment: '{{ env_http_proxy }}'
```

### Expected Results

When running this playbook against a Red Hat 7.9 VM on Azure, I would expect just the RPM's to be downloaded (with maybe some small caching by yum).

### Actual Results

When running this playbook against a Red Hat 7.9 VM on Azure, yum fills the entire `/var` with cached data. (In fact, because by default `/var` is 8G I had to extend it first; I end up with some 12G!)

Only after changing:
```yaml
    gpgcheck: yes
```
to:
```yaml
    gpgcheck: no
```
does this work as expected (no huge amounts of data in `/var`, RPM's downloaded).

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
support: full
    platform:
        platforms: rhel
notes:
  - When used with a `loop:` each package will be processed individually,
    it is much more efficient to pass the list directly to the `name` option.
  - In versions prior to 1.9.2 this module installed and removed each package
    given to the yum module separately. This caused problems when packages
    specified by filename or url had to be installed or removed together. In
    1.9.2 this was fixed so that packages are installed in one yum
    transaction. However, if one of the packages adds a new yum repository
    that the other packages come from (such as epel-release) then that package
    needs to be installed in a separate task. This mimics yum's command line
    behaviour.
  - 'Yum itself has two types of groups.  "Package groups" are specified in the
    rpm itself while "environment groups" are specified in a separate file
    (usually by the distribution).  Unfortunately, this division becomes
    apparent to ansible users because ansible needs to operate on the group
    of packages in a single transaction and yum requires groups to be specified
    in different ways when used in that way.  Package groups are specified as
    "@development-tools" and environment groups are "@^gnome-desktop-environment".
    Use the "yum group list hidden ids" command to see which category of group the group
    you want to install falls into.'
  - 'The yum module does not support clearing yum cache in an idempotent way, so it
    was decided not to implement it, the only method is to use command and call the yum
    command directly, namely "command: yum clean all"
    https://github.com/ansible/ansible/pull/31450#issuecomment-352889579'
# informational: requirements for nodes
requirements:
- yum