|
|
|
@ -154,6 +154,21 @@ options:
|
|
|
|
|
- name: ANSIBLE_PERSISTENT_COMMAND_TIMEOUT
|
|
|
|
|
vars:
|
|
|
|
|
- name: ansible_command_timeout
|
|
|
|
|
netconf_ssh_config:
|
|
|
|
|
description:
|
|
|
|
|
- This variable is used to enable bastion/jump host with netconf connection. If set to
|
|
|
|
|
True the bastion/jump host ssh settings should be present in ~/.ssh/config file,
|
|
|
|
|
alternatively it can be set to custom ssh configuration file path to read the
|
|
|
|
|
bastion/jump host settings.
|
|
|
|
|
ini:
|
|
|
|
|
- section: netconf_connection
|
|
|
|
|
key: ssh_config
|
|
|
|
|
version_added: '2.7'
|
|
|
|
|
env:
|
|
|
|
|
- name: ANSIBLE_NETCONF_SSH_CONFIG
|
|
|
|
|
vars:
|
|
|
|
|
- name: ansible_netconf_ssh_config
|
|
|
|
|
version_added: '2.7'
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
@ -162,7 +177,7 @@ import json
|
|
|
|
|
|
|
|
|
|
from ansible.errors import AnsibleConnectionFailure, AnsibleError
|
|
|
|
|
from ansible.module_utils._text import to_bytes, to_native, to_text
|
|
|
|
|
from ansible.module_utils.parsing.convert_bool import BOOLEANS_TRUE
|
|
|
|
|
from ansible.module_utils.parsing.convert_bool import BOOLEANS_TRUE, BOOLEANS_FALSE
|
|
|
|
|
from ansible.plugins.loader import netconf_loader
|
|
|
|
|
from ansible.plugins.connection import NetworkConnectionBase
|
|
|
|
|
|
|
|
|
@ -250,10 +265,10 @@ class Connection(NetworkConnectionBase):
|
|
|
|
|
|
|
|
|
|
device_params = {'name': NETWORK_OS_DEVICE_PARAM_MAP.get(self._network_os) or self._network_os}
|
|
|
|
|
|
|
|
|
|
ssh_config = os.getenv('ANSIBLE_NETCONF_SSH_CONFIG', False)
|
|
|
|
|
ssh_config = self.get_option('netconf_ssh_config')
|
|
|
|
|
if ssh_config in BOOLEANS_TRUE:
|
|
|
|
|
ssh_config = True
|
|
|
|
|
else:
|
|
|
|
|
elif ssh_config in BOOLEANS_FALSE:
|
|
|
|
|
ssh_config = None
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|