Raw command cannot work

28 views
Skip to first unread message

davidy

unread,
Jan 3, 2022, 4:56:18 PM1/3/22
to Ansible Project
Hi Please see the below command lines. Raw command line highlighted below cannot work.
After entering the command, it shows some error message. It looks like the access is refused. Did I missed some things? The routers is configured with ssh correctly. 
Thank you


--------------------------------
sudo nano hosts
[lab-hosts]
192.168.1.[11:13]

sudo nano ansible.cfg
[defaults]
inventory =  ./hosts
host_key checking = false
timeout = 5

mkdir group_vars
cd /group_vars
sudo nano devices.yml
ansible_network_os: ios

ansible lab-hosts -m raw -a "show run" -u ansible -k | grep 'hostname\| system mtu'

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.11 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.1.11 port 22: Connection refused",
    "unreachable": true
}
192.168.1.12 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.1.12 port 22: Connection timed out",
    "unreachable": true
}
192.168.1.13 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.1.13 port 22: Connection timed out",
    "unreachable": true


Reply all
Reply to author
Forward
0 new messages