Hi,

I'm attempting to pass a host as a variable to a playbook, but this simply 
results in "skipping: no hosts matched".

# ansible --version
ansible 1.9.0.1


------------- Playbook ---------------
# cat kstest.yml
---

- hosts: '{{ myhost }}'
  tasks:
     - name: testing on '{{ myhost }}'
       debug: msg="host is {{myhost}}"


------------- Playbook run -----------
# ansible-playbook ./kstest.yml -e "myhost=123.12.12.1" -vvvv

PLAY [123.12.12.1] 
************************************************************
skipping: no hosts matched

PLAY RECAP 
********************************************************************



If I do a list-hosts, it expands the variable as the play name but shows a 
zero host count;

# ansible-playbook ./kstest.yml -e "myhost=123.12.12.1" --list-hosts

playbook: ./kstest.yml

  play #1 (123.12.12.1): *host count=0*




I get exactly the same issue with ansible version 1.8.4.

Looking around the group and googling shows a number of playbooks using the 
same method as above so I presume it did work this way at some point unless 
I'm doing something wrong that I just can't see.

Can anyone see anything obviously wrong or know why passing the host as an 
extra variable on the command line doesn't work?

I can work around it by using the trick of passing a host directly to the 
inventory option  -i 'myhost,', but it seems this trick is something that 
could possibly be removed and isn't supposed to be used.

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/856c9c60-19e2-437c-b369-9bd7640e2f25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to