# Failure to establish connection when provisioning via ansible-playbook server.yml

**URL:** https://discourse.roots.io/t/failure-to-establish-connection-when-provisioning-via-ansible-playbook-server-yml/6518
**Category:** trellis
**Created:** 2016-04-21T14:21:08Z
**Posts:** 31
**Showing post:** 25 of 31

## Post 25 by @jajouka — 2016-08-27T11:26:48Z

thanks for your help, I followed the instructions carefully, I switched to ubuntu 16.04 on DO, added the ssh agent to zsh, solution 1 and 2 didn’t work until I did this in my hosts/staging file:

> [@fullyint](#):
>
> ```
> ####### hosts/staging
> lc-dev1.co.uk ansible_host=178.62. **.** ansible_ssh_private_key_file='/home/sbeasley/.ssh/digital_ocean'
> ```

then this command succeeded:

> [@fullyint](#):
>
> ansible staging -m raw -a whoami -u root

I didn’t have any ssh config setup and it seems there was no need for any changes in the ansible.cfg file like you suggested:

> [@fullyint](#):
>
> In case this is a duplicate of an obscure problem, you could try adding control\_path = %(directory)s/%%h-%%r to your ansible.cfg under [ssh\_connection] (details)

it seems like I’ve run into more problems though. when attempting to provision the staging server i get this:

> ## TASK [php : Start php7.0-fpm service] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* System info: Ansible 2.1.1.0; Linux Trellis at “Fix #639 - WP 4.6 compatibility: update WP-CLI to 0.24.1”
> 
> Job for php7.0-fpm.service failed because the control process exited with  
> error code. See “systemctl status php7.0-fpm.service” and “journalctl -xe”  
> for details.

> fatal: [[lc-dev1.co.uk](http://lc-dev1.co.uk)]: FAILED! =\> {“changed”: false, “failed”: true}

> NO MORE HOSTS LEFT \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> [WARNING]: Could not create retry file ‘server.retry’. [Errno 2] No such file or directory: ‘’

> PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> [lc-dev1.co.uk](http://lc-dev1.co.uk) : ok=46 changed=2 unreachable=0 failed=1  
> localhost : ok=0 changed=0 unreachable=0 failed=0

after a bit of research i found [blob](https://github.com/roots/trellis/blob/5b50d799b34ed5f6bda72bb86a4927d9b44ca9c2/roles/php/tasks/main.yml#L63-L67) . however my version of trellis already had this set.

when I do [quote=“julianfox, post:9, topic:7418”]  
sudo systemctl status php7.0-fpm.service  
[/quote] after vagrant ssh as suggested [here](https://discourse.roots.io/t/playbook-server-failed-install-php-7-0/7418/8) i get this -

> vagrant@lc-blogs-trellis:~$ sudo systemctl status php7.0-fpm.service  
> ● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager  
> Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled)  
> Active: active (running) since Sat 2016-08-27 01:33:49 UTC; 9h ago  
> Docs: man:php-fpm7.0(8)  
> Process: 1774 ExecReload=/bin/kill -USR2 $MAINPID (code=exited, status=0/SUCCESS)  
> Main PID: 31024 (php-fpm7.0)  
> Status: “Processes active: 0, idle: 2, Requests: 19, slow: 0, Traffic: 0req/sec”  
> CGroup: /system.slice/php7.0-fpm.service  
> ├─ 1779 php-fpm: pool wordpress  
> ├─ 1969 php-fpm: pool wordpress  
> └─31024 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)

> Aug 27 01:33:49 lc-blogs-trellis systemd[1]: Starting The PHP 7.0 FastCGI Process Manager…  
> Aug 27 01:33:49 lc-blogs-trellis systemd[1]: Started The PHP 7.0 FastCGI Process Manager.  
> Aug 27 01:36:16 lc-blogs-trellis systemd[1]: Reloading The PHP 7.0 FastCGI Process Manager.  
> Aug 27 01:36:16 lc-blogs-trellis systemd[1]: Reloaded The PHP 7.0 FastCGI Process Manager.

i looked at [this forum post](https://discourse.roots.io/t/deployment-issues-with-php-fpm/5860/21)

i tried this -

> ➜ trellis git:(master) ✗ ansible “web:&staging” -m service -a “name=php7.0-fpm state=reloaded” -u web  
> [lc-dev1.co.uk](http://lc-dev1.co.uk) | FAILED! =\> {  
> “changed”: false,  
> “failed”: true,  
> “msg”: “Failed to start php7.0-fpm.service: Interactive authentication required.\nSee system logs and ‘systemctl status php7.0-fpm.service’ for details.\n”  
> }  
> ➜ trellis git:(master) ✗ ansible “root:&staging” -m service -a “name=php7.0-fpm state=reloaded” -u web  
> ERROR! Specified hosts and/or --limit does not match any hosts  
> ➜ trellis git:(master) ✗ ansible “admin:&staging” -m service -a “name=php7.0-fpm state=reloaded” -u web  
> ERROR! Specified hosts and/or --limit does not match any hosts  
> ➜ trellis git:(master) ✗

when i looked in /etc/sudoers.d/web-services on the staging server as referenced [here](https://discourse.roots.io/t/deployment-issues-with-php-fpm/5860/22).

I get this -

> root@lc-blogs-stage:~# cat /etc/sudoers.d/web-services
> 
> ##### #ansible managed: /home/sie/Sites/lc-blogs-trellis/trellis/roles/users/templates/sudoers.d.j2 modified on 2016-08-26 23:31:34 by sie on sie-Lenovo-G510

> web ALL=(root) NOPASSWD: /usr/sbin/service php7.0-fpm \*  
> root@lc-blogs-stage:~#

which seems correct.

so this is as far as I have got, i think the ubuntu update to 16.04 may be causing the error

---

_[View the full topic](https://discourse.roots.io/t/failure-to-establish-connection-when-provisioning-via-ansible-playbook-server-yml/6518)._
