Tower-cli is a command line tool for Ansible Tower. It allows Ansible Tower / AWX commands to be easily run from the Unix command line. In addition to, 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.
This quick tutorial is a part of the Get Started with Awx / Ansible Tower series. Furthermore, we will explore how to use
tower-cli tool to backup and restore your configuration objects.
Ansible Tower / AWX Backup Using Tower-cli tool
1. Execute the following command to take a complete backup of all the configuration objects in JSON format file:
$ tower-cli receive --all > backup.json
2. To export just only the credentials, you can use the below command:
$ tower-cli receive --credential all > credentials.json
3. To export all the configuration without the organization objects for example, you can execute the following command:
$ tower-cli receive --prevent organization --all > backup.json
Ansible Tower / AWX Restore Using Tower-cli tool
1. To Perform a restore of the configuration from the backup file is also very easy, just run the following command:
$ tower-cli send backup.json
2. To perform a restore to another Awx /Ansible Tower instance, you can use the below command:
$ tower-cli send backup.json --tower-host YOUR_INSTANCE_IP
3. Import anything except an organization defined in a JSON file named
$ tower-cli send --prevent organization organizations.json
You have You have learned how to use Tower-cli tool to backup and restore configuration objects in your Awx / Ansible Tower. So, for more information you can check the Tower-cli Documentation page.