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.