Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Could not match supplied host pattern, ignoring: bigip" errors, works in Ansible, NOT Tower

I am running Ansible Tower v3.4.1 with Ansible v2.7.6 on an ubuntu 16.04 VM running on VirtualBox. I run a playbook that works when I run it from the command line using "ansible-playbook" but fails when I try to run it from Ansible Tower. I know I must have something misconfigured in ansible tower but I can't find it.

I get this warning no matter what changes I make to the inventory (hosts) file.

$ ansible-playbook 2.7.6

config file = /etc/ansible/ansible.cfg    
configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']

ansible python module location = /usr/lib/python2.7/dist-packages/ansible    

executable location = /usr/bin/ansible-playbook
python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]

Using /etc/ansible/ansible.cfg as config file

SSH password:     
**/tmp/awx_74_z6yJB4/tmpVlXGCX did not meet host_list requirements**, check plugin documentation if this is unexpected

Parsed /tmp/awx_74_z6yJB4/tmpVlXGCX inventory source with script plugin

PLAYBOOK: addpool.yaml *********************************************************

1 plays in addpool.yaml

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

PLAY [Sample pool playbook] ****************************************************
17:05:43

skipping: no hosts matched

I have enabled inventory plugins for YAML, and made my hosts file into a hosts.yml file.

Here's my hosts file:

 192.168.68.253
 192.168.68.254
 192.168.1.165

[centos]
dad2 ansible_ssh_host=192.168.1.165

[bigip]
bigip1 ansible_host=192.168.68.254
bigip2 ansible_host=192.168.68.253

Here's my playbook:

---

- name: Sample pool playbook
  hosts: bigip 
  connection: local

  tasks:
    - name: create web servers pool
      bigip_pool:
        name: web-servers2
        lb_method: ratio-member
        password: admin
        user: admin
        server: '{{inventory_hostname}}'
        validate_certs: no
like image 974
Steve J Avatar asked Feb 11 '19 23:02

Steve J


1 Answers

I replaced hosts: bigip with hosts: all and specified the inventory in Tower as bigip which contains only the two hosts I want to change. This seems to provide the output I am looking for.

For the ansible-playbook command line, I added --limit bigip and this seems to provide the output I am looking for.

So things appear to be working, I just don't know whether this is best practice use.

like image 114
Steve J Avatar answered Nov 15 '22 10:11

Steve J