### Summary

When a role import fails, the galaxy cli code does not alter the exit code for the command accordingly. It is always zero.

https://github.com/ansible/ansible/blob/devel/lib/ansible/cli/galaxy.py#L1818C1-L1833C17

```
        if context.CLIARGS['check_status'] or context.CLIARGS['wait']:
            # Get the status of the import
            msg_list = []
            finished = False
            while not finished:
                task = self.api.get_import_task(task_id=task[0]['id'])
                for msg in task[0]['summary_fields']['task_messages']:
                    if msg['id'] not in msg_list:
                        display.display(msg['message_text'], color=colors[msg['message_type']])
                        msg_list.append(msg['id'])
                if task[0]['state'] in ['SUCCESS', 'FAILED']:
                    finished = True
                else:
                    time.sleep(10)

        return 0
```

The code knows the task is "finished" if state is either SUCCESS or FAILED, but the FAILED state does not affect the return value.

### Issue Type

Bug Report

### Component Name

ansible-galaxy

### Ansible Version

```console
(venv) [jtanner@p1 galaxy_ng.role_exception_logging]$ ansible-galaxy --version
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying
out features under development. This is a rapidly changing source of code and can become unstable at any point.
ansible-galaxy [core 2.17.0.dev0] (devel fd009a073a) last updated 2023/11/08 12:01:58 (GMT -400)
  config file = /home/jtanner/workspace/github/jctanner.redhat/galaxy_ng.role_exception_logging/ansible.cfg
  configured module search path = ['/home/jtanner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/jtanner/workspace/github/jctanner.redhat/galaxy_ng.role_exception_logging/ansible.core/lib/ansible
  ansible collection location = /home/jtanner/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/jtanner/workspace/github/jctanner.redhat/galaxy_ng.role_exception_logging/ansible.core/bin/ansible-galaxy
  python version = 3.11.6 (main, Oct  3 2023, 00:00:00) [GCC 13.2.1 20230728 (Red Hat 13.2.1-1)] (/home/jtanner/workspace/github/jctanner.redhat/galaxy_ng.role_exception_logging/venv/bin/python)
  jinja version = 3.1.2
  libyaml = True
```


### Configuration

```console
N/A
```


### OS / Environment

Fedora 38

### Steps to Reproduce

1. Setup a galaxy server
2. ansible-galaxy role import -vvvv nephelaiio ansible-role-packetbeat

### Expected Results

The ansible-galaxy command should exit non-zero if the task is in a FAILED state.

### Actual Results

```console
exit 0
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
install_parser.add_argument('--offline', dest='offline', action='store_true', default=False,
                                        help='Install collection artifacts (tarballs) without contacting any distribution servers. '
                                             'This does not apply to collections in remote Git repositories or URLs to remote tarballs.'
                                        )
        else:
            install_parser.add_argument('-r', '--role-file', dest='requirements',
                                        help='A file containing a list of roles to be installed.')
            r_re = re.compile(r'^(?<!-)-[a-zA-Z]*r[a-zA-Z]*')  
            contains_r = bool([a for a in self._raw_args if r_re.match(a)])
            role_file_re = re.compile(r'--role-file($|=)')  
            contains_role_file = bool([a for a in self._raw_args if role_file_re.match(a)])
            if self._implicit_role and (contains_r or contains_role_file):
                
                install_parser.add_argument('--keyring', dest='keyring', default=C.GALAXY_GPG_KEYRING,
                                            help='The keyring used during collection signature verification')
                install_parser.add_argument('--disable-gpg-verify', dest='disable_gpg_verify', action='store_true',
                                            default=C.GALAXY_DISABLE_GPG_VERIFY,
                                            help='Disable GPG signature verification when installing collections from a Galaxy server')
                install_parser.add_argument('--required-valid-signature-count', dest='required_valid_signature_count', type=validate_signature_count,
                                            help=valid_signature_count_help, default=C.GALAXY_REQUIRED_VALID_SIGNATURE_COUNT)
                install_parser.add_argument('--ignore-signature-status-code', dest='ignore_gpg_errors', type=str, action='append',
                                            help=opt_help.argparse.SUPPRESS, default=C.GALAXY_IGNORE_INVALID_SIGNATURE_STATUS_CODES,
                                            choices=list(GPG_ERROR_MAP.keys()))
                install_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()))
            install_parser.add_argument('-g', '--keep-scm-meta', dest='keep_scm_meta', action='store_true',
                                        default=False,
                                        help='Use tar instead of the scm archive option when packaging the role.')
    def add_build_options(self, parser, parents=None):