Configuring the awx CLI to Work with Ansible Automation Platform 2.5
Issue
-
If you have issues trying to get the awx CLI tool from automation-controller-cli-4.6.1-1.el9ap.noarch working, these tips may help.
-
You have installed automation-controller-cli from the ansible-automation-platform-2.5-for-rhel-9-x86_64-rpms repo. When you try to use the awx cli you receive an error:
$ awx Traceback (most recent call last): File "/usr/bin/awx", line 5, in <module> from awxkit.cli import run File "/usr/lib/python3.11/site-packages/awxkit/cli/__init__.py", line 9, in <module> from .client import CLI File "/usr/lib/python3.11/site-packages/awxkit/cli/client.py", line 5, in <module> import pkg_resources ModuleNotFoundError: No module named 'pkg_resources'or
$ awx login --conf.host https://example.lan --conf.username admin --conf.password XXXX -k -v DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): example.lan:443 DEBUG:urllib3.connectionpool:https://example.lan:443 "GET /api/ HTTP/1.1" 200 None DEBUG:awxkit.api.client:"GET https://example.lan/api/" elapsed: 0:00:00.051963 Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/awxkit/cli/client.py", line 136, in fetch_version_root self.v2 = self.root.get().available_versions.v2.get() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/awxkit/api/pages/page.py", line 115, in __getattr__ raise AttributeError("{!r} object has no attribute {!r}".format(self.__class__.__name__, name)) AttributeError: 'Api' object has no attribute 'available_versions' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/awxkit/cli/__init__.py", line 24, in run cli.connect() File "/usr/lib/python3.11/site-packages/awxkit/cli/client.py", line 123, in connect self.fetch_version_root() File "/usr/lib/python3.11/site-packages/awxkit/cli/client.py", line 138, in fetch_version_root raise RuntimeError('An error occurred while fetching {}/api/'.format(self.get_config('host'))) RuntimeError: An error occurred while fetching https://example.lan/api/
Environment
- Ansible Automation Platform 2.5 on RHEL9
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.