I am new to ansible
, got the below issue.
I was able to ssh into my client machine .but unable to run playbook.
Getting the error below:
[WARNING]: Unable to parse /etc/ansible/hosts 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: a
here a is my group name. my hosts given below :
---------
[a]
172.31.26.93
[all:vars]
ansible_user=vagrant
ansible_ssh_pass=vagrant
ansible_ssh_host=172.31.26.93
ansible_ssh_port=22
ansible_ssh_user='ansibleuser'
ansible_ssh_private_key_file=/home/ansibleuser/.ssh
------- my playbook file given below ----
- hosts: a
tasks:
- name: create a directory
file: path=/home/ansiblesuser/www state=directory
This is the first time I am getting this issue.
You can use the option --list-hosts. It will show all the host IPs from your inventory file.
Before running the playbook just run the following command
ansible all --list-hosts
If the above error persists then go to /etc/ansible/ansible.cfg
and edit the inventory
path which points to your specific host file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With