Documentation

8. The tower-manage Utility

The tower-manage (formerly awx-manage) utility is used to access detailed internal information of Tower. Commands for tower-manage should run as the awx or root user.

8.1. Inventory Import

tower-manage is a mechanism by which a Tower administrator can import inventory directly into Tower, for those who cannot use Custom Inventory Scripts.

To use tower-manage properly, you must first create an inventory in Tower to use as the destination for the import.

For help with tower-manage, run the following command: tower-manage inventory_import [--help]

The inventory\_import command synchronizes a Tower inventory object with a text-based inventory file, dynamic inventory script, or a directory of one or more of the above as supported by core Ansible.

When running this command, specify either an --inventory-id or --inventory-name, and the path to the Ansible inventory source (--source).

tower-manage inventory_import --source=/ansible/inventory/ --inventory-id=1

By default, inventory data already stored in Tower blends with data from the external source. To use only the external data, specify --overwrite. To specify that any existing hosts get variable data exclusively from the --source, specify --overwrite_vars. The default behavior adds any new variables from the external source, overwriting keys that do not already exist, but preserves any variables that were not sourced from the external data source.

tower-manage inventory_import --source=/ansible/inventory/ --inventory-id=1 --overwrite

Note

With the release of Ansible Tower 2.4.0, edits and additions to Inventory host variables now persist beyond an inventory sync as long as --overwrite_vars is not set. To have inventory syncs behave as they did before, it is now required that both --overwrite and --overwrite_vars are set.

8.2. Cleanup of old data

tower-manage has a variety of commands used to clean old data from Tower. Tower administrators can use the Tower Management Jobs interface for access or use the command line.

  • tower-manage cleanup_jobs [--help]

This permanently deletes the job details and job output for jobs older than a specified number of days.

  • tower-manage cleanup-deleted [--help]

This permanently deletes any deleted Tower objects that are older than a specified number of days.

  • tower-manage cleanup_activitystream [--help]

This permanently deletes any activity stream data older than a specific number of days.

8.3. HA management

Refer to the Redundancy with Tower section for details on the tower-manage register_instance and tower-manage remove_instance commands.

Note

Do not run other tower-manage commands unless instructed by Ansible Support.