And that is why I opened this!!! I recently did an upgrade (RHEL7 -> RHEL8) 
so it wiped my /etc/ansible/hosts file. Totally forgot I had added 
192.168.122.[1:255] to it!

Thanks Kai!

On Tuesday, January 28, 2020 at 2:03:27 PM UTC-5, Kai Stian Olstad wrote:
>
> On 28.01.2020 18:42, Michael Garris wrote: 
> >   - name: Output New VM IPaddress 
> >     debug: 
> >       msg: "New VM IPaddress: {{ vm_ipaddr.stdout }}" 
> > 
> >   - name: Set VM IP Address Fact 
> >     set_fact: 
> >       new_vm_ipaddr: "{{ vm_ipaddr.stdout }}" 
> > 
> > - hosts: "{{ hostvars['localhost']['new_vm_ipaddr'] }}" 
> >   become: true 
> >   tasks: 
> > 
> >   - include_role: 
> >       name: "{{ item }}" 
> >     with_items: 
> >       - reg_n_packs 
> > #      - ansible_tower 
> > 
> > 
> > 
> > 
> > 
> > Play run (ansible-playbook -K custom-vm.yml): 
> > 
> > ......... 
> > TASK [Get IP Address of New VM] 
> > 
> ************************************************************************************************************
>  
>
> > changed: [localhost] 
> > 
> > TASK [Output New VM IPaddress] 
> > 
> *************************************************************************************************************
>  
>
> > ok: [localhost] => { 
> >     "msg": "New VM IPaddress: 192.168.122.206" 
> > } 
> > 
> > TASK [Set VM IP Address Fact] 
> > 
> **************************************************************************************************************
>  
>
> > ok: [localhost] 
> > [WARNING]: Could not match supplied host pattern, ignoring: 
> > 192.168.122.206 
> > 
> > 
> > PLAY [192.168.122.206] 
> > 
> *********************************************************************************************************************
>  
>
> > skipping: no hosts matched 
>
> In you subject you are hinting of problem with hostvars but that is 
> working fine. 
> As you can see it is trying to run against 192.168.122.206 but you get 
> "no hosts matched". 
>
> Your new host, 192.168.122.206, is not in your Ansible inventory so it 
> can't find it. 
> How is this new host supposed to appear/be added to the the inventory? 
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/416661e2-b7f0-4d70-8b45-d042d32e990e%40googlegroups.com.

Reply via email to