Atul Agrawal
Atul Agrawal

Reputation: 1520

Ansible limit parameter is not working

I have my Ansible project structure like this:

enter image description here

My appServers under hosts contains my hosts as follows:

local ansible_ssh_host=127.0.0.1

staging ansible_ssh_host=<host_ip> ansible_connection=ssh  ansible_user=ubuntu  ansible_ssh_private_key_file=<key>

vara-dev ansible_ssh_host=<host ip> ansible_connection=ssh ansible_user=varanet ansible_ssh_pass=<password>

[localhost]
local

[iquippo-staging]
staging

[varanet-server]
vara-dev

[target]
local
staging
vara-dev

But when I am trying this command:

ansible -i inventory/hosts/ --limit local -m ping

It is throwing this error:

ERROR! Missing target hosts

I am using http://docs.ansible.com/ansible/intro_patterns.html for limit parameter.

Upvotes: 0

Views: 1032

Answers (1)

techraf
techraf

Reputation: 68509

You don't specify any host group for the command, so Ansible reports the required parameter is missing.

See the result of:

ansible all -i inventory/hosts/ --limit local -m ping

Upvotes: 2

Related Questions