Open satperm opened 1 year ago
it's possible that issue related to ansible.netcommon.network_cli or paramiko. if so please close the issue.
This sounds like a bug in ansible.netcommon (the error message seems to indicate that paramiko wasn't involved, but instead libssh). Which version of ansible.netcommon are you using?
ansible --version | grep collection ansible collection location = /Users/leonisa/.ansible/collections:/usr/share/ansible/collections
ansible-galaxy collection list
Collection Version
ansible.netcommon 2.6.1
Collection Version
ansible.netcommon 3.1.0
You might want to try ansible.netcommon 5.1.1, the latest release.
thanks, i'll try it asap.
doesn't work with
ansible-galaxy collection list
# /Users/leonisa/.ansible/collections/ansible_collections
Collection Version
------------------ -------
ansible.netcommon 5.1.1
ansible.utils 2.10.3
community.network 4.0.1
community.routeros 2.8.0
dzervas.vector 0.1.6
frr.frr 2.0.0
netbox.netbox 3.13.0
same result
failed: [rtr_01] (item=:if ( [:put [:len [/ip firewall filter find comment=est_rel_input]]]=0) do={/ip firewall filter add action=accept chain=input comment=est_rel_input connection-state=established,related }) => changed=false
ansible_loop_var: item
item: :if ( [:put [:len [/ip firewall filter find comment=est_rel_input]]]=0) do={/ip firewall filter add action=accept chain=input comment=est_rel_input connection-state=established,related }
msg: Negative size passed to PyBytes_FromStringAndSize
i have used local rendering of a config and then pushing and importing files on a device as a workaround.
---
- name: Generate firewall-filter-{{inventory_hostname}}.rsc to check and add user
template: src=filter.rsc.j2 dest={{role_path}}/files/tmp/firewall-filter-{{inventory_hostname}}.rsc
delegate_to: localhost
- name: Send firewall-filter-{{inventory_hostname}}.rsc script
command: scp -P {{ansible_port}} {{role_path}}/files/tmp/firewall-filter-{{inventory_hostname}}.rsc {{ansible_user}}@{{ansible_host}}:/firewall-filter-{{inventory_hostname}}.rsc
delegate_to: localhost
- name: Delete temporary firewall-filter-{{inventory_hostname}}.rsc file
file: path={{role_path}}/files/tmp/firewall-filter-{{inventory_hostname}}.rsc state=absent
delegate_to: localhost
- name: Run firewall-filter-{{inventory_hostname}}.rsc on router
raw: "/import firewall-filter-{{inventory_hostname}}.rsc"
tags: mikrotik_firewall_services
Which version of ansible_pylibssh (https://github.com/ansible/pylibssh) do you have installed? That library seems to use PyBytes_FromStringAndSize
(which is a C function used by Python C extensions; ansible_pylibssh is one such extension), so the error might come from there.
Hello, version of the package ansible-pylibssh is 1.1.0. I am ready to entirely change venv ( version of python, libraries etc)
SUMMARY
i have simple playbook to deploy firewall rules into my mikrotik devices with routeros.command, it doesn't work with long lines, only with short. My lines if short, because i use some checking logic before push commands on device.
ISSUE TYPE
COMPONENT NAME
routeros.command
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
sw_vers ProductName: macOS ProductVersion: 13.4 BuildVersion: 22F66
STEPS TO REPRODUCE
run playbook with
ansible-playbook spb-routers.yaml --tags rtr_firewall_fitler_rules
host_vars for rtr-01
firewall_filter_lines:
EXPECTED RESULTS
expected result is receiving changed state for all lines in playbook, but it works only for shortest line:
ACTUAL RESULTS
error: ssh_type libssh error Negative size passed to PyBytes_FromStringAndSize msg: Failed to write to ssh channel