'why I get unreachable host with ansible?

I have two machine, local host ubuntu, and client centOS 7.

I have added those lines into: /etc/ansible/hosts

[linux]
192.168.122.1
[linux:vars]
ansible_user=user
ansible_password=123456

and changed uncommented 1 line in ansible.cfg:

# uncomment this to disable SSH key host checking
host_key_checking = False

Still when I do:

ansible all -m ping

   192.168.122.1 | UNREACHABLE! => {
        "changed": false, 
        "msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.122.1 port 22: Connection timed out",
unreachable": true
}

what should I do ? the password and user in hosts file is what i use to log into the other machine



Solution 1:[1]

Check your firewalls and selinux. Port 22 is not accepting the connection. It's not a password issue, it's a networking issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ouflak