Tower-CLI
Tower-cli is a command line tool for Ansible Tower. It allows Tower commands to be easily run from the UNIX command line. It can also be used as a client library for other python apps, or as a reference for others developing API interactions with Tower’s REST API.
Installation
Installing the ansible tower-cli through two differents methodes. Python Virtual environenment or from git hub
From Source
Using the main repository : tower-cli
Clone it and make the installation
git clone https://github.com/ansible/tower-cli.git
make installPython Venv
Use python pip
pip install tower-cliConfiguration
You can configure tower-cli from ~/.tower_cli.cfg file situated on your own home or /etc/tower-cli/tower-cli.
By default, this file is about :
$ tower-cli config
verify_ssl: True
username:
format: human
insecure: False
color: True
use_token: False
host: 127.0.0.1
certificate:
oauth_token:
password:
verbose: False
description_on: FalseLet insert element one by one like :
tower-cli config username = totoor modify the configuration file.
Usage
Inventories
List Hosts by inventory
- -i : inventory name
- -a, all (pages)
tower-cli host list -i inventoriy_name -aTeam
Associate user to team :
tower-cli team associate --user user_name --team team_nameGroup
Associate user to group :
tower-cli group associate --user user_name --group group_nameHost
Associate host to group :
tower-cli host associate --host host_name --group group_name