Ansible :Unable to parse /etc/ansible/hosts as an inventory source











up vote
1
down vote

favorite












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.










share|improve this question
























  • Hi Mani, welcome to SO! You didn't specify the file that contains your group name, nor the version of ansible you are using. Although if it is /etc/ansible/hosts and you have a modern version of ansible, you can check to see what ansible sees about that file using ansible-inventory -i /path/to/the/inventory/file --list
    – Matthew L Daniel
    Nov 9 at 4:30










  • Separately, ansible_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 in ansibleuser's home directory
    – Matthew L Daniel
    Nov 9 at 4:31












  • love & respect for ur response.
    – MANI KANTA
    Nov 9 at 10:25










  • I changed the ssh_priavtekey_file to /home/ansibleuser/.ssh/id_rsa. and tried the the commond ansible-inventory -i /path/to/the/inventory/file --list , got below response ...
    – MANI KANTA
    Nov 9 at 10:26












  • { "_meta": { "hostvars": { "172.31.26.93": { "ansible_ssh_host": "172.31.26.93", "ansible_ssh_pass": "vagrant", "ansible_ssh_port": 22, "ansible_ssh_private_key_file": "/home/ansibleuser/.ssh/id_rsa", "ansible_ssh_user": "ansibleuser", "ansible_user": "vagrant" } } }, "a": { "hosts": [ "172.31.26.93" ] }, "all": { "children": [ "a", "ungrouped" ] }, "ungrouped": {} }
    – MANI KANTA
    Nov 9 at 10:31















up vote
1
down vote

favorite












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.










share|improve this question
























  • Hi Mani, welcome to SO! You didn't specify the file that contains your group name, nor the version of ansible you are using. Although if it is /etc/ansible/hosts and you have a modern version of ansible, you can check to see what ansible sees about that file using ansible-inventory -i /path/to/the/inventory/file --list
    – Matthew L Daniel
    Nov 9 at 4:30










  • Separately, ansible_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 in ansibleuser's home directory
    – Matthew L Daniel
    Nov 9 at 4:31












  • love & respect for ur response.
    – MANI KANTA
    Nov 9 at 10:25










  • I changed the ssh_priavtekey_file to /home/ansibleuser/.ssh/id_rsa. and tried the the commond ansible-inventory -i /path/to/the/inventory/file --list , got below response ...
    – MANI KANTA
    Nov 9 at 10:26












  • { "_meta": { "hostvars": { "172.31.26.93": { "ansible_ssh_host": "172.31.26.93", "ansible_ssh_pass": "vagrant", "ansible_ssh_port": 22, "ansible_ssh_private_key_file": "/home/ansibleuser/.ssh/id_rsa", "ansible_ssh_user": "ansibleuser", "ansible_user": "vagrant" } } }, "a": { "hosts": [ "172.31.26.93" ] }, "all": { "children": [ "a", "ungrouped" ] }, "ungrouped": {} }
    – MANI KANTA
    Nov 9 at 10:31













up vote
1
down vote

favorite









up vote
1
down vote

favorite











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.










share|improve this question















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.







ssh error-handling ansible






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 13:26









kb-0

385




385










asked Nov 8 at 10:19









MANI KANTA

61




