# Run Multiple hosts error

**URL:** <https://forum.ansible.com/t/run-multiple-hosts-error/36493>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [March 29, 2022, 4:38pm UTC](https://forum.ansible.com/t/run-multiple-hosts-error/36493 "2022-03-29T16:38:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nitrous](https://avatars.discourse-cdn.com/v4/letter/n/dfb087/32.png) [@Nitrous](https://forum.ansible.com/u/Nitrous)\
**Post date:** [March 29, 2022, 4:38pm UTC](https://forum.ansible.com/t/run-multiple-hosts-error/36493/1 "2022-03-29T16:38:12Z")

</div>

I have a playbook called multiple.yml that tests for ping:

- name: Playbook for multiple hosts  
hosts: bgrsuistg  
tasks:
- name: ping  
win\_ping:

My host file for bgrsuistg looks like this:

[bgrsuistg]  
server1 ansible\_host=10.125.xx.xx

server2 ansible\_host=10.125.xx.xx  
server3 ansible\_host=10.125.xx.xx

server4 ansible\_host=10.125.xx.xx  
server5 ansible\_host=10.125.xx.xx  
When I run:

ansible-playbook playbooks/multiple.yml -i bgrsuistg -vvvv, I get the below error:

root@ansiblectrl01:/etc/ansible# ansible-playbook playbooks/multiple.yml -i bgrsuistg -vvvv  
ansible-playbook [core 2.12.0]  
config file = /etc/ansible/ansible.cfg  
configured module search path = [‘/root/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible  
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections  
executable location = /usr/local/bin/ansible-playbook  
python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]  
jinja version = 2.10.1  
libyaml = True  
Using /etc/ansible/ansible.cfg as config file  
setting up inventory plugins  
host\_list declined parsing /etc/ansible/bgrsuistg as it did not pass its verify\_file() method  
Skipping due to inventory source not existing or not being readable by the current user  
script declined parsing /etc/ansible/bgrsuistg as it did not pass its verify\_file() method  
auto declined parsing /etc/ansible/bgrsuistg as it did not pass its verify\_file() method  
Skipping due to inventory source not existing or not being readable by the current user  
yaml declined parsing /etc/ansible/bgrsuistg as it did not pass its verify\_file() method  
Skipping due to inventory source not existing or not being readable by the current user  
ini declined parsing /etc/ansible/bgrsuistg as it did not pass its verify\_file() method  
Skipping due to inventory source not existing or not being readable by the current user  
toml declined parsing /etc/ansible/bgrsuistg as it did not pass its verify\_file() method  
[WARNING]: Unable to parse /etc/ansible/bgrsuistg 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’  
redirecting (type: modules) ansible.builtin.win\_ping to ansible.windows.win\_ping  
Loading collection ansible.windows from /usr/local/lib/python3.8/dist-packages/ansible\_collections/ansible/windows  
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.8/dist-packages/ansible/plugins/callback/default.py  
Skipping callback ‘default’, as we already have a stdout callback.  
Skipping callback ‘minimal’, as we already have a stdout callback.  
Skipping callback ‘oneline’, as we already have a stdout callback.

PLAYBOOK: multiple.yml \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
Positional arguments: playbooks/multiple.yml  
verbosity: 4  
connection: smart  
timeout: 10  
become\_method: sudo  
tags: (‘all’,)  
inventory: (‘/etc/ansible/bgrsuistg’,)  
forks: 5  
1 plays in playbooks/multiple.yml  
[WARNING]: Could not match supplied host pattern, ignoring: bgrsuistg

PLAY [ping windows hosts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: no hosts matched

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

What am I doing wrong?

Thanks

---

<div class="post-metadata">

**Author:** ![mahespth](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mahespth/32/252_2.png) [@mahespth](https://forum.ansible.com/u/mahespth)\
**Post date:** [March 29, 2022, 4:44pm UTC](https://forum.ansible.com/t/run-multiple-hosts-error/36493/2 "2022-03-29T16:44:51Z")

</div>

Hey,

It works here so its likely your inventory is not in the path you think it is, its for some reason unreadable but unlikely as it looks like your logged in as root.

Regards

---

<div class="post-metadata">

**Author:** ![Nitrous](https://avatars.discourse-cdn.com/v4/letter/n/dfb087/32.png) [@Nitrous](https://forum.ansible.com/u/Nitrous)\
**Post date:** [March 29, 2022, 4:54pm UTC](https://forum.ansible.com/t/run-multiple-hosts-error/36493/3 "2022-03-29T16:54:08Z")

</div>

Thanks, where can I specify the path to the inventory?

We usually just add a list of VMs and their IP in the /etc/ansible/host file.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [March 29, 2022, 5:06pm UTC](https://forum.ansible.com/t/run-multiple-hosts-error/36493/4 "2022-03-29T17:06:34Z")

</div>

Use `ansible-config dump` to see what’s being set where.

The command you ran is looking for your inventory at `/etc/ansible/bgrsuistg`. If that’s wrong, list the full path or relative path in the parameter to the `-i` option, like `-i ./bgrsuistg`

---

<div class="post-metadata">

**Author:** ![Nitrous](https://avatars.discourse-cdn.com/v4/letter/n/dfb087/32.png) [@Nitrous](https://forum.ansible.com/u/Nitrous)\
**Post date:** [March 29, 2022, 5:18pm UTC](https://forum.ansible.com/t/run-multiple-hosts-error/36493/5 "2022-03-29T17:18:30Z")

</div>

This is what ansible dump shows:

root@ansiblectrl01:/etc/ansible/playbooks# ansible-config dump  
ACTION\_WARNINGS(default) = True  
AGNOSTIC\_BECOME\_PROMPT(default) = True  
ALLOW\_WORLD\_READABLE\_TMPFILES(default) = False  
ANSIBLE\_CONNECTION\_PATH(default) = None  
ANSIBLE\_COW\_ACCEPTLIST(default) = [‘bud-frogs’, ‘bunny’, ‘cheese’, ‘daemon’, ‘default’, ‘dragon’, ‘elephant-in-snake’, ‘elephant’, ‘eyes’, ‘hellokitty’, ‘kitty’, ‘luke-koala’, ‘meow’, ‘milk’, ‘moofas\>  
ANSIBLE\_COW\_PATH(default) = None  
ANSIBLE\_COW\_SELECTION(default) = default  
ANSIBLE\_FORCE\_COLOR(default) = False  
ANSIBLE\_NOCOLOR(default) = False  
ANSIBLE\_NOCOWS(default) = False  
ANSIBLE\_PIPELINING(default) = False  
ANY\_ERRORS\_FATAL(default) = False  
BECOME\_ALLOW\_SAME\_USER(default) = False  
BECOME\_PASSWORD\_FILE(default) = None  
BECOME\_PLUGIN\_PATH(default) = [’/root/.ansible/plugins/become’, ‘/usr/share/ansible/plugins/become’]  
CACHE\_PLUGIN(default) = memory  
CACHE\_PLUGIN\_CONNECTION(default) = None  
CACHE\_PLUGIN\_PREFIX(default) = ansible\_facts  
CACHE\_PLUGIN\_TIMEOUT(default) = 86400

There is no file at /etc/ansible/bgrsuistg, I usually use host file to specify VMs, for e.g:

[bgrsuistg]  
server1 ansible\_host=10.125.xx.xx

server2 ansible\_host=10.125.xx.xx  
server3 ansible\_host=10.125.xx.xx

server4 ansible\_host=10.125.xx.xx  
server5 ansible\_host=10.125.xx.xx

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [March 29, 2022, 6:43pm UTC](https://forum.ansible.com/t/run-multiple-hosts-error/36493/6 "2022-03-29T18:43:37Z")

</div>

What do you get if you use `-i ./bgrsuistg` instead of `-i bgrsuistg` ?

---

<div class="post-metadata">

**Author:** ![Nitrous](https://avatars.discourse-cdn.com/v4/letter/n/dfb087/32.png) [@Nitrous](https://forum.ansible.com/u/Nitrous)\
**Post date:** [March 30, 2022, 2:00pm UTC](https://forum.ansible.com/t/run-multiple-hosts-error/36493/7 "2022-03-30T14:00:05Z")

</div>

Thanks Everyone.

Ok, I think I managed to figure this out, the below works:

root@ansiblectrl01:/etc/ansible# **ansible-playbook -i hosts playbooks/multiple.yml**
