Tower Install Ansible Tower CLI on Linux CentOs

Rajesh
3 min readJun 7, 2020

Ansible Tower CLI is a opensource project (under Apache 2.0 license) which is a command line utility to manage Ansible tower/AWX from command line.
It work by sending a RESTful API command to Tower-CLI and it respond to them with output. It is a powerful utility capable of performing numerous operations that we otherwise perform form Ansible Tower/AWX GUI which help us automate quite a lot of work.

Tower CLI very well complements its GUI version Tower/AWX, its capability is not just limited to creating, modifying retrieving and deleting object in tower but much more.
We will explore more about tower-cli in is this article.

How to install and configure Ansible Tower-CLI

Prerequisites: Python and pip

Instillation of Tower CLI is simple with the help of Python pip

$ pip install ansible-tower-cli

The preferred way of installing tower-cli is though pip.

How to configure Tower-CLI

Before we can start using tower-cli we have let tower-cli know, what is Tower/AWX URL and user name and password which will be use to make REST API calls. A privileged user is required to access all component.

tower-cli config
Tower-Cli Config

Note: In case you are using SSL certificate, set verify_ssl to True

Once Tower-CLI is configured with a admin user, you will be able to access number of resources and we where using with GUI.

Tower CLI Resources:

  • activity_stream Activity on server, for audit
  • ad_hoc Launch commands based on playbook
  • application Manage OAuth2 applications
  • credential Manage credentials within Ansible Tower
  • credential_type Manage credential types within Ansible Tower
  • group Manage groups belonging to an inventory
  • host Manage hosts belonging to a group
  • instance Check instances within Ansible Tower
  • instance_group Check instance groups within Ansible Tower
  • inventory Manage inventory within Ansible Tower
  • inventory_script Manage inventory scripts within Ansible
  • inventory_source Manage inventory sources within Ansible
  • inventory_update Launch or monitor inventory source updates
  • job Launch or monitor jobs
  • job_template Manage job templates
  • label Manage labels within Ansible Tower
  • node Manage nodes inside of a workflow job
  • notification_template Manage notification templates within Ansible
  • organization Manage organizations within Ansible Tower
  • project Manage projects within Ansible Tower
  • project_update Launch or monitor project updates
  • role Add and remove users/teams from roles
  • schedule Manage schedules within Ansible Tower
  • setting Manage settings within Ansible Tower
  • team Manage teams within Ansible Tower
  • user Manage users within Ansible Tower
  • workflow Manage workflow job templates
  • workflow_job Launch or monitor workflow jobs
Tower-CLI cmds
Access project,templates,scheduled jobs and host list
Towerl-CLI trigger jobs
Trigger a template job from CLI and get output in real-time in terminal
Towerl-CLI Jobs
Access Tower Job list with status

You can do quite a lot with tower-cli, find few common command are list below for quick start.

Ansible Tower CLI

Note: Ansible tower is no more under active development, but will still work for many more years to come. So keeping using it and happy automating.

My Boss, after i automated everything and chill 😂

--

--

Rajesh

A tech guy doing Cloud and DevOps stuffs, loves tech, cloud, network and IT security.