Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable using only the SSH agent for private keys if asked. #634

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions ansible_collections/juniper/device/plugins/connection/pyez.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
env:
- name: ANSIBLE_PYEZ_CONSOLE
vars:
- name: ansible_pyez_console
- name: ansible_pyez_console
private_key_file:
description:
- The private SSH key or certificate file used to authenticate to the remote device
Expand Down Expand Up @@ -202,7 +202,17 @@
vars:
- name: ansible_pyez_ssh_config
- name: ssh_config

force_agent:
description:
- This flag will request that only the SSH agent (if found) will be queried for keys.
ini:
- section: defaults
key: force_agent
env:
- name: ANSIBLE_FORCE_AGENT
vars:
- name: ansible_force_agent
- name: force_agent
"""
import pickle

Expand Down Expand Up @@ -381,6 +391,7 @@ def open(self):
connect_args['ssh_private_key_file'] = self.get_option('private_key_file')
connect_args['ssh_config'] = self.get_option('pyez_ssh_config')
connect_args['timeout'] = self.get_option('persistent_connect_timeout')
connect_args['allow_agent'] = self.get_option('force_agent')
try:
log_connect_args = dict(connect_args)
log_connect_args["passwd"] = "NOT_LOGGING_PARAMETER"
Expand Down