1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ansible Automation Platform サーバーに awx コマンドを導入する

Last updated at Posted at 2025-10-31

はじめに

IBM Power 上 RHEL 9.4 に導入した Ansible Automation Platform (AAP) で Ansible Automation Controller CLI である awx コマンドを導入した確認ログです。

参考:


環境

・HW: IBM Power10 S1022
 仮想マシン:
  OS: RHEL 9.4 ppc64le (PU Desired 0.5, VP Max 1, Memory 32GB)
・Ansible Automation Platform 2.5.9 (1 ノード構成)


automation-controller-cli の導入

ansible-automation-platform-2.5-for-rhel-9-ppc64le-rpms リポジトリを有効化し、automation-controller-cli を導入します。

  • 有効なサブスクリプションが必要です。
[root@aap1 ~]# dnf install --enablerepo=ansible-automation-platform-2.5-for-rhel-9-ppc64le-rpms automation-controller-cli
Updating Subscription Management repositories.
Red Hat Ansible Automation Platform 2.5 for RHEL 9 ppc64le (RPMs)                                                                                                     1.0 MB/s | 2.8 MB     00:02
Last metadata expiration check: 0:00:02 ago on Sun Apr  6 02:47:35 2025.
Dependencies resolved.
======================================================================================================================================================================================================
 Package                                           Architecture                Version                              Repository                                                                   Size
======================================================================================================================================================================================================
Installing:
 automation-controller-cli                         noarch                      4.6.10-1.el9ap                       ansible-automation-platform-2.5-for-rhel-9-ppc64le-rpms                     269 k
Installing dependencies:
 libnsl2                                           ppc64le                     2.0.0-1.el9                          rhel-9-for-ppc64le-appstream-rpms                                            34 k
 mpdecimal                                         ppc64le                     2.5.1-3.el9                          rhel-9-for-ppc64le-appstream-rpms                                           104 k
 python3.11                                        ppc64le                     3.11.9-7.el9_5.2                     rhel-9-for-ppc64le-appstream-rpms                                            30 k
 python3.11-certifi                                noarch                      2023.5.7-1.el9ap                     ansible-automation-platform-2.5-for-rhel-9-ppc64le-rpms                      15 k
 python3.11-charset-normalizer                     noarch                      2.1.0-1.el9                          rhel-9-for-ppc64le-appstream-rpms                                           106 k
 python3.11-idna                                   noarch                      3.4-1.el9                            rhel-9-for-ppc64le-appstream-rpms                                           113 k
 python3.11-libs                                   ppc64le                     3.11.9-7.el9_5.2                     rhel-9-for-ppc64le-appstream-rpms                                            10 M
 python3.11-pip-wheel                              noarch                      22.3.1-5.el9                         rhel-9-for-ppc64le-appstream-rpms                                           1.4 M
 python3.11-pyyaml                                 ppc64le                     6.0-1.el9                            rhel-9-for-ppc64le-appstream-rpms                                           230 k
 python3.11-requests                               noarch                      2.31.0-2.el9ap                       ansible-automation-platform-2.5-for-rhel-9-ppc64le-rpms                     127 k
 python3.11-setuptools-wheel                       noarch                      65.5.1-3.el9                         rhel-9-for-ppc64le-appstream-rpms                                           715 k
 python3.11-six                                    noarch                      1.16.0-1.el9                         rhel-9-for-ppc64le-appstream-rpms                                            47 k
 python3.11-urllib3                                noarch                      1.26.20-1.el9ap                      ansible-automation-platform-2.5-for-rhel-9-ppc64le-rpms                     238 k
