TASK [deploy : WordPress Installed?] - ssh connection fails deploy/hooks/finalize-before.yml:7

Please help me to understand why this specific task fails with the ssh connection while all the previous tasks are finished with no errors.

  • bought new computer
  • cloned existing project repo dev/stag/prod all in use, initiated with old comp
  • vagrant up (learned a lot in the process, thanks Roots team :clap::brain::muscle:)
  • did set up keys and forwarding
  • remote server can connect as web/admin to github repo
  • can provision server on both (old,new) local machines
  • updated wp to 4.8.2 + some plugins, cleared composer cache from server …

both computers fail with mentioned task with ssh connection while trying to do or connect what exactly? copy/write to tmp_multisite_constants.php?

please help me to understand this, why ssh connection is different from the previous tasks?

ansible-playbook deploy.yml -e “site=staginsite.com env=staging” -vvvv

TASK [deploy : WordPress Installed?] ****************************************************************************************
                    task path: /Users/username/Dev/stagingsite.com/trellis/roles/deploy/hooks/finalize-before.yml:7
                    Using module file /usr/local/Cellar/ansible/2.3.2.0_1/libexec/lib/python2.7/site-packages/ansible/modules/commands/command.py
                    <123.456.789> ESTABLISH SSH CONNECTION FOR USER: web
                    <123.456.789> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 -o ControlPath=/Users/username/.ansible/cp/49a1f75ace 123.456.789 '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
                    <123.456.789> (0, '\n{
                      "changed": true, 
                      "end": "2017-09-27 04:56:28.763097", 
                      "stdout": "", 
                      "cmd": [
                        "wp", 
                        "core", 
                        "is-installed", 
                        "--skip-plugins", 
                        "--skip-themes", 
                        "--require=/srv/www/stagingsite.com/shared/tmp_multisite_constants.php"
                      ], 
                      "rc": 255, 
                      "start": "2017-09-27 04:56:28.246278", 
                      "stderr": "Error: Cannot connect over SSH using provided configuration.", 
                      "delta": "0:00:00.516819", "invocation": {
                        "module_args": {
                          "warn": true, 
                          "executable": null, 
                          "chdir": "/srv/www/stagingsite.com/releases/20170927045432", 
                          "_raw_params": "wp core is-installed --skip-plugins --skip-themes --require=/srv/www/stagingsite.com/shared/tmp_multisite_constants.php", 
                          "removes": null, 
                          "creates": null, 
                          "_uses_shell": false
                          }
                        }, 
                      "warnings": []
                    }\n', 'OpenSSH_7.4p1, 
                    LibreSSL 2.5.0
                    \r\ndebug1: Reading configuration data /Users/username/.ssh/config
                    \r\ndebug1: /Users/username/.ssh/config line 1: Applying options for 123.456.789
                    \r\ndebug1: /Users/username/.ssh/config line 13: Applying options for *
                    \r\ndebug1: Reading configuration data /etc/ssh/ssh_config
                    \r\ndebug1: auto-mux: Trying existing master
                    \r\ndebug2: fd 3 setting O_NONBLOCK
                    \r\ndebug2: mux_client_hello_exchange: master version 4
                    \r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote
                    \r\ndebug3: mux_client_request_session: entering
                    \r\ndebug3: mux_client_request_alive: entering
                    \r\ndebug3: mux_client_request_alive: done pid = 21532
                    \r\ndebug3: mux_client_request_session: session request sent
                    \r\ndebug1: mux_client_request_session: master session id: 2
                    \r\ndebug3: mux_client_read_packet: read header failed: Broken pipe
                    \r\ndebug2: Received exit status from master 0\r\n')
                    System info:
                      Ansible 2.3.2.0; Darwin
                      Trellis at "Add Vagrant config"
                    ---------------------------------------------------
                    Error: Cannot connect over SSH using provided configuration.
                    fatal: [123.456.789]: FAILED! => {
                        "changed": false,
                        "cmd": [
                            "wp",
                            "core",
                            "is-installed",
                            "--skip-plugins",
                            "--skip-themes",
                            "--require=/srv/www/stagingsite.com/shared/tmp_multisite_constants.php"
                        ],
                        "delta": "0:00:00.516819",
                        "end": "2017-09-27 04:56:28.763097",
                        "failed": true,
                        "failed_when_result": true,
                        "invocation": {
                            "module_args": {
                                "_raw_params": "wp core is-installed --skip-plugins --skip-themes --require=/srv/www/stagingsite.com/shared/tmp_multisite_constants.php",
                                "_uses_shell": false,
                                "chdir": "/srv/www/stagingsite.com/releases/20170927045432",
                                "creates": null,
                                "executable": null,
                                "removes": null,
                                "warn": true
                            }
                        },
                        "rc": 255,
                        "start": "2017-09-27 04:56:28.246278",
                        "stderr": "Error: Cannot connect over SSH using provided configuration.",
                        "stderr_lines": [
                            "Error: Cannot connect over SSH using provided configuration."
                        ],
                        "stdout": "",
                        "stdout_lines": []
                    }
                    	to retry, use: --limit @/Users/username/Dev/stagingsite.com/trellis/deploy.retry

                    PLAY RECAP ******************************************************************************************************************
                    123.456.789            : ok=27   changed=12   unreachable=0    failed=1
                    localhost                  : ok=0    changed=0    unreachable=0    failed=0

                    ➜  trellis git:(master)

