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

8,490 views
Skip to first unread message

K

unread,
Feb 24, 2022, 6:38:19 AM2/24/22
to AWX Project
Hey All

I am a complete newbie to this so do excuse me on this.
Managed to set up Ansible AWX following this guide

Got Git integrated
Created SSH Keys
All hosts added vi IP address and copied the SSH Keys as per the document
Put the hosts in a test inventory
I put this playbook in Git and found seen in my AWX instance


---

- hosts: UbuntuTest

tasks:

- name: Update all packages on a Debian/Ubuntu

apt:

update_cache: yes

upgrade: dist


- name: Reboot box if kernel/libs updated and requested by the system

shell: sleep 10 && /sbin/shutdown -r now 'Rebooting box to update system libs/kernel as needed'

args:

removes: /var/run/reboot-required

async: 300

poll: 0

ignore_errors: true


- name: Wait for system to become reachable again

wait_for_connection:

delay: 60

timeout: 300


- name: Verify new update (optional)

command: uname -mrs

register: uname_result

- name: Display new kernel version

debug:
var:
uname_result.stdout_lines

But when running this I get the below error
Can someone point me or tell what I need to do to get over this issue please

No config file found; using defaults
SSH password:
[WARNING]: Could not match supplied host pattern, ignoring: UbuntuTest
PLAY [UbuntuTest] **********************************************************
skipping: no hosts matched
PLAY RECAP *********************************************************************

jowe...@redhat.com

unread,
Mar 2, 2022, 3:51:51 PM3/2/22
to AWX Project
The line `hosts: UbuntuTest` is telling ansible that it should look into your inventory for a group (or a host) named UbuntuTest. The error you are getting is indicating that you have no such group or host within your inventory.

My recommendation would be to double check your awx inventory tied to your job template to see if has a group or host with that name. If not, add one and try again and see if it works.

Also, I would recommend changing your playbook to say `hosts: all` and then set a limit in the job template inside AWX. That way, if you wanted to have multiple job templates that pointed to different hosts they could all use the same playbook (applying the limit from the job template itself).

-John
Reply all
Reply to author
Forward
0 new messages