valentinocossar / trellis-database-uploads-migration

Ansible playbook for Trellis that manages database and uploads migration.
MIT License
94 stars 13 forks source link

error when syncing uploads #6

Closed simonpeters closed 6 years ago

simonpeters commented 7 years ago

Hello,

I'm having troubles with the uploads playbook.

It fails when it checks to see if the folder exists, here is the command and output

command: ansible-playbook uploads.yml -e env=staging -e site=new-staging.example.com -e mode=push -vvv

output

TASK [Check if new-staging.example.com folder exists] *************************
task path: /Users/simon/web/example/trellis/uploads.yml:16
Using module file /usr/local/lib/python2.7/site-packages/ansible/modules/core/files/stat.py
<192.168.50.5> ESTABLISH SSH CONNECTION FOR USER: vagrant
<192.168.50.5> SSH: EXEC ssh -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=".vagrant/machines/default/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o ControlPath=/Users/simon/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.50.5 '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''

ok: [staging_host -> 192.168.50.5] => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "checksum_algorithm": "sha1", 
            "follow": false, 
            "get_checksum": true, 
            "get_md5": true, 
            "mime": false, 
            "path": "/srv/www/new-staging.example.com"
        }, 
        "module_name": "stat"
    }, 
    "stat": {
        "exists": false
    }
}

It seem that staging_host is set to 192.168.50.5 which is the vagrant IP and not the actual staging server.

My hosts files seem to be configured correctly so I'm not sure where to look next.

simonpeters commented 7 years ago

Seems like the problem was I used different site names for staging and development!

valentinocossar commented 7 years ago

Hi, is your vagrant VM running when you run the command? This because all tasks check if the Bedrock site folder exists and the name is the same configured in the "local_path" parameter in wordpress_sites.yml. But, if the local vagrant VM is powered off, the command fails because can't check if the folder really exists.

Maybe you use a different "local_path" folders for every environment? This is a scenario that I've never tested.

Thank you for the feedback.