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