I’m trying to deploy to EC2 with Trellis.
I have followed the guides the best I can and everytime I run ansible-playbook server.yml -e env=production
it spits out and SSH error.
LAY [Ensure necessary variables are defined] ****************************************************************************************************************
TASK [Ensure environment is defined] *************************************************************************************************************************
skipping: [localhost]
PLAY [Test Connection and Determine Remote User] *************************************************************************************************************
TASK [connection : Require manual definition of remote-user] *************************************************************************************************
skipping: [x.x.x.x.x]
TASK [connection : Specify preferred HostKeyAlgorithms for unknown hosts] ************************************************************************************
skipping: [x.x.x.x.x]
TASK [connection : Check whether Ansible can connect as root] ************************************************************************************************
ok: [x.x.x.x.x -> localhost]
TASK [connection : Warn about change in host keys] ***********************************************************************************************************
skipping: [x.x.x.x.x]
TASK [connection : Set remote user for each host] ************************************************************************************************************
ok: [x.x.x.x.x]
TASK [connection : Announce which user was selected] *********************************************************************************************************
Note: Ansible will attempt connections as user = ubuntu
ok: [x.x.x.x.x]
TASK [connection : Load become password] *********************************************************************************************************************
ok: [x.x.x.x.x]
PLAY [Set ansible_python_interpreter] ************************************************************************************************************************
TASK [python_interpreter : Get Ubuntu release] ***************************************************************************************************************
System info:
Ansible 2.7.5; Darwin
Trellis version (per changelog): "Fix Vagrant trigger path"
---------------------------------------------------
Failed to connect to the host via ssh: ubuntu@x.x.x.x.x: Permission denied
(publickey).
fatal: [x.x.x.x.x]: UNREACHABLE! => {"changed": false, "unreachable": true}
to retry, use: --limit @/Users/gbwdev/Projects/whiteheaddesign.test/trellis/server.retry
PLAY RECAP ***************************************************************************************************************************************************
x.x.x.x.x : ok=4 changed=0 unreachable=1 failed=0
localhost : ok=0 changed=0 unreachable=0 failed=0
The IP is correct in the hosts file and I can SSH into the server fine with terminal.
group_vars/all/users.yml
admin_user: ubuntu
# Also define 'vault_users' (`group_vars/staging/vault.yml`, `group_vars/production/vault.yml`)
users:
- name: "{{ web_user }}"
groups:
- "{{ web_group }}"
keys:
- "{{ lookup('file', '~/.ssh/key.pem') }}"
# - https://github.com/username.keys
- name: "{{ admin_user }}"
groups:
- sudo
keys:
- "{{ lookup('file', '~/.ssh/key.pem') }}"
# - https://github.com/username.keys
web_user: web
web_group: www-data
web_sudoers:
- "/usr/sbin/service php7.2-fpm *"
What am I doing wrong?