Skip to content

Commit f9b588d

Browse files
committed
fix: use paramiko instead of libssh for Cisco SSH connections
The network EE's version of ansible-pylibssh/netcommon doesn't honor ansible_libssh_publickey_algorithms, so ssh-rsa is still rejected. Switch Cisco routers to paramiko which handles ssh-rsa natively. Made-with: Cursor
1 parent a0b924a commit f9b588d

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

roles/manage_ec2_instances/tasks/inventory/addhost_network.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
username: "{{ item.tags.Student }}"
4141
ansible_user: "{{ item.tags.username }}"
4242
ansible_port: "{{ ssh_port }}"
43-
# https://github.com/ansible-collections/ansible.netcommon/pull/597
44-
ansible_libssh_publickey_algorithms: "ssh-rsa"
43+
ansible_network_cli_ssh_type: "paramiko"
4544
ansible_ssh_private_key_file: "{{ playbook_dir }}/{{ ec2_name_prefix|lower }}/{{ ec2_name_prefix|lower }}-private.pem"
4645
private_ip: "{{ item.private_ip_address }}"
4746
ansible_network_os: "{{ item.tags.ansible_network_os }}"

roles/manage_ec2_instances/templates/instructor_inventory/instructor_inventory_network.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ansible_ssh_private_key_file="{{ playbook_dir }}/{{ ec2_name_prefix }}/{{ ec2_na
2525
{% endfor %}
2626
{% for host in rtr1_node_facts.instances %}
2727
{% if 'student' ~ number == host.tags.Student %}
28-
{{ host.tags.Student }}-{{ host.tags.short_name }} ansible_host={{ host.public_ip_address }} ansible_user={{ host.tags.username }} ansible_network_os={{ host.tags.ansible_network_os }} ansible_connection=network_cli ansible_libssh_publickey_algorithms=ssh-rsa
28+
{{ host.tags.Student }}-{{ host.tags.short_name }} ansible_host={{ host.public_ip_address }} ansible_user={{ host.tags.username }} ansible_network_os={{ host.tags.ansible_network_os }} ansible_connection=network_cli ansible_network_cli_ssh_type=paramiko
2929
{% endif %}
3030
{% endfor %}
3131
{% for host in rtr2_node_facts.instances %}

roles/manage_ec2_instances/templates/student_inventory/instances_network.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ arista
5252
[cisco:vars]
5353
ansible_network_os=ios
5454
ansible_connection=network_cli
55-
ansible_libssh_publickey_algorithms=ssh-rsa
55+
ansible_network_cli_ssh_type=paramiko
5656
{% endif %}
5757

5858
{% if network_type == "multivendor" or network_type == "juniper" %}

0 commit comments

Comments
 (0)