Can I run a downloadable book on ec2 only with ssh keyfile no aws key / pair?

If I don't have AWS key pairs or permissions to create / delete EC2 instances, but just access the same instance via SSH using keypair.pem, can I still use Ansible to configure my server?

Since I do not have access to all EC2 instances, can I just not use boto / aws keypair at all and just add this unique EC2 instance, do I have access in the inventory file?

I tried this in my inventory file:

[aws_server]
aws_instance ansible_host='MY_EC2_INSTANCE.us-west-2.compute.amazonaws.com' ansible_user='ubuntu' ansible_ssh_private_key_file='/myproject/testkey.pem'

But unable to connect to ansible-playbook -i inventory site.yml:

fatal: [aws_instance]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}

PS: I can run without problems ssh -i testkey.pem ubuntu@MY_EC2_INSTANCE.us-west-2.compute.amazonaws.com

+4
source share
2 answers

, AWS IP, - " ". ? #ansible IRC-, -vvvv, SSH, .

ansible-playbook  -vvvv -i inventory site.yml

SSH. Ansible -vvvv, , , :

debug1: setting up multiplex master socket
debug3: muxserver_listen: temporary control path /Users/vmenezes/.ansible/cp/ansible-ssh-MY_EC2_INSTANCE.us-west-2.compute.amazonaws.com-22-ubuntu.NSUADT9KwyIpvhWi
unix_listener: "/path/to/my/project/.ansible/cp/ansible-ssh-MY_EC2_INSTANCE.us-west-2.compute.amazonaws.com-22-ubuntu.NSUADT9KwyIpvhWi" too long for Unix domain socket

, , too long for Unix domain socket. , , URL-, IP-.

-, , , -vvvv , .

+2

, EC2. , , .

? .

0

Source: https://habr.com/ru/post/1649574/


All Articles