# Ansible install failing on a staging EC2 Ubuntu instance

**URL:** https://discourse.roots.io/t/ansible-install-failing-on-a-staging-ec2-ubuntu-instance/7406
**Category:** trellis
**Created:** 2016-08-16T16:18:57Z
**Posts:** 6

## Post 1 by @sydilaxe — 2016-08-16T16:18:57Z

While running the ansible deployment for my staging server (an AWS EC2 ubuntu server), an error is happing during \< TASK [users : Add SSH keys] \>. The staging server has the private shared key for the .pem file that was generated while creating the instance for the ubuntu user (which I have made the admin\_user). The failure seems to occurring with the /home/web/.ssh/authorized\_keys file on the staging server. Do I need to modify this file on the staging server? Please let me know if there is additional information or errors that I should provide to help troubleshoot this.

---

## Post 2 by @swalkinshaw — 2016-08-16T16:45:00Z

How about the actual error/log output?

---

## Post 3 by @sydilaxe — 2016-08-16T17:08:32Z

Hi Scott,

Thanks for responding so quickly. Do you mean the output from “ansible-playbook server.yml -e env=staging -vvvv”?

ie:

invalid key specified: -----BEGIN RSA PRIVATE KEY-----  
failed: [[stg.mydomain.com](http://stg.mydomain.com)] (item=({u’name’: u’web’, u’groups’: [u’www-data’]}, u’-----BEGIN RSA PRIVATE KEY-----\r\ …key…r\n-----END RSA PRIVATE KEY-----"]}

invalid key specified: -----BEGIN RSA PRIVATE KEY-----  
failed: [[stg.mydomain.com](http://stg.mydomain.com)] (item=({u’name’: u’ubuntu’, u’groups’: [u’sudo’]}, u’-----BEGIN RSA PRIVATE KEY-----\r…key…----END RSA PRIVATE KEY-----’)) =\> {“failed”: true, “item”: [{“groups”: [“sudo”], “name”: “ubuntu”}, "-- etc etc…

\< NO MORE HOSTS LEFT \>

[WARNING]: Could not create retry file ‘server.retry’. [Errno 2] No  
such file or directory: ‘’

localhost : ok=0 changed=0 unreachable=0 failed=0  
[stg.mydomain.com](http://stg.mydomain.com) : ok=30 changed=1 unreachable=0 failed=1

Thanks,  
Ben

---

## Post 4 by @sydilaxe — 2016-08-16T17:12:23Z

I did not include all of the ssh private key code in there. But I think it may have to do with local ssh keys on the EC2 Ubuntu server. Not entirely sure though.

---

## Post 5 by @swalkinshaw — 2016-08-17T00:12:25Z

The `users` feature only take SSH **public** keys. Our docs have more info on this: [https://roots.io/trellis/docs/ssh-keys/](https://roots.io/trellis/docs/ssh-keys/)

You were trying to specify private keys in there which won’t work.

---

## Post 6 by @sydilaxe — 2016-08-17T01:40:52Z

Thanks Scott,

That worked like a charm. I generated a new public key from the private and pointed the admin\_user to that. Server is provisioned and deployed!

Cheers from a fellow Torontonian,  
Ben