Transaction Summary
======================================================================================================================================================================================================
Install  14 Packages
Total download size: 14 M
Installed size: 55 M
Is this ok [y/N]: y
Downloading Packages:
(1/14): libnsl2-2.0.0-1.el9.ppc64le.rpm                                                                                                                                15 kB/s |  34 kB     00:02
(2/14): python3.11-charset-normalizer-2.1.0-1.el9.noarch.rpm                                                                                                           45 kB/s | 106 kB     00:02
(3/14): mpdecimal-2.5.1-3.el9.ppc64le.rpm                                                                                                                              33 kB/s | 104 kB     00:03
(4/14): python3.11-idna-3.4-1.el9.noarch.rpm                                                                                                                           50 kB/s | 113 kB     00:02
(5/14): python3.11-pyyaml-6.0-1.el9.ppc64le.rpm                                                                                                                        93 kB/s | 230 kB     00:02
(6/14): python3.11-six-1.16.0-1.el9.noarch.rpm                                                                                                                         22 kB/s |  47 kB     00:02
(7/14): python3.11-3.11.9-7.el9_5.2.ppc64le.rpm                                                                                                                        14 kB/s |  30 kB     00:02
(8/14): python3.11-pip-wheel-22.3.1-5.el9.noarch.rpm                                                                                                                  487 kB/s | 1.4 MB     00:02
(9/14): python3.11-setuptools-wheel-65.5.1-3.el9.noarch.rpm                                                                                                           255 kB/s | 715 kB     00:02
(10/14): python3.11-certifi-2023.5.7-1.el9ap.noarch.rpm                                                                                                                72 kB/s |  15 kB     00:00
(11/14): python3.11-requests-2.31.0-2.el9ap.noarch.rpm                                                                                                                409 kB/s | 127 kB     00:00
(12/14): python3.11-urllib3-1.26.20-1.el9ap.noarch.rpm                                                                                                                1.0 MB/s | 238 kB     00:00
(13/14): automation-controller-cli-4.6.10-1.el9ap.noarch.rpm                                                                                                          111 kB/s | 269 kB     00:02
(14/14): python3.11-libs-3.11.9-7.el9_5.2.ppc64le.rpm                                                                                                                 3.0 MB/s |  10 MB     00:03
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                 1.3 MB/s |  14 MB     00:10
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                              1/1
  Installing       : python3.11-setuptools-wheel-65.5.1-3.el9.noarch                                                                                                                             1/14
  Installing       : python3.11-pip-wheel-22.3.1-5.el9.noarch                                                                                                                                    2/14
  Installing       : mpdecimal-2.5.1-3.el9.ppc64le                                                                                                                                               3/14
  Installing       : libnsl2-2.0.0-1.el9.ppc64le                                                                                                                                                 4/14
  Installing       : python3.11-3.11.9-7.el9_5.2.ppc64le                                                                                                                                         5/14
  Installing       : python3.11-libs-3.11.9-7.el9_5.2.ppc64le                                                                                                                                    6/14
  Installing       : python3.11-charset-normalizer-2.1.0-1.el9.noarch                                                                                                                            7/14
  Installing       : python3.11-idna-3.4-1.el9.noarch                                                                                                                                            8/14
  Installing       : python3.11-pyyaml-6.0-1.el9.ppc64le                                                                                                                                         9/14
  Installing       : python3.11-six-1.16.0-1.el9.noarch                                                                                                                                         10/14
  Installing       : python3.11-urllib3-1.26.20-1.el9ap.noarch                                                                                                                                  11/14
  Installing       : python3.11-certifi-2023.5.7-1.el9ap.noarch                                                                                                                                 12/14
  Installing       : python3.11-requests-2.31.0-2.el9ap.noarch                                                                                                                                  13/14
  Installing       : automation-controller-cli-4.6.10-1.el9ap.noarch                                                                                                                            14/14
  Running scriptlet: automation-controller-cli-4.6.10-1.el9ap.noarch                                                                                                                            14/14
  Verifying        : libnsl2-2.0.0-1.el9.ppc64le                                                                                                                                                 1/14
  Verifying        : mpdecimal-2.5.1-3.el9.ppc64le                                                                                                                                               2/14
  Verifying        : python3.11-charset-normalizer-2.1.0-1.el9.noarch                                                                                                                            3/14
  Verifying        : python3.11-idna-3.4-1.el9.noarch                                                                                                                                            4/14
  Verifying        : python3.11-pyyaml-6.0-1.el9.ppc64le                                                                                                                                         5/14
  Verifying        : python3.11-six-1.16.0-1.el9.noarch                                                                                                                                          6/14
  Verifying        : python3.11-pip-wheel-22.3.1-5.el9.noarch                                                                                                                                    7/14
  Verifying        : python3.11-setuptools-wheel-65.5.1-3.el9.noarch                                                                                                                             8/14
  Verifying        : python3.11-3.11.9-7.el9_5.2.ppc64le                                                                                                                                         9/14
  Verifying        : python3.11-libs-3.11.9-7.el9_5.2.ppc64le                                                                                                                                   10/14
  Verifying        : python3.11-certifi-2023.5.7-1.el9ap.noarch                                                                                                                                 11/14
  Verifying        : python3.11-requests-2.31.0-2.el9ap.noarch                                                                                                                                  12/14
  Verifying        : python3.11-urllib3-1.26.20-1.el9ap.noarch                                                                                                                                  13/14
  Verifying        : automation-controller-cli-4.6.10-1.el9ap.noarch                                                                                                                            14/14
