Consider the following two commands:
(1) ansible-playbook --limit dtest --private-key=/path/to/private/key.pem
test_stat.yml
(2) ansible-playbook --limit dtest test_stat.yml
The test_stat playbook is given below:
# An ANSIBLE playbook to execute stat
- name: Play - Stat
hosts: all
vars_files:
- "ssh_server_static_keys/{{ inventory_hostname }}.yml"
roles:
- stat
I have a file named ssh_server_static_keys/dtest.yml that contains
something like this.
ssh_host_rsa_key: |
-----BEGIN RSA PRIVATE KEY-----
.....
-----END RSA PRIVATE KEY-----
If I execute the commands (1), followed by (2), both work.
Executing (1) creates a socket named
$HOME/.ansible/cp/ansible-ssh-<something>
As long as that socket is alive, (2) works.
If I execute (2) alone, it doesn't work. I get the following error:
fatal: [dtest] => SSH Error: Permission denied
(publickey,gssapi-keyex,gssapi-with-mic).
while connecting to <host>:<port>
However, (2) alone works without any error for *another* host, which has a
key in ssh_server_static_keys/something.yml.
What am I missing?
Thanks,
Manoj
--
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/8e992298-c28d-45b8-878b-ccfec9112ef1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.