### Summary

The yum module fails when releasever is used and state=latest

### Issue Type

Bug Report

### Component Name

yum

### Ansible Version

```console
$ ansible --version
ansible [core 2.11.12]
```


### Configuration

```console
# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
```


### OS / Environment

SL7

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: ww_slurm_4, install slurm and munge packages
  yum:
    name: "{{ item.1 }}"
    state: "latest"
    installroot: "{{ ww_image_root }}/{{ item.0 }}/rootfs"
    # releasever: "{{ ansible_distribution_major_version }}"
    releasever: "7"
    disable_gpg_check: true
  loop: "{{ ww_images | product(['slurm-slurmd', 'slurm-pam_slurm', 'munge'] | list )}}"
  register: ww_import
  notify: build ww container
```


### Expected Results

I expect this to update the package in the chroot environment or stay the same.  Present works, but latest does not.  when releasever is commented both latest and present work.

### Actual Results

```console
failed: [queue] (item=['compute', 'munge']) => {"ansible_loop_var": "item", "changed": false, "item": ["compute", "munge"], "module_stderr": "Shared connection to 10.214.69.133 closed.\r\n", "module_stdout": "\r\nTraceback (most recent call last):\r\n  File \"/home/admin/.ansible/tmp/ansible-tmp-1655242496.2998235-85460-72716949132464/AnsiballZ_yum.py\", line 100, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/admin/.ansible/tmp/ansible-tmp-1655242496.2998235-85460-72716949132464/AnsiballZ_yum.py\", line 92, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/admin/.ansible/tmp/ansible-tmp-1655242496.2998235-85460-72716949132464/AnsiballZ_yum.py\", line 41, in invoke_module\r\n    run_name='__main__', alter_sys=True)\r\n  File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module\r\n    fname, loader, pkg_name)\r\n  File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code\r\n    mod_name, mod_fname, mod_loader, pkg_name)\r\n  File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code\r\n    exec code in run_globals\r\n  File \"/tmp/ansible_ansible.legacy.yum_payload_wj2O6u/ansible_ansible.legacy.yum_payload.zip/ansible/modules/yum.py\", line 1728, in <module>\r\n  File \"/tmp/ansible_ansible.legacy.yum_payload_wj2O6u/ansible_ansible.legacy.yum_payload.zip/ansible/modules/yum.py\", line 1724, in main\r\n  File \"/tmp/ansible_ansible.legacy.yum_payload_wj2O6u/ansible_ansible.legacy.yum_payload.zip/ansible/modules/yum.py\", line 1695, in run\r\n  File \"/tmp/ansible_ansible.legacy.yum_payload_wj2O6u/ansible_ansible.legacy.yum_payload.zip/ansible/modules/yum.py\", line 1577, in ensure\r\n  File \"/tmp/ansible_ansible.legacy.yum_payload_wj2O6u/ansible_ansible.legacy.yum_payload.zip/ansible/modules/yum.py\", line 1438, in latest\r\nAttributeError: 'NoneType' object has no attribute 'extend'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
- This module supports C(yum) (as it always has), this is known as C(yum3)/C(YUM3)/C(yum-deprecated) by
        upstream yum developers. As of Ansible 2.7+, this module also supports C(YUM4), which is the
        "new yum" and it has an C(dnf) backend.
      - By default, this module will select the backend based on the C(ansible_pkg_mgr) fact.
    default: "auto"
    choices: [ auto, yum, yum4, dnf ]
    type: str
    version_added: "2.7"
  name:
    description:
      - A package name or package specifier with version, like C(name-1.0).
      - Comparison operators for package version are valid here C(>), C(<), C(>=), C(<=). Example - C(name>=1.0)
      - If a previous version is specified, the task also needs to turn C(allow_downgrade) on.
        See the C(allow_downgrade) documentation for caveats with downgrading packages.
      - When using state=latest, this can be C('*') which means run C(yum -y update).
      - You can also pass a url or a local path to a rpm file (using state=present).
        To operate on several packages this can accept a comma separated string of packages or (as of 2.0) a list of packages.
    aliases: [ pkg ]
    type: list
    elements: str
  exclude:
    description:
      - Package name(s) to exclude when state=present, or latest
    type: list
    elements: str
    version_added: "2.0"
  list:
    description:
      - "Package name to run the equivalent of yum list C(--show-duplicates <package>) against. In addition to listing packages,
        use can also list the following: C(installed), C(updates), C(available) and C(repos)."