You've specified IdentityFile option twice in you .ssh/config file, once 
with the private key and once with the public key. You just need one entry 
pointing to the private key. Not sure why it was sometime working though.

On Thursday, April 20, 2017 at 5:25:51 AM UTC+10, Stiv Ostenberg wrote:
>
> Trying to work through some Ansible training, but failing to run Ansible 
> playbooks.
>  
> It took me quite a while to figure out the relationship between the 
> "~/.ssh/config" and the "/etc/ansible/hosts" to get things to where I am at 
> now.  I created entries for three servers I just created with Terraform.  
> nat, db1, and web1.  I added those systems to /etc/hosts to avoid 
> confusion. 
>  
> Partial contents of ~/.ssh/config:
>
> Host db1
>   Hostname db1
>   User ec2-user
>   ProxyCommand ssh nat -W %h:%p 2>/dev/null
>   IdentityFile ~/.ssh/msca-devops
>   IdentityFile ~/.ssh/msca-devops.pub
>  
>  
> Host web1
>   Hostname web1
>   User ec2-user
>   IdentityFile ~/.ssh/msca-devops
>   IdentityFile ~/.ssh/msca-devops.pub
>
>  Things look good.  I am able to run commands on these systems using 
> Ansible:
>
> [stiv@stivopconlinux .ssh]$ ansible all  -m shell -a 'hostname'
> web1 | SUCCESS | rc=0 >>
> ip-10-0-0-63
> nat | SUCCESS | rc=0 >>
> ip-10-0-0-222
> db1 | SUCCESS | rc=0 >>
> ip-10-0-1-107
>
>  
>  I am also able to ssh to these systems:
>
> [stiv@stivopconlinux .ssh]$ ssh web1
> Last login: Tue Apr 18 17:48:39 2017 from 162.246.216.28
>        __|  __|_  )
>        _|  (     /   Amazon Linux AMI
>       ___|\___|___|
> https://aws.amazon.com/amazon-linux-ami/2016.09-release-notes/
> No packages needed for security; 2 packages available
> Run "sudo yum update" to apply all updates.
> [ec2-user@ip-10-0-0-63 ~]$ 
>
>  Based on this, I though all my manure was in order.  When I try to run my 
> first ever playbook however I fail
>
> [stiv@stivopconlinux playbooks]$ ansible-playbook -i web1, 
> setup_apache.yaml
> PLAY [all] 
> *********************************************************************
> TASK [setup] 
> *******************************************************************
> Enter passphrase for key '/home/stiv/.ssh/msca-devops.pub': 
>
>  Not sure why it is doing this.  There is no passphrase.   The file in 
> question (which worked for both ssh and ansible) contains ---BEGIN SSH2 
> PUBLIC KEY---- *stuff* --- END SSH2 PUBLIC KEY----.
> The msca-devops file in the .ssh folder contains the private key, again 
> just the BEGIN-END, no passphrase. 
>
> What am I doing wrong?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/56eced26-892b-4736-a95c-43a155eb3db7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to