# Unable to restore Mattermost Database

**URL:** <https://forum.ansible.com/t/unable-to-restore-mattermost-database/28028>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [July 11, 2018, 1:21pm UTC](https://forum.ansible.com/t/unable-to-restore-mattermost-database/28028 "2018-07-11T13:21:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![charlie](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@charlie](https://forum.ansible.com/u/charlie)\
**Post date:** [July 11, 2018, 1:21pm UTC](https://forum.ansible.com/t/unable-to-restore-mattermost-database/28028/1 "2018-07-11T13:21:11Z")

</div>

##### SUMMARY

Unable to restore Postgres database inside container using ansible. Ansible modules, shell commands and shell scripts via ansible can not restore db inside docker container. When executed manually from same backup it works. When commands have been run from ansible that were successful on any container, the container/s consistently restarts.

##### ISSUE TYPE- Bug Report

##### COMPONENT NAME##### ANSIBLE VERSION

```auto

```

##### CONFIGURATION

root@ansible:~# ansible-config dump --only-changed  
DEFAULT\_HOST\_LIST(/etc/ansible/ansible.cfg) = [u’/etc/ansible/hosts’]  
DEFAULT\_LOG\_PATH(/etc/ansible/ansible.cfg) = /var/log/ansible.log  
DEFAULT\_REMOTE\_USER(/etc/ansible/ansible.cfg) = root  
DEFAULT\_STDOUT\_CALLBACK(/etc/ansible/ansible.cfg) = skippy

##### OS / ENVIRONMENT

ubuntu 16.04

##### STEPS TO REPRODUCE

Backup and restore database using ansible on latest version of mattermost (v5 +)

As far as I can see, as long as the format is : Ansible \> remote host \> docker container \> Postgres CLI  
any commands that successfully execute inside the Postgres CLI cause the container to enter a restart loop rendering restores useless and uncheckable.

```auto

```

##### EXPECTED RESULTS

Database restores, container starts, mattermost works, can log in etc

have tried:  
pg\_restore  
psql \< (-U, -h, -c etc…)  
cat the db and pipe into container  
docker\_container ansible module with command option

command strings, various shell scripts, piping commands into docker exec etc

##### ACTUAL RESULTS

```auto

```

Summary

Steps to reproduce

backup and restore database using ansible on latest version of mattermost (v5 +)

As far as I can see, as long as the format is : Ansible \> remote host \> docker container \> Postgres CLI  
any commands that successfully execute inside the Postgres CLI cause the container to enter a restart loop rendering restores useless and uncheckable.

Using latest version of mattermost (docker)  
Ansible V 2.5.2

Expected behavior

Database restores, container starts, mattermost works, can log in etc

have tried:  
pg\_restore  
psql \< (-U, -h, -c etc…)  
cat the db and pipe into container  
docker\_container ansible module with command option

command strings, various shell scripts, piping commands into docker exec etc

Observed behavior (that appears unintentional)
