### Summary

While specifying requirements.yml to install roles like - 

```
ansible-galaxy role install -r requirements.yml -vvvv
```

With `requirements.yml` (I understand this file syntax is wrong)

```yaml
---
community.vmware
```

results in 
```
ERROR! Unexpected Exception, this is probably a bug: 'str' object has no attribute 'keys'
the full traceback was:

Traceback (most recent call last):
  File "/Volumes/data/src/ansible/lib/ansible/cli/__init__.py", line 659, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 749, in run
    return context.CLIARGS['func']()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 120, in method_wrapper
    return wrapped_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 1368, in execute_install
    requirements = self._parse_requirements_file(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 840, in _parse_requirements_file
    extra_keys = set(file_requirements.keys()).difference(set(['roles', 'collections']))
                     ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'keys'
```

### Issue Type

Bug Report

### Component Name

ansible-galaxy

### Ansible Version

```console
$ ansible --version
ansible [core 2.17.0.dev0] (i81713 310625996d) last updated 2023/10/04 11:27:33 (GMT -400)
  config file = /Volumes/data/src/playbooks/ansible.cfg
  configured module search path = ['/Users/akasurde/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Volumes/data/src/ansible/lib/ansible
  ansible collection location = /Users/akasurde/.ansible/collections:/usr/share/ansible/collections
  executable location = /Volumes/data/src/ansible/bin/ansible
  python version = 3.11.3 (main, May 10 2023, 12:50:08) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/Users/akasurde/.pyenv/versions/3.11.3/bin/python)
  jinja version = 3.1.2
  libyaml = True
```


### 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

Red Hat Enterprise Linux release 8.2 (Ootpa)

### Steps to Reproduce

Trying installing role/collection with the above requirements.yml file.


### Expected Results

Installation successful.

### Actual Results

```console
ERROR! Unexpected Exception, this is probably a bug: 'str' object has no attribute 'keys'
the full traceback was:

Traceback (most recent call last):
  File "/Volumes/data/src/ansible/lib/ansible/cli/__init__.py", line 659, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 749, in run
    return context.CLIARGS['func']()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 120, in method_wrapper
    return wrapped_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 1368, in execute_install
    requirements = self._parse_requirements_file(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 840, in _parse_requirements_file
    extra_keys = set(file_requirements.keys()).difference(set(['roles', 'collections']))
                     ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'keys'
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
verify_parser.add_argument('--ignore-signature-status-codes', dest='ignore_gpg_errors', type=str, action='extend', nargs='+',
                                   help=ignore_gpg_status_help, default=C.GALAXY_IGNORE_INVALID_SIGNATURE_STATUS_CODES,
                                   choices=list(GPG_ERROR_MAP.keys()))
    def add_install_options(self, parser, parents=None):
        galaxy_type = 'collection' if parser.metavar == 'COLLECTION_ACTION' else 'role'
        args_kwargs = {}
        if galaxy_type == 'collection':
            args_kwargs['help'] = 'The collection(s) name or path/url to a tar.gz collection artifact. This is ' \
                                  'mutually exclusive with --requirements-file.'
            ignore_errors_help = 'Ignore errors during installation and continue with the next specified ' \
                                 'collection. This will not ignore dependency conflict errors.'
        else:
            args_kwargs['help'] = 'Role name, URL or tar file'
            ignore_errors_help = 'Ignore errors and continue with the next specified role.'
        install_parser = parser.add_parser('install', parents=parents,
                                           help='Install {0}(s) from file(s), URL(s) or Ansible '
                                                'Galaxy'.format(galaxy_type))
        install_parser.set_defaults(func=self.execute_install)
        install_parser.add_argument('args', metavar='{0}_name'.format(galaxy_type), nargs='*', **args_kwargs)
        install_parser.add_argument('-i', '--ignore-errors', dest='ignore_errors', action='store_true', default=False,
                                    help=ignore_errors_help)
        install_exclusive = install_parser.add_mutually_exclusive_group()
        install_exclusive.add_argument('-n', '--no-deps', dest='no_deps', action='store_true', default=False,
                                       help="Don't download {0}s listed as dependencies.".format(galaxy_type))
        install_exclusive.add_argument('--force-with-deps', dest='force_with_deps', action='store_true', default=False,
                                       help="Force overwriting an existing {0} and its "
                                            "dependencies.".format(galaxy_type))
        valid_signature_count_help = 'The number of signatures that must successfully verify the collection. This should be a positive integer ' \
                                     'or -1 to signify that all signatures must be used to verify the collection. ' \
                                     'Prepend the value with + to fail if no valid signatures are found for the collection (e.g. +all).'