# Problem with "Skipping: No hosts matched" when using add\_host and groups

**URL:** <https://forum.ansible.com/t/problem-with-skipping-no-hosts-matched-when-using-add-host-and-groups/24805>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [June 22, 2017, 7:26pm UTC](https://forum.ansible.com/t/problem-with-skipping-no-hosts-matched-when-using-add-host-and-groups/24805 "2017-06-22T19:26:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_White](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@Alex\_White](https://forum.ansible.com/u/Alex_White)\
**Post date:** [June 22, 2017, 7:26pm UTC](https://forum.ansible.com/t/problem-with-skipping-no-hosts-matched-when-using-add-host-and-groups/24805/1 "2017-06-22T19:26:48Z")

</div>

Hello,

I’m launching an AWS instance and setting that instances’ new public IP address to a variable, and attempting to add that host to a group. Later in the same play, I use that group name in the topology.yml to remotely configure it.

I successfully get the IP address from the newly created instanced:

> #Set the CoreA public IP to a var and use it to configure the remote host
> 
> - set\_fact:  
> corea\_public\_ip: “{{ instance\_public\_ip.stdout }}”
> - add\_host:  
> name: “{{ corea\_public\_ip }}”  
> groups: corea\_launched

Later in the same play, I want to use that new group (corea\_launched) var to connect to it:

> - name: Configure the Core Node A  
> hosts: corea\_launched  
> become\_user: sudo  
> become\_method: sudo  
> roles:
> 
> - role: configure\_coreA

Once it gets to that part of the play it skips over and says no hosts matched.

I know that the add\_host is working:

TASK [provision\_instances : add\_host] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

task path: /roles/provision\_instances/tasks/corea\_lc.yml:86

creating host via ‘add\_host’: hostname=34.XX.XX.XX

changed: [local] =\> {

“add\_host”: {

“groups”: [

“corea\_launched”

],

“host\_name”: “34.XX.XX.XX”,

“host\_vars”: {}

},

“changed”: true

}

META: ran handlers

META: ran handlers

PLAY [Configure the Core Node A] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

skipping: no hosts matched

I’ve tried both with and without [corea\_launched] group name in my hosts file.

Thanks in advance!
