### Summary

When I try to install a role that contains files with `$` in their names (such as Java class names), it fails because we don't allow `$` in the file names because file names could get evaluated via `os.path.expandvars`.

See https://github.com/ansible/galaxy/issues/271 for the original context

The error message is "Not a directory" (errno 20).

### Issue Type

Bug Report

### Component Name

role

### Ansible Version

```console
$ ansible --version
ansible [core 2.14.5]
  config file = /Users/atsalolikhin/.ansible.cfg
  configured module search path = ['/Users/atsalolikhin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/atsalolikhin/py-3.9.13/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/atsalolikhin/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/atsalolikhin/py-3.9.13/bin/ansible
  python version = 3.9.13 (main, Jul 20 2022, 17:45:35) [Clang 13.0.0 (clang-1300.0.29.3)] (/Users/atsalolikhin/py-3.9.13/bin/python3.9)
  jinja version = 3.0.3
  libyaml = True
```


### Configuration

 N/A
 


### OS / Environment

N/A

### Steps to Reproduce


Add this to your `requirements.yaml`:

```yaml
- src: https://gitlab.com/atsaloli/ansible-galaxy-issue-271.git
  version: main
  scm: git
```

and then try to install roles, with e.g., `ansible-galaxy install -r requirements.yml`

### Expected Results

I expected the role to be installed.

### Actual Results

```console
The role install failed.


$ ansible-galaxy install -r requirements.yml --force
Starting galaxy role install process
- extracting ansible-galaxy-issue-271 to /home/atsaloli/.ansible/roles/ansible-galaxy-issue-271
[WARNING]: - ansible-galaxy-issue-271 was NOT installed successfully: Could not update files in /home/atsaloli/.ansible/roles/ansible-galaxy-issue-271:
[Errno 20] Not a directory: '/home/atsaloli/.ansible/roles/ansible-galaxy-issue-271/files/udf/CMC_VWAP.class'
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
$
```
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
#
#
#
#
#
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import errno
import datetime
import os
import tarfile
import tempfile
from collections.abc import MutableSequence
from shutil import rmtree
from ansible import context
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.galaxy.api import GalaxyAPI
from ansible.galaxy.user_agent import user_agent
from ansible.module_utils.common.text.converters import to_native, to_text
from ansible.module_utils.common.yaml import yaml_dump, yaml_load
from ansible.module_utils.compat.version import LooseVersion
from ansible.module_utils.urls import open_url
from ansible.playbook.role.requirement import RoleRequirement
from ansible.utils.display import Display
display = Display()
class GalaxyRole(object):