Now that’s a weird bug.

At a quick glance it looks like an Ansible SSH error, but it’s not. It’s actually an SSH error from WP-CLI.

Googling that message led to:

For some WP-CLI is trying to execute a command over SSH during that task. Have you customized your WP-CLI config in some way?

Can you check the contents of that file?

1 Like

Thank you for quick reply and help!

Yes, I had a custom conf file. Now I remember that I was trying to get WP-CLI aliases working couple of months ago with this project and did forget about the wp-cli.yml file.
This ssh issue got solved now and took ca 30 deployment tries :relieved:
Good hint also about to goole the errors :slight_smile:

This task fails and shows new error.

I already followed the steps to remove/update/require/commit and clear composer cache on the server, still the same for now. Nothing changed on server, all the old files are in current folder.

TASK [deploy : WordPress Installed?] *********************************************************************************************************************************
task path: /Users/username/Dev/mysite.ee/trellis/roles/deploy/hooks/finalize-before.yml:7
Using module file /usr/local/Cellar/ansible/2.3.2.0_1/libexec/lib/python2.7/site-packages/ansible/modules/commands/command.py
<123.456.789> ESTABLISH SSH CONNECTION FOR USER: web
<123.456.789> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 -o ControlPath=/Users/username/.ansible/cp/49a1f75ace 123.456.789 '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<123.456.789> (0, '\n{"changed": true, "end": "2017-09-27 19:53:24.779288", "stdout": "", "cmd": ["wp", "core", "is-installed", "--skip-plugins", "--skip-themes", "--require=/srv/www/mysite.ee/shared/tmp_multisite_constants.php"], "rc": 1, "start": "2017-09-27 19:53:24.401626", "stderr": "Error: This does not seem to be a WordPress install.\\nPass --path=`path/to/wordpress` or run `wp core download`.", "delta": "0:00:00.377662", "invocation": {"module_args": {"warn": true, "executable": null, "chdir": "/srv/www/mysite.ee/releases/20170927195129", "_raw_params": "wp core is-installed --skip-plugins --skip-themes --require=/srv/www/mysite.ee/shared/tmp_multisite_constants.php", "removes": null, "creates": null, "_uses_shell": false}}, "warnings": []}\n', 'OpenSSH_7.4p1, LibreSSL 2.5.0\r\ndebug1: Reading configuration data /Users/username/.ssh/config\r\ndebug1: /Users/username/.ssh/config line 13: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 30697\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
System info:
  Ansible 2.3.2.0; Darwin
  Trellis at "Add Vagrant config"
---------------------------------------------------
Error: This does not seem to be a WordPress install.
Pass --path=`path/to/wordpress` or run `wp core download`.
fatal: [123.456.789]: FAILED! => {
    "changed": false,
    "cmd": [
        "wp",
        "core",
        "is-installed",
        "--skip-plugins",
        "--skip-themes",
        "--require=/srv/www/mysite.ee/shared/tmp_multisite_constants.php"
    ],
    "delta": "0:00:00.377662",
    "end": "2017-09-27 19:53:24.779288",
    "failed": true,
    "failed_when_result": true,
    "invocation": {
        "module_args": {
            "_raw_params": "wp core is-installed --skip-plugins --skip-themes --require=/srv/www/mysite.ee/shared/tmp_multisite_constants.php",
            "_uses_shell": false,
            "chdir": "/srv/www/mysite.ee/releases/20170927195129",
            "creates": null,
            "executable": null,
            "removes": null,
            "warn": true
        }
    },
    "rc": 1,
    "start": "2017-09-27 19:53:24.401626",
    "stderr": "Error: This does not seem to be a WordPress install.\nPass --path=`path/to/wordpress` or run `wp core download`.",
    "stderr_lines": [
        "Error: This does not seem to be a WordPress install.",
        "Pass --path=`path/to/wordpress` or run `wp core download`."
    ],
    "stdout": "",
    "stdout_lines": []
}

I suggest trying that command manually on the server as the web user:

cd /srv/www/mysite.ee/current

wp core is-installed --skip-plugins --skip-themes --require=/srv/www/mysite.ee/shared/tmp_multisite_constants.php

You can debug further from there. Obviously /srv/www/mysite.ee/current should contain your repo contents.

1 Like

current contains all repo contents from last successful deployment, this staging site is live and working fine

when I run this command on server I get the same error

Error: This does not seem to be a WordPress install.
Pass --path=`path/to/wordpress` or run `wp core download`.

Ensure your wp-cli.yml file has this path setting: https://github.com/roots/bedrock/blob/master/wp-cli.yml

2 Likes
PLAY RECAP ***********************************************************************************************************************************************************
123.456.789            : ok=34   changed=16   unreachable=0    failed=0
localhost                  : ok=0    changed=0    unreachable=0    failed=0

➜  trellis git:(master)

So grateful for your help, thank you!!!

I learned a lot about ssh while trying super hard to get this deployment work and did basically every trick I could find from discourse with keys, hosts, composer, server, and what not.

I feel so much stronger now :smiley:

Solution was pretty easy at the end and 100% my own mess with this wp-cli.yml custom conf (deleted this file, tought it was all for custom only and I will try to get this working as I need to pull database from prod site down to new vagrant box on my new local dev env)

Keep up the good support! :clap:

1 Like