I had trellis working perfectly, my local vagrant server was working fine, my staging server was provisioned and i could deploy, i was not getting any errors. Then I have changed the domain name for my staging server and now I can’t provision the server . I get this error :
TASK [Install Python 2.x] …
$ ansible-playbook -vvvv server.yml -e “site=mysite.co.uk env=staging”
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /home/sie/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 4200
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 100
Shared connection to 138.xx.xxx.xx closed.
fatal: [mysite.co.uk]: FAILED! => {
“changed”: true,
“failed”: true,
“invocation”: {
“module_args”: {
“_raw_params”: “sudo apt-get install -qq -y python-simplejson”
},
“module_name”: “raw”
},
“rc”: 100,
“stderr”: “OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016\r\ndebug1: Reading configuration data /home/sie/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\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 = 4200\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 100\r\nShared connection to 138.xx.xxx.xx closed.\r\n”,
“stdout”: “E: dpkg was interrupted, you must manually run ‘sudo dpkg --configure -a’ to correct the problem. \r\n”,
“stdout_lines”: [
"E: dpkg was interrupted, you must manually run ‘sudo dpkg --configure -a’ to correct the problem. "
]
}
i have read through several posts on this forum, starting here :
here are my installed program versions:
$ ansible --version
ansible 2.3.0
config file = /home/sie/Sites/wbba/trellis/ansible.cfg
configured module search path = Default w/o overrides
$ vagrant -v
Vagrant 1.8.5
virtualbox --help
Oracle VM VirtualBox Manager 5.1.8
I can login successfully with ssh from my local machine :
$ ssh root@138.xx.xxx.xx -i ~/.ssh/id_rsa
my ~/.ssh/config file looks like this:
Host 52.30.72.186
User ubuntu
ForwardAgent yes
Host 52.30.72.186
User web
ForwardAgent yes
Host github.com
User git
Port 22
Hostname github.com
IdentityFile ~/.ssh/id_rsa
TCPKeepAlive yes
IdentitiesOnly yes
Host mysite.co.uk
IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
the results of command :
$ ansible staging -m raw -a whoami -u root
mysite.co.uk | SUCCESS | rc=0 >>
root
Shared connection to 138.xx.xxx.xx closed.
I tried this to change known_hosts:
$ ssh-keygen -R 138.xx.xxx.xx
# Host 138.xx.xxx.xx found: line 21
/home/sie/.ssh/known_hosts updated.
Original contents retained as /home/sie/.ssh/known_hosts.old
and this for authorised keys:
$ cat ~/.ssh/id_rsa.pub | ssh root@138.xx.xxx.xx “cat >> ~/.ssh/authorized_keys”
this command results in can_connect :
$ ssh -o PasswordAuthentication=no root@138.xx.xxx.xx “echo can_connect” || echo cannot_connect
I have tried this also, ‘no hosts matched’ :
$ ansible 138.xx.xxx.xx -m ping -i hosts/staging -u root -vvvv
Using /home/sie/Sites/wbba/trellis/ansible.cfg as config file
[WARNING]: No hosts matched, nothing to do
Loading callback plugin minimal of type stdout, v2.0 from /usr/local/lib/python2.7/dist-packages/ansible-2.3.0-py2.7.egg/ansible/plugins/callback/init.pyc
my hosts/staging file looks like this:
mysite.co.uk ansible_host=138.68.131.10 ansible_ssh_private_key_file=‘~/.ssh/id_rsa’
[staging]
mysite.co.uk
[web]
mysite.co.uk
any ideas why this is happening? thanks