I am learning AWX and I am having a lot of trouble connecting to a device that is running locally.
The device that I am trying to connect to is network simulation with cisco iosxr element drivers on them. In the inventory I am specifying.
ansible_connection: network_cli
ansible_network_os: cisco.iosxr.iosxr
attached to that inventory I have a group with a single host and in that host I specify.
ansible_host: 127.0.0.1
ansible_ssh_port: 10022
I am only specifying the Username and password in the credentials attached to the project.
The playbook that I am trying to run can be seen below.
---
- name: testDir sample
hosts: net_sims
gather_facts: no
#ansible_network_cli_ssh_type: libssh
become: yes
connection: local
tasks:
- name: playbook dir print
debug:
msg: "{{playbook_dir}}"
#second task
- name: Configure netsim
hosts: net_sims
gather_facts: no
become: yes
tasks:
- name: Configure a device
cisco.iosxr.iosxr_interfaces:
config:
- name: GigabitEthernet0/0/0/2
description: Configured by Ansible
enabled: true
- name: GigabitEthernet0/0/0/3
description: Configured by Ansible Network
enabled: false
duplex: full
state: merged
The first task succeeds and works as intended. I am using a requiremnets.yaml file to install this cisco module.
The output for the second task looks like this:
>[Errno None] Unable to connect to port 10022 on 127.0.0.1
>
>task path: /runner/project/myPlaybooks/configureNetsim.yaml:19
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
Loading collection ansible.netcommon from /runner/requirements_collections/ansible_collections/ansible/netcommon
>
<127.0.0.1> attempting to start connection
>
<127.0.0.1> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /usr/local/bin/ansible-connection
>
<127.0.0.1> found existing local domain socket, using it!
>
<127.0.0.1> updating play_context for connection
>
<127.0.0.1> local domain socket path is /home/runner/.ansible/pc/45cc4656c5
>
<127.0.0.1> Using network group action cisco.iosxr.iosxr for cisco.iosxr.iosxr_interfaces
>
<127.0.0.1> ANSIBLE_NETWORK_IMPORT_MODULES: enabled
>
<127.0.0.1> ANSIBLE_NETWORK_IMPORT_MODULES: found cisco.iosxr.iosxr_interfaces at /runner/requirements_collections/ansible_collections/cisco/iosxr/plugins/modules/iosxr_interfaces.py
>
<127.0.0.1> ANSIBLE_NETWORK_IMPORT_MODULES: running cisco.iosxr.iosxr_interfaces
>
<127.0.0.1> ANSIBLE_NETWORK_IMPORT_MODULES: complete
The full traceback is:
File "/runner/requirements_collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network.py", line 249, in get_capabilities
capabilities = Connection(module._socket_path).get_capabilities()
File "/usr/local/lib/python3.8/site-packages/ansible/module_utils/connection.py", line 200, in __rpc__
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [new_dev0]: FAILED! => {
"changed": false,
"invocation": {
I am able t ssh into the device normally by using
➜ ~ ssh -p 10022 admin@127.0.0.1
admin@127.0.0.1's password:
admin connected from 127.0.0.1 using ssh on Garretts-Mac-mini.local
This is a freshly launched awx using the basic install of AWX operator version 0.23.0 https://github.com/ansible/awx-operator
I have tried looking in the source files at the connection.py code, deleting things any trying again, changing ports, looking at the documentation, and more. Any suggestions would be greatly appreciated. If any more info is needed let me know.
Note: I am getting a warning:
[WARNING]: ansible-pylibssh not installed, falling back to paramiko
I have tried to install ansible-pylibssh in the cluster that is being used but nothing I do installs it properly I am unsure if this would have any impact.
Thanks!