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

network_cli jumhost issue on arubanetworks.aoscx #681

Open
benjofalanga opened this issue Dec 18, 2024 · 0 comments
Open

network_cli jumhost issue on arubanetworks.aoscx #681

benjofalanga opened this issue Dec 18, 2024 · 0 comments

Comments

@benjofalanga
Copy link

benjofalanga commented Dec 18, 2024

SUMMARY

I am trying to run commands on arubanetworks.aoscx.aoscx switches via jumphost since they are internal and not reachable from outside.
Jumphost works with ssh_type: ssh but fails when I'm trying it with:
paramiko or
libssh

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible [core 2.12.10]
COLLECTION VERSION
ansible-galaxy collection list arubanetworks.aoscx
[WARNING]: log file at /var/log/ansible.log is not writeable and we cannot create it, aborting


# /usr/lib/python3/dist-packages/ansible_collections
Collection          Version
------------------- -------
arubanetworks.aoscx 4.3.1  

# /home/user.ansible/collections/ansible_collections
Collection          Version
------------------- -------
arubanetworks.aoscx 4.4.0  
CONFIGURATION

ANSIBLE_NOCOWS(/home/benji/hotelsautomation/ansible.cfg) = True
DEFAULT_FORKS(/home/benji/hotelsautomation/ansible.cfg) = 10
DEFAULT_GATHERING(/home/benji/hotelsautomation/ansible.cfg) = explicit
DEFAULT_GATHER_TIMEOUT(/home/benji/hotelsautomation/ansible.cfg) = 30
DEFAULT_LOG_PATH(/home/benji/hotelsautomation/ansible.cfg) = /var/log/ansible.log
DEFAULT_ROLES_PATH(/home/benji/hotelsautomation/ansible.cfg) = ['/home/benji/hotelsautomation/roles']
DEFAULT_TIMEOUT(/home/benji/hotelsautomation/ansible.cfg) = 30
DEFAULT_TRANSPORT(/home/benji/hotelsautomation/ansible.cfg) = smart
DISPLAY_SKIPPED_HOSTS(/home/benji/hotelsautomation/ansible.cfg) = True
HOST_KEY_CHECKING(/home/benji/hotelsautomation/ansible.cfg) = False
INJECT_FACTS_AS_VARS(/home/benji/hotelsautomation/ansible.cfg) = True
INTERPRETER_PYTHON(/home/benji/hotelsautomation/ansible.cfg) = auto_legacy_silent
INVENTORY_ENABLED(/home/benji/hotelsautomation/ansible.cfg) = ['host_list', 'virtualbox', 'yaml', 'constructed', 'ini', 'toml', 'script', 'nmap', 'auto']
NETWORK_GROUP_MODULES(/home/benji/hotelsautomation/ansible.cfg) = ['eos', 'nxos', 'ios', 'iosxr', 'junos', 'vyos', 'routeros', 'icx']
PARAMIKO_HOST_KEY_AUTO_ADD(/home/benji/hotelsautomation/ansible.cfg) = True
PERSISTENT_COMMAND_TIMEOUT(/home/benji/hotelsautomation/ansible.cfg) = 30
PERSISTENT_CONNECT_TIMEOUT(/home/benji/hotelsautomation/ansible.cfg) = 60
OS / ENVIRONMENT
ansible_host_machine_os: 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
jumphost_machine_os:
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

arubaoscx_swtich_os:

-----------------------------------------------------------------------------
ArubaOS-CX
(c) Copyright 2017-2024 Hewlett Packard Enterprise Development LP
-----------------------------------------------------------------------------
Version      : PL.10.13.1030                                                 
Build Date   : 2024-06-26 15:32:17 UTC                                       
Build ID     : ArubaOS-CX:PL.10.13.1030:e4784e8afeb8:202406261519            
Build SHA    : e4784e8afeb8591ed8ee0e649df8efe76e49e467                      
Hot Patches  :                                                               
Active Image : primary                       

Service OS Version : PL.01.14.0002                 
BIOS Version       : PL.02.0002 

STEPS TO REPRODUCE

So basically im trying to run commands on this host ***SW42-05-550 *** through this host as jumphost: jump_host_ip

Here is the ansible code

