ssh-agent module does error connecting to agent

7 views
Skip to first unread message

Frans van Berckel

unread,
Mar 20, 2023, 12:55:02 AM3/20/23
to Ansible Development
I found ssh_agent.py by Google and tweaked a bit, but running does ...

$ ansible -vvvvv -m ssh_agent -a 'ssh_key_file=/home/ansible/ssh/rsa_id ssh_env_file=/home/ansible/.ssh-agent-env ssh_passphrase=<redacted>' localhost

localhost | FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "ssh_env_file": "/home/ansible/.ssh-agent-env",
            "ssh_key_file": "/home/ansible/ssh/rsa_id",
            "ssh_passphrase": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
        }
    },
    "msg": "Error adding key and passphrase to agent: Error connecting to agent: No such file or directory\n"
}

To me it looks like the ssh-add can't connect ssh-agent in memory? Or ssh-add doesn't use / can't read ssh_env_file?

~$ ps -A | grep ssh-agent
  35583 ?        00:00:00 ssh-agent

~$ ls .ssh-agent-env
.ssh-agent-env

$ cat  .ssh-agent-env
[default]
ssh_auth_sock = /tmp/ssh-FwY7QOdRrW6h/agent.35582; export SSH_AUTH_SOCK;
ssh_agent_pid = 35583; export SSH_AGENT_PID;

Any idea what goes wrong?
ssh_agent.txt
Reply all
Reply to author
Forward
0 new messages