How to cover all hosts with Ansible pull method?

1.8k Views Asked by At

I know that it is possible to turn Ansible into pull architecture: https://docs.ansible.com/ansible/2.4/ansible-pull.html

What I am having trouble is that it seems Ansible still wants to manage inventory. So using the script to pull the repository:

ansible-pull -U <repository> [options] [<playbook.yml>]

I get following warning:

[WARNING]: Could not match supplied host pattern, ignoring: XYZA

and when running actual playbook I get this message:

PLAY [all] ********************************************************************************************************
skipping: no hosts matched

As by default Ansible will search for hosts in /etc/ansible/hosts file. But now that it is pulling, it should not care about hosts in my opinion. I know I could also specify hosts with -i parameter as array, for example:

ansible-pull -U [email protected]/somerepo -i localhost, playbook.yml

But in my case there are a lot of hosts and I just want to run the playbook against all of them that are pulling from that repository. Is there any way to do that, or do I need dynamically specify for each host separate script/inventory?

EDIT: I have also tried -i all or -i all, but does not seem to work for me.

1

There are 1 best solutions below

1
On

It seems it was just a warning, not an error, so Ansible pull should still run. Running it with the inventory localhost does the trick: ansible-pull -U [email protected]/somerepo -i localhost, playbook.yml