- hosts: SW42-05-550
  serial: 5
  gather_facts: False
  collections:
    - arubanetworks.aoscx
  vars:
    ansible_network_os: arubanetworks.aoscx.aoscx
    ansible_connection: network_cli
    # ansible_connection: ansible.netcommon.netconf
    ansible_user: mikenopabackup
    ansible_password: "vKz4w5sFfb9F9Mzz"
    ansible_become: true
    ansible_become_method: enable
    jump_host_ip: "{{ hostvars['localhost']['host_oa01'] }}"
    jump_hostname: "{{ hostvars['localhost']['hostname'] }}"
    ansible_network_cli_ssh_type: paramiko
    # ansible_network_cli_ssh_type: libssh
    # ssh_type: paramiko
    # ansible_libssh_proxy_command: '-o ProxyCommand="ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null  mikenopa@{{  jump_host_ip }} " -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null'
    ansible_ssh_common_args: '-o ProxyCommand="ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null  mikenopa@{{  jump_host_ip }} " -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null'
    # ansible_libssh_proxy_command: >-
    #     -o ProxyCommand="sshpass -p '{{ jump_host_password }}' ssh -o StrictHostKeyChecking=no -W %h:%p {{ jump_host_user }}@{{ jump_host_ip }}"
    ansible_persistent_log_messages: True
    jump_host_user: "{{ hostvars['localhost']['user_oa01'] }}"
    jump_host_password : "{{hostvars['localhost']['pass_oa01']}}"
    # ansible_ssh_common_args: >-
    #     -o ProxyCommand="sshpass -p '{{ jump_host_password }}' ssh -o StrictHostKeyChecking=no -W %h:%p {{ jump_host_user }}@{{ jump_host_ip }}"
    ansible_paramiko_timeout: 60
    ansible_command_timeout: 60
    ansible_paramiko_proxy_command: >-
        -o ProxyCommand="sshpass -p '{{ jump_host_password }}' ssh -o StrictHostKeyChecking=no -W %h:%p {{ jump_host_user }}@{{ jump_host_ip }}"
    ansible_netconf_ssh_config: True

    # ansible_ssh_common_args: "-J mikenopa@{{jump_host_ip}}"
    # ansible_ssh_common_args: "-o ProxyCommand='sshpass -p {{ansible_password}} ssh -o StrictHostKeyChecking=no -W %h:%p mikenopa@{{ jump_host_ip }}'"
    # ansible_shell_type: sh
    # ansible_shell_executable: /bin/sh
    # ansible_ssh_pipelining: False
  tasks:

  # - name: Configure jumphost for remote execution
  #   set_fact:
  #     # ansible_ssh_common_args: >
  #     #   -o ProxyCommand='sshpass -p "{{ jump_host_password }}" ssh -o StrictHostKeyChecking=no -W %h:%p {{ jump_host_user }}@{{ jump_host_ip }}'

  #   delegate_to: localhost

  - name: Run show version
    arubanetworks.aoscx.aoscx_command:
      commands:
        - show version
  - pause:

As you can see i have tried all the options commented out nothing works ,

EXPECTED RESULTS

Expected result is top run ansible commands through my jumphost.

ACTUAL RESULTS

I/m not getting through to the switch , getting the following error

The full traceback is:
  File "/tmp/ansible_arubanetworks.aoscx.aoscx_command_payload_g3f6ywrf/ansible_arubanetworks.aoscx.aoscx_command_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/module_utils/aoscx.py", line 447, in run_commands
    return conn.run_commands(commands=commands, check_rc=check_rc)
  File "/tmp/ansible_arubanetworks.aoscx.aoscx_command_payload_g3f6ywrf/ansible_arubanetworks.aoscx.aoscx_command_payload.zip/ansible/module_utils/connection.py", line 194, in __rpc__
    response = self._exec_jsonrpc(name, *args, **kwargs)
  File "/tmp/ansible_arubanetworks.aoscx.aoscx_command_payload_g3f6ywrf/ansible_arubanetworks.aoscx.aoscx_command_payload.zip/ansible/module_utils/connection.py", line 141, in _exec_jsonrpc
    raise ConnectionError(
fatal: [SW42-05-550]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "commands": [
                "show version"
            ],
            "interval": 1,
            "match": "all",
            "output_file": null,
            "output_file_format": "json",
            "provider": null,
            "retries": 10,
            "wait_for": null
        }
    },
    "msg": "socket path /home/ansbl/.ansible/pc/e1696bd35d does not exist or cannot be found. See Troubleshooting socket path issues in the Network Debug and Troubleshooting Guide"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant