Using the Command-Line Interface

The awx command is used to configure, deploy and manage the resources in Oracle Linux Automation Manager. The awx command is installed using the ol-automation-manager-cli package on an Oracle Linux Automation Manager server or any Oracle Linux 8 system that can connect to the server. For information about setting up an Oracle Linux Automation Server, see the Oracle Linux Automation Manager documentation.

You interact with awx by entering commands with a series of options. The awx command alone returns the following syntax information:

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

The usage section lists the position of options when used. These options are defined in the optional arguments:, authentication:, and input/output formatting: sections.

When you use the awx command, you are prompted for any missing options.

Getting Syntax Help

You can get help on the syntax for awx commands using the --help option. For example, the following shows the resources options available for the awx command:

Note:

The commands in this section require that you connect to an Oracle Linux Automation Manager server. For more information about connecting to an Oracle Linux Automation Manager server with the command-line tool, see Using the Command-Line Interface.
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

The Positional arguments section lists any available resources for the awx command. You can obtain further information about these resources by adding them to the command followed by the --help option. For example, the following command shows the available actions for the users resource:

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

You can then add the action to the command and generate additional help text using --help. For example, the following shows additional options for the list action that are specific to the users resource:

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

The optional arguments: returned from this command lists additional ways to filter results.

With the information obtained using the --help option, you now have the information you need to search through all users configured on your Oracle Linux Automation Manager server to find the one you are looking for. For example, the following command displays user information for the username 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": []
          }
     ]
}