61












  • Hi Mani, welcome to SO! You didn't specify the file that contains your group name, nor the version of ansible you are using. Although if it is /etc/ansible/hosts and you have a modern version of ansible, you can check to see what ansible sees about that file using ansible-inventory -i /path/to/the/inventory/file --list
    – Matthew L Daniel
    Nov 9 at 4:30










  • Separately, ansible_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 in ansibleuser's home directory
    – Matthew L Daniel
    Nov 9 at 4:31












  • love & respect for ur response.
    – MANI KANTA
    Nov 9 at 10:25










  • I changed the ssh_priavtekey_file to /home/ansibleuser/.ssh/id_rsa. and tried the the commond ansible-inventory -i /path/to/the/inventory/file --list , got below response ...
    – MANI KANTA
    Nov 9 at 10:26












  • { "_meta": { "hostvars": { "172.31.26.93": { "ansible_ssh_host": "172.31.26.93", "ansible_ssh_pass": "vagrant", "ansible_ssh_port": 22, "ansible_ssh_private_key_file": "/home/ansibleuser/.ssh/id_rsa", "ansible_ssh_user": "ansibleuser", "ansible_user": "vagrant" } } }, "a": { "hosts": [ "172.31.26.93" ] }, "all": { "children": [ "a", "ungrouped" ] }, "ungrouped": {} }
    – MANI KANTA
    Nov 9 at 10:31


















  • Hi Mani, welcome to SO! You didn't specify the file that contains your group name, nor the version of ansible you are using. Although if it is /etc/ansible/hosts and you have a modern version of ansible, you can check to see what ansible sees about that file using ansible-inventory -i /path/to/the/inventory/file --list
    – Matthew L Daniel
    Nov 9 at 4:30










  • Separately, ansible_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 in ansibleuser's home directory
    – Matthew L Daniel
    Nov 9 at 4:31












  • love & respect for ur response.
    – MANI KANTA
    Nov 9 at 10:25










  • I changed the ssh_priavtekey_file to /home/ansibleuser/.ssh/id_rsa. and tried the the commond ansible-inventory -i /path/to/the/inventory/file --list , got below response ...
    – MANI KANTA
    Nov 9 at 10:26












  • { "_meta": { "hostvars": { "172.31.26.93": { "ansible_ssh_host": "172.31.26.93", "ansible_ssh_pass": "vagrant", "ansible_ssh_port": 22, "ansible_ssh_private_key_file": "/home/ansibleuser/.ssh/id_rsa", "ansible_ssh_user": "ansibleuser", "ansible_user": "vagrant" } } }, "a": { "hosts": [ "172.31.26.93" ] }, "all": { "children": [ "a", "ungrouped" ] }, "ungrouped": {} }
    – MANI KANTA
    Nov 9 at 10:31
















Hi Mani, welcome to SO! You didn't specify the file that contains your group name, nor the version of ansible you are using. Although if it is /etc/ansible/hosts and you have a modern version of ansible, you can check to see what ansible sees about that file using ansible-inventory -i /path/to/the/inventory/file --list
– Matthew L Daniel
Nov 9 at 4:30




Hi Mani, welcome to SO! You didn't specify the file that contains your group name, nor the version of ansible you are using. Although if it is /etc/ansible/hosts and you have a modern version of ansible, you can check to see what ansible sees about that file using ansible-inventory -i /path/to/the/inventory/file --list
– Matthew L Daniel
Nov 9 at 4:30












Separately, ansible_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 in ansibleuser's home directory
– Matthew L Daniel
Nov 9 at 4:31






Separately, ansible_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 in ansibleuser's home directory
– Matthew L Daniel
Nov 9 at 4:31














love & respect for ur response.
– MANI KANTA
Nov 9 at 10:25




love & respect for ur response.
– MANI KANTA
Nov 9 at 10:25












I changed the ssh_priavtekey_file to /home/ansibleuser/.ssh/id_rsa. and tried the the commond ansible-inventory -i /path/to/the/inventory/file --list , got below response ...
– MANI KANTA
Nov 9 at 10:26






I changed the ssh_priavtekey_file to /home/ansibleuser/.ssh/id_rsa. and tried the the commond ansible-inventory -i /path/to/the/inventory/file --list , got below response ...
– MANI KANTA
Nov 9 at 10:26














{ "_meta": { "hostvars": { "172.31.26.93": { "ansible_ssh_host": "172.31.26.93", "ansible_ssh_pass": "vagrant", "ansible_ssh_port": 22, "ansible_ssh_private_key_file": "/home/ansibleuser/.ssh/id_rsa", "ansible_ssh_user": "ansibleuser", "ansible_user": "vagrant" } } }, "a": { "hosts": [ "172.31.26.93" ] }, "all": { "children": [ "a", "ungrouped" ] }, "ungrouped": {} }
– MANI KANTA
Nov 9 at 10:31




{ "_meta": { "hostvars": { "172.31.26.93": { "ansible_ssh_host": "172.31.26.93", "ansible_ssh_pass": "vagrant", "ansible_ssh_port": 22, "ansible_ssh_private_key_file": "/home/ansibleuser/.ssh/id_rsa", "ansible_ssh_user": "ansibleuser", "ansible_user": "vagrant" } } }, "a": { "hosts": [ "172.31.26.93" ] }, "all": { "children": [ "a", "ungrouped" ] }, "ungrouped": {} }
– MANI KANTA
Nov 9 at 10:31

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205687%2fansible-unable-to-parse-etc-ansible-hosts-as-an-inventory-source%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205687%2fansible-unable-to-parse-etc-ansible-hosts-as-an-inventory-source%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Schultheiß

Verwaltungsgliederung Dänemarks

Liste der Kulturdenkmale in Wilsdruff