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.
/etc/ansible/hosts
and you have a modern version of ansible, you can check to see what ansible sees about that file usingansible-inventory -i /path/to/the/inventory/file --list
– Dratansible_ssh_private_key_file=/home/ansibleuser/.ssh
is incorrect as that points to a directory, and not to a file -- unless you have for some terrible reason named your file as.ssh
inansibleuser
's home directory – Drat