機械翻訳について

コマンド・ライン・インタフェースの使用

awxコマンドは、Oracle Linux Automation Managerでリソースを構成、デプロイおよび管理するために使用されます。 awxコマンドは、Oracle Linux Automation Managerサーバー、またはそのサーバーに接続できるOracle Linux 8システムでol-automation-manager-cliパッケージを使用してインストールされます。 Oracle Linux自動化サーバーの設定の詳細は、Oracle Linux Automation Managerのドキュメントを参照してください。

awxを操作するには、一連のオプションを指定してコマンドを入力します。 awxコマンド単独では、次の構文情報が返されます。

awx
usage: awx [--help] [--version] [--conf.host https://<host or IP address>]
           [--conf.token TEXT] [--conf.username TEXT] [--conf.password TEXT]
           [-k] [-f {json,yaml,jq,human}] [--filter TEXT]
           [--conf.color BOOLEAN] [-v]

optional arguments:
  --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

usageセクションには、使用時のオプションの位置がリストされます。 これらのオプションは、optional arguments:authentication:およびinput/output formatting:の各セクションで定義されます。

awxコマンドを使用するとき、欠落しているオプションがあれば指定を求められます。

構文ヘルプの表示

--helpオプションを使用すると、awxコマンドの構文に関するヘルプを表示できます。 たとえば、awxコマンドで使用可能なリソース・オプションを次に示します。

ノート:

この項のコマンドを使用するには、Oracle Linux Automation Managerサーバーに接続する必要があります。 コマンドライン・ツールを使用してOracle Linux Automation Managerサーバーに接続する方法の詳細は、コマンド・ライン・インタフェースの使用を参照してください。
awx --conf.host https://192.102.118.107 --conf.token 0AlhUsyKqXwBAEmNerwlcqB6a3aRlP --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
    ping
    instances (instance)
    instance_groups (instance_group)
    config
    settings (setting)
    me
    organizations (organization)
    users (user)
    projects (project)
    project_updates (project_update)
    teams (team)
    credentials (credential)
    credential_types (credential_type)
    credential_input_sources
    applications (application)
    tokens
    metrics
    inventory (inventories)
    inventory_scripts (inventory_script)
    inventory_sources (inventory_source)
    inventory_updates (inventory_update)
    groups (group)
    hosts (host)
    job_templates (job_template)
    jobs (job)
    job_events
    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

Positional argumentsセクションには、awxコマンドで使用可能なリソースがリストされます。 これらのリソースの詳細を取得するには、コマンドにそれらを追加し、その後に--helpオプションを指定します。 たとえば、次のコマンドでは、usersリソースで使用可能なアクションが表示されます。

awx --conf.host https://192.102.118.107 --conf.token h7a3NPiam8Or4px7Kkoe87cWcTeixz users --help
usage: awx users [-h] action ...

positional arguments:
  action
    list
    create
    get
    modify
    delete
    grant
    revoke

optional arguments:
  -h, --help  show this help message and exit

awx users: the following arguments are required: action

続いて、コマンドにアクションを追加し、--helpを使用して追加のヘルプ・テキストを生成できます。 たとえば、usersリソースに固有である、listアクションの追加オプションを次に示します。

awx --conf.host https://192.102.118.107 --conf.token h7a3NPiam8Or4px7Kkoe87cWcTeixz users list --help
usage: awx users list [-h] [--all] [-f {json,yaml,jq,human}] [--filter TEXT]
                      [--conf.color BOOLEAN] [-v] [--type {user}]
                      [--username TEXT] [--first_name TEXT] [--last_name TEXT]
                      [--email TEXT] [--is_superuser BOOLEAN]
                      [--last_login LAST_LOGIN]

optional arguments:
  -h, --help            show this help message and exit
  --all                 fetch all pages of content from the API when returning
                        results (instead of just the first page)
  --type {user}         only list users with the specified type
  --username TEXT       only list users with the specified username
  --first_name TEXT     only list users with the specified first_name
  --last_name TEXT      only list users with the specified last_name
  --email TEXT          only list users with the specified email
  --is_superuser BOOLEAN
                        only list users with the specified is_superuser
  --last_login LAST_LOGIN
                        only list users with the specified last_login

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

このコマンドから返されるoptional arguments:には、結果をフィルタするための追加の方法がリストされます。

--helpオプションを使用して取得した情報によって、Oracle Linux Automation Managerサーバーで構成されているすべてのユーザーを検索して、探しているユーザーを見つけるために必要な情報を得ることができます。 たとえば、次のコマンドでは、ユーザー名johnsmithのユーザー情報が表示されます

.awx --conf.host https://192.102.118.107 --conf.token h7a3NPiam8Or4px7Kkoe87cWcTeixz users list --username johnsmith
{
     "count": 1,
     "next": null,
     "previous": null,
     "results": [
          {
               "id": 3,
               "type": "user",
               "url": "/api/v2/users/3/",
               "related": {
                    "teams": "/api/v2/users/3/teams/",
                    "organizations": "/api/v2/users/3/organizations/",
                    "admin_of_organizations": "/api/v2/users/3/admin_of_organizations/",
                    "projects": "/api/v2/users/3/projects/",
                    "credentials": "/api/v2/users/3/credentials/",
                    "roles": "/api/v2/users/3/roles/",
                    "activity_stream": "/api/v2/users/3/activity_stream/",
                    "access_list": "/api/v2/users/3/access_list/",
                    "tokens": "/api/v2/users/3/tokens/",
                    "authorized_tokens": "/api/v2/users/3/authorized_tokens/",
                    "personal_tokens": "/api/v2/users/3/personal_tokens/"
               },
               "summary_fields": {
                    "user_capabilities": {
                         "edit": true,
                         "delete": true
                    }
               },
               "created": "2021-11-12T16:11:37.315560Z",
               "username": "johnssmith",
               "first_name": "John",
               "last_name": "Smith",
               "email": "example@example.com",
               "is_superuser": false,
               "is_system_auditor": true,
               "ldap_dn": "",
               "last_login": "2021-11-12T16:14:47.532042Z",
               "external_account": null,
               "auth": []
          }
     ]
}