Sorry forgot to mention: I'm on AWS EC2 Red Hat Fedora
Operating System: Amazon Linux 2 Architecture: x86-64 *$ ansible --version* ansible 2.9.25 config file = /etc/ansible/ansible.cfg configured module search path = [u'/home/ec2-user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.18 (default, Jun 10 2021, 00:11:02) [GCC 7.3.1 20180712 (Red Hat 7.3.1-13)] Thanks, Huda On Friday, February 25, 2022 at 4:15:14 PM UTC-5 Huda wrote: > Hello, > > Could someone please help with the following issue: > when I run any of the* ansible list hosts *commands, it doesn't show the > host that's listed in the file. What am I doing wrong? I'm able to ssh > passwordless to this host. > > > I've the inventory.txt file: > > This is the snippet of */etc/ansible/ansible.cfg * > > [defaults] > > # some basic default values... > > inventory = /home/ec2-user/ansible_work/inventory.txt > > [inventory] > > enable_plugins = aws_ec2 > ============================= > > this is inventory file: */home/ec2-user/ansible_work/inventory.txt* > > [servers] > > devtest ansible_host=99.9.99.99 ansible_user=ec2-user > ========================== > > and i got this error: > > *$ ansible all --list-hosts* > > [WARNING]: Unable to parse /home/ec2-user/ansible_work/inventory.txt as an > inventory source > > [WARNING]: No inventory was parsed, only implicit localhost is available > > [WARNING]: provided hosts list is empty, only localhost is available. Note > that the implicit localhost does not match 'all' > > hosts (0): > > > ======================================================================= > > *$ ansible-inventory --graph -vvv* > > ansible-inventory 2.9.25 > > config file = /etc/ansible/ansible.cfg > > configured module search path = > [u'/home/ec2-user/.ansible/plugins/modules', > u'/usr/share/ansible/plugins/modules'] > > ansible python module location = > /usr/lib/python2.7/site-packages/ansible > > executable location = /usr/bin/ansible-inventory > > python version = 2.7.18 (default, Jun 10 2021, 00:11:02) [GCC 7.3.1 > 20180712 (Red Hat 7.3.1-13)] > > Using /etc/ansible/ansible.cfg as config file > > aws_ec2 declined parsing /home/ec2-user/ansible_work/inventory.txt as it > did not pass its verify_file() method > > *[WARNING]: Unable to parse /home/ec2-user/ansible_work/inventory.txt as > an inventory source* > > *[WARNING]: No inventory was parsed, only implicit localhost is available* > > @all: > > |--@ungrouped: > > > ==================================================================== > > *$ ansible -m ping devtest -vvv* > > ansible 2.9.25 > > config file = /etc/ansible/ansible.cfg > > configured module search path = > [u'/home/ec2-user/.ansible/plugins/modules', > u'/usr/share/ansible/plugins/modules'] > > ansible python module location = > /usr/lib/python2.7/site-packages/ansible > > executable location = /usr/bin/ansible > > python version = 2.7.18 (default, Jun 10 2021, 00:11:02) [GCC 7.3.1 > 20180712 (Red Hat 7.3.1-13)] > > Using /etc/ansible/ansible.cfg as config file > > aws_ec2 declined parsing /home/ec2-user/ansible_work/inventory.txt as it > did not pass its verify_file() method > > [WARNING]: Unable to parse /home/ec2-user/ansible_work/inventory.txt as an > inventory source > > [WARNING]: No inventory was parsed, only implicit localhost is available > > [WARNING]: provided hosts list is empty, only localhost is available. Note > that the implicit localhost does not match 'all' > > *[WARNING]: Could not match supplied host pattern, ignoring: devtest* > > Skipping callback 'actionable', as we already have a stdout callback. > > Skipping callback 'counter_enabled', as we already have a stdout callback. > > Skipping callback 'debug', as we already have a stdout callback. > > Skipping callback 'dense', as we already have a stdout callback. > > Skipping callback 'dense', as we already have a stdout callback. > > Skipping callback 'full_skip', as we already have a stdout callback. > > Skipping callback 'json', as we already have a stdout callback. > > Skipping callback 'minimal', as we already have a stdout callback. > > Skipping callback 'null', as we already have a stdout callback. > > Skipping callback 'oneline', as we already have a stdout callback. > > Skipping callback 'selective', as we already have a stdout callback. > > Skipping callback 'skippy', as we already have a stdout callback. > > Skipping callback 'stderr', as we already have a stdout callback. > > Skipping callback 'unixy', as we already have a stdout callback. > > Skipping callback 'yaml', as we already have a stdout callback. > > > ================= > > *shouldn't i see the hostname there in the output?* > > *this is the documentation I followed: * > > https://devopscube.com/setup-ansible-aws-dynamic-inventory/ > > and even tried this: > > https://devopsmyway.com/how-to-install-ansible-on-amazon-linuxec2/ > > Will really appreciate your response. thank you! > > -Huda > -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/4361763f-6851-4e7a-a283-0bd775618b5en%40googlegroups.com.