No limit without inventory limits

I want to have a set of git repositories with basic applications for loading applications into them, so that everything I need to do with any virtual machine, regardless of its name or role or how long it has been around, to get the basic configuration set to run the ansible command -pull against this repo and I get a ready-to-use instance. The problem I am facing is that if I have a playbook local.yml that looks like this:

- hosts: localhost
  connection: local
  gather_facts: yes
  user: root
[...]

or so:

- hosts: all
  connection: local
  gather_facts: yes
  user: root
 [...]

I keep getting the following error:

# ansible-pull -d /tmp/myrepo -U 'http://mygithost/myrepo' 
Starting ansible-pull at 2015-06-09 15:04:05
localhost | success >> {
    "after": "2e4d1c637170f95dfaa8d16ef56491b64a9f931b",
    "before": "d7520ea15baa8ec2c45742d0fd8e209c293c3487",
    "changed": true
}

**ERROR: Specified --limit does not match any hosts**

The only way to avoid the error is to create an explicit inventory file with an explicit group name and explicit host names, which then reference the -i flag as follows:

# cat /tmp/myrepo/myinventory
[mygroup]
myhost1
myhost2

# cat /tmp/myrepo/local.yml
- hosts: mygroup
  connection: local
  gather_facts: yes
  user: root
 [...]

# ansible-pull -d /tmp/myrepo -i myinventory -U 'http://mygithost/myrepo' 

, , - , , , playbook . ?

+4
1

, ansible-pull :

VM hosts /etc/ansible:

# cat /etc/ansible/hosts
localhost ansible_connection=local

local.yaml

- hosts: localhost
  gather_facts: yes
  user: root
  ...

ansible-pull hosts.

+12

All Articles