Installed products updated.
Installed:
  automation-controller-cli-4.6.10-1.el9ap.noarch   libnsl2-2.0.0-1.el9.ppc64le                        mpdecimal-2.5.1-3.el9.ppc64le               python3.11-3.11.9-7.el9_5.2.ppc64le
  python3.11-certifi-2023.5.7-1.el9ap.noarch        python3.11-charset-normalizer-2.1.0-1.el9.noarch   python3.11-idna-3.4-1.el9.noarch            python3.11-libs-3.11.9-7.el9_5.2.ppc64le
  python3.11-pip-wheel-22.3.1-5.el9.noarch          python3.11-pyyaml-6.0-1.el9.ppc64le                python3.11-requests-2.31.0-2.el9ap.noarch   python3.11-setuptools-wheel-65.5.1-3.el9.noarch
  python3.11-six-1.16.0-1.el9.noarch                python3.11-urllib3-1.26.20-1.el9ap.noarch
Complete!
[root@aap1 ~]#

コマンド確認と追加モジュール導入

awx コマンドを確認しますが、エラーになります。

[root@aap1 ~]# awx project list
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'

pkg_resources が見つからないというエラーが表示されました。

調査により get-pip.py を実行すると解決できる内容がありましたのでそちらを実行します。

# wget https://bootstrap.pypa.io/get-pip.py
--2025-04-06 03:06:37--  https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io (bootstrap.pypa.io)... xxx.xxx.xx.xxx, xx.xxx.xxx.xx, xxx.xxx.x.xxx, ...
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|xxx.xxx.xx.xxx|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2300175 (2.2M) [text/x-python]
Saving to: ‘get-pip.py’

get-pip.py                                        100%[===========================================================================================================>]   2.19M  4.35MB/s    in 0.5s
2025-04-06 03:06:38 (4.35 MB/s) - ‘get-pip.py’ saved [2300175/2300175]
# python3.11 get-pip.py
Collecting pip
  Downloading pip-25.0.1-py3-none-any.whl.metadata (3.7 kB)
Collecting setuptools
  Downloading setuptools-78.1.0-py3-none-any.whl.metadata (6.6 kB)
Collecting wheel
  Downloading wheel-0.45.1-py3-none-any.whl.metadata (2.3 kB)
