# How to restore Templates and Projects ?

**URL:** <https://forum.ansible.com/t/how-to-restore-templates-and-projects/28441>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [August 28, 2018, 11:54am UTC](https://forum.ansible.com/t/how-to-restore-templates-and-projects/28441 "2018-08-28T11:54:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vi\_Kan](https://avatars.discourse-cdn.com/v4/letter/v/b3f665/32.png) [@Vi\_Kan](https://forum.ansible.com/u/Vi_Kan)\
**Post date:** [August 28, 2018, 11:54am UTC](https://forum.ansible.com/t/how-to-restore-templates-and-projects/28441/1 "2018-08-28T11:54:29Z")

</div>

Hi!

Unfortunately, I ran into problem with upgrading awx to 1.0.7. I had tried to update existing awx. Now my instance doesn’t work. Than I made a dump of awx database, made fresh install and imported it. Now I can login to my instance and all my settings exist here except Templates and Projects. I use docker installation method with external project\_data\_dir so my projects are present in container. Is there any way to restore them into awx?

P.S. I’ve tried to get objects via tower-cli but without any luck.

---

<div class="post-metadata">

**Author:** ![Soniya\_panwar](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@Soniya\_panwar](https://forum.ansible.com/u/Soniya_panwar)\
**Post date:** [April 29, 2019, 6:47am UTC](https://forum.ansible.com/t/how-to-restore-templates-and-projects/28441/2 "2019-04-29T06:47:03Z")

</div>

Hello Kan,

AWX does not provide any integrated solution to perform backup and restore and therefore the upgrades and migrations can only be performed as a fresh installation. In AWX there does exist a workaround, which involves copying the PostgreSQL data directory and using the same with a fresh installation to restore the backup.

In order to implement the workaround we need to perform following steps:

1. Stop the PostgreSQL docker container and copy the content of /var/lib/pgdocker directory on awx node to the same directory on awx-2 node:  
$ docker stop \<container\_id\>  
$ scp -r ./pgdocker awx-2:/var/lib/

2. Edit inventory file in installer directory on awx-2 node and provide the location of pgdocker directory in postgres\_data\_dir variable:  
Set value of “postgres\_data\_dir” in inventory file  
$ vi inventory  
postgres\_data\_dir = \</var/lib/pgdocker\>

3. Install AWX as a fresh installation in awx-2 node using the modified inventory file:  
$ ansible-playbook -i inventory install.yml –vv

4. The backed up content of awx will be visible on awx-2 dashboard.

Thanks  
Soniya

---

<div class="post-metadata">

**Author:** ![Ankit2](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@Ankit2](https://forum.ansible.com/u/Ankit2)\
**Post date:** [April 29, 2019, 6:52am UTC](https://forum.ansible.com/t/how-to-restore-templates-and-projects/28441/3 "2019-04-29T06:52:02Z")

</div>

Are you sure this will work if the versions are different for both AWX setups?

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [April 29, 2019, 8:39am UTC](https://forum.ansible.com/t/how-to-restore-templates-and-projects/28441/4 "2019-04-29T08:39:11Z")

</div>

If I am not mistaken the preferred way to upgrade is to use tower-cli to do an export. Wipe the containers. Reinstall the containers and then reimport through tower-cli. Note credentials and job history is not backed up.

The reason why this is because the team may make sudden changes to database tables and such. Exporting through towsr-cli allows you to preserve this albiet those two things.

---

<div class="post-metadata">

**Author:** ![Soniya\_panwar](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@Soniya\_panwar](https://forum.ansible.com/u/Soniya_panwar)\
**Post date:** [May 2, 2019, 10:10am UTC](https://forum.ansible.com/t/how-to-restore-templates-and-projects/28441/5 "2019-05-02T10:10:10Z")

</div>

Hello Wei-Yen Tan,

Yes, there are two options available to perform data migration from the old AWX instance to the new upgraded AWX instance:

1. Making use of tower-cli send/receive feature as described in following link: [https://github.com/ansible/awx/blob/devel/DATA\_MIGRATION.md](https://github.com/ansible/awx/blob/devel/DATA_MIGRATION.md) . Please note, this option would not migrate system settings, scheduled jobs and permissions. These are to be migrated manually.
2. Taking a backup of the directory where the PostgreSQL DB is stored and doing a fresh installation after setting postgres\_data\_dir parameter in inventory file. However, please note this option would not perform the backup of venv variables and configuration files of AWX.

Thanks  
Soniya
