I try to send command to switch with ansible. I tested and confirmed the switch can be accessed by other devices via ssh, but when sending command to the switch via ansible, it failed. The below is commands and error message. Anyone provide some suggestions to the issue? Thank you.
sudo nano hosts
[lab-hosts]
192.168.1.15
sudo nano ansible.cfg
[defaults]
inventory = ./hosts
host_key checking = false
timeout = 5
sudo mkdir group_vars
cd /group_vars
sudo nano devices.yml
ansible_network_os: ios
admin1@Lenovo10:~$ ansible lab-hosts -m raw -a "show run" -u admin -k | grep 'hostname| system mtu' -vvvv
SSH password:
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by default,
this will change, but still be user configurable on deprecation. This feature will be removed in version 2.10. Deprecation
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.15 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Unable to negotiate with 192.168.1.15 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1",
"unreachable": true
}