Downloading pip-25.0.1-py3-none-any.whl (1.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 4.4 MB/s eta 0:00:00
Downloading setuptools-78.1.0-py3-none-any.whl (1.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 4.5 MB/s eta 0:00:00
Downloading wheel-0.45.1-py3-none-any.whl (72 kB)
Installing collected packages: wheel, setuptools, pip
Successfully installed pip-25.0.1 setuptools-78.1.0 wheel-0.45.1

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

setuptools のバージョンが更新されたので、再度設定し直します。

・上書き導入されたsetuptools 78.1を削除

# python3.11 -m pip uninstall -y setuptools

Found existing installation: setuptools 78.1.
Uninstalling setuptools-78.1.0:
  Successfully uninstalled setuptools-78.1.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

・setuptools==69.5.1指定で導入し直し

# python3.11 -m pip install setuptools==69.5.1
Collecting setuptools==69.5.1
  Downloading setuptools-69.5.1-py3-none-any.whl.metadata (6.2 kB)
Downloading setuptools-69.5.1-py3-none-any.whl (894 kB)

   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 894.6/894.6 kB 10.3 MB/s eta 0:00:00

Installing collected packages: setuptools
Successfully installed setuptools-69.5.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

これで awx コマンドが実行できるようになりました。

[root@aap1 work]# awx --help
usage: awx [--help] [--version] [--conf.host https://example.awx.org] [--conf.token TEXT] [--conf.username TEXT] [--conf.password TEXT] [-k] [-f {json,yaml,jq,human}] [--filter TEXT]
           [--conf.color BOOLEAN] [-v]
           resource ...

positional arguments:
  resource
    login               authenticate and retrieve an OAuth2 token
    config              print current configuration values
    import              import resources into Tower
    export              export resources from Tower

options:
  --help                prints usage information for the awx tool
  --version             display awx CLI version

authentication:
  --conf.host https://example.awx.org
  --conf.token TEXT     an OAuth2.0 token (get one by using `awx login`)
  --conf.username TEXT
  --conf.password TEXT
  -k, --conf.insecure   Allow insecure server connections when using SSL
input/output formatting:
  -f {json,yaml,jq,human}, --conf.format {json,yaml,jq,human}
                        specify a format for the input and output
  --filter TEXT         specify an output filter (only valid with jq or human format)
  --conf.color BOOLEAN  Display colorized output. Defaults to True
  -v, --verbose         print debug-level logs, including requests made
[root@aap1 work]#


コマンド実行

token 発行

まずはログインを実施して、token を発行します。

# export HOST="https://xxx.xx.xxx.xx"

# export PASSWORD=xxxxxxxx

# export AWXKIT_API_BASE_PATH="/api/controller/"

# export TOKEN=`awx login --conf.host $HOST --conf.username admin --conf.password $PASSWORD -k | jq -r '.token'`

# echo $TOKEN
xxxxxxxxx

ユーザー・リストの確認

[root@aap1 ~]# awx --conf.token $TOKEN user list -f human -k
id username
== ===================
1  admin
15 _token_service_user

ホスト・リストの確認

[root@aap1 ~]# awx --conf.token $TOKEN host list -f human -k
id name
== =========
3  bastion
1  localhost

workflow job リストの確認

[root@aap1 ~]# awx --conf.token $TOKEN workflow_job list -f human -k
id  name
=== ===========================

252 delete_vm_workflow
271 infra-deploy-automation
354 git-hello
363 ibmcloud-helloworld

usage 参考

usage: awx [--help] [--version] [--conf.host https://example.awx.org] [--conf.token TEXT]
           [--conf.username TEXT] [--conf.password TEXT] [-k] [-f {json,yaml,jq,human}]
           [--filter TEXT] [--conf.color BOOLEAN] [-v]
           resource ...

positional arguments:
  resource
    login               authenticate and retrieve an OAuth2 token
    config              print current configuration values
    import              import resources into Tower
    export              export resources from Tower
    ping
    instances (instance)
    instance_groups (instance_group)
    receptor_addresses
    settings (setting)
    me
    organizations (organization)
    users (user)
    execution_environments (execution_environment)
    projects (project)
    project_updates (project_update)
    teams (team)
    credentials (credential)
    credential_types (credential_type)
    credential_input_sources
    applications (application)
    tokens
    metrics
    inventory (inventories)
    constructed_inventory
    inventory_sources (inventory_source)
    inventory_updates (inventory_update)
    groups (group)
    hosts (host)
    host_metrics
    host_metric_summary_monthly
    job_templates (job_template)
    jobs (job)
    ad_hoc_commands (ad_hoc)
    system_job_templates
    system_jobs
    schedules (schedule)
    roles (role)
    notification_templates (notification_template)
    notifications
    labels (label)
    unified_job_templates
    unified_jobs
    activity_stream
    workflow_job_templates (workflow)
    workflow_jobs (workflow_job)
    workflow_approvals
    workflow_job_template_nodes (node)
    workflow_job_nodes
    mesh_visualizer
    bulk
    analytics
    service_index
    role_definitions
    role_user_assignments
    role_team_assignments

options:
  --help                prints usage information for the awx tool
  --version             display awx CLI version

authentication:
  --conf.host https://example.awx.org
  --conf.token TEXT     an OAuth2.0 token (get one by using `awx login`)
  --conf.username TEXT
  --conf.password TEXT
  -k, --conf.insecure   Allow insecure server connections when using SSL

input/output formatting:
  -f {json,yaml,jq,human}, --conf.format {json,yaml,jq,human}
                        specify a format for the input and output
  --filter TEXT         specify an output filter (only valid with jq or human format)
  --conf.color BOOLEAN  Display colorized output. Defaults to True
  -v, --verbose         print debug-level logs, including requests made

awx: argument resource: invalid choice: 'template' (choose from 'login', 'config', 'import', 'export', 'ping', 'instances', 'instance', 'instance_groups', 'instance_group', 'receptor_addresses', 'settings', 'setting', 'me', 'organizations', 'organization', 'users', 'user', 'execution_environments', 'execution_environment', 'projects', 'project', 'project_updates', 'project_update', 'teams', 'team', 'credentials', 'credential', 'credential_types', 'credential_type', 'credential_input_sources', 'applications', 'application', 'tokens', 'metrics', 'inventory', 'inventories', 'constructed_inventory', 'inventory_sources', 'inventory_source', 'inventory_updates', 'inventory_update', 'groups', 'group', 'hosts', 'host', 'host_metrics', 'host_metric_summary_monthly', 'job_templates', 'job_template', 'jobs', 'job', 'ad_hoc_commands', 'ad_hoc', 'system_job_templates', 'system_jobs', 'schedules', 'schedule', 'roles', 'role', 'notification_templates', 'notification_template', 'notifications', 'labels', 'label', 'unified_job_templates', 'unified_jobs', 'activity_stream', 'workflow_job_templates', 'workflow', 'workflow_jobs', 'workflow_job', 'workflow_approvals', 'workflow_job_template_nodes', 'node', 'workflow_job_nodes', 'mesh_visualizer', 'bulk', 'analytics', 'service_index', 'role_definitions', 'role_user_assignments', 'role_team_assignments')


おわりに

コマンドを使用した設定や、構成情報のエクスポート、インポートを試してみたいと思います。

これまでに実施した AAP 関連の検証については、以下をご参照ください。

以上です。

1
0
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?