I am learning to use Ansible, and am at the stage of pinging a remote host, an AWS EC2 instance in this case.
However, when I run ansible ping I get no output, as below:
$ ssh ec2-user@ec2-DNS
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Last login: Fri Sep 11 15:10:27 2020 from ...
[ec2-user@ip-bla ~]$ logout
Connection to ec2-DNS closed.
$ ls
ansible.cfg hosts
$ ansible -m ping all
$
Any ideas what I may be causing this? I have my ec2-DNS defined in my hosts file, and in ansible.cfg inventory is pointing at hosts in the current working directory. I also have remote_user = ec2-user in ansible.cfg
$ ansible -vvv -m ping all
ansible 2.8.4
config file = /home/eohara/ansible/ansible.cfg
configured module search path = [‘/home/eohara/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python3.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.7.7 (default, Apr 10 2020, 07:59:19) [GCC 9.3.0]
Using /home/eohara/ansible/ansible.cfg as config file
host_list declined parsing /home/eohara/ansible/hosts as it did not pass it’s verify_file() method
script declined parsing /home/eohara/ansible/hosts as it did not pass it’s verify_file() method
auto declined parsing /home/eohara/ansible/hosts as it did not pass it’s verify_file() method
Parsed /home/eohara/ansible/hosts inventory source with ini plugin
Are you able to run it explicitly using ( -i hosts)? And are u able to check --list-host? permission of the hosts file? password less auth has been configured?
I can ping the current ec2 instance and another one without ansible.
The output of that command is below
eohara@LPTP630 ~/ansible
$ ansible -vvv localhost -m ping
ansible 2.8.4
config file = /home/eohara/ansible/ansible.cfg
configured module search path = [‘/home/eohara/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python3.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.7.7 (default, Apr 10 2020, 07:59:19) [GCC 9.3.0]
Using /home/eohara/ansible/ansible.cfg as config file
host_list declined parsing /home/eohara/ansible/hosts as it did not pass it’s verify_file() method
script declined parsing /home/eohara/ansible/hosts as it did not pass it’s verify_file() method
auto declined parsing /home/eohara/ansible/hosts as it did not pass it’s verify_file() method
Parsed /home/eohara/ansible/hosts inventory source with ini plugin