host variables

29 views
Skip to first unread message

Frank Soyer

unread,
Oct 17, 2014, 1:09:28 PM10/17/14
to ansible...@googlegroups.com
Hi staff,
I just find a small bug, tell me if you knew it.
I was using an old version (1.1 !) and launched playbooks like that :

in /etc/ansible/hosts :
myserver mysql_password="123456"
using {{ mysql_password }} somewhere in the code.

in playbook :
- host = $host

and at command line :
ansible-playbook myplaybook.yml -e host=myserver

All works find, but... I just update ansible to 1.7, interested by the stat command.
First I find that in playbook I must now say :
- hosts : "{{ host }}"
instead of $host. OK no problem, I haven't tons of playbooks !
But I had a host like this in hosts file:
otherserver mysql_password="12#3456"

and got the error :
...
  File "/usr/lib64/python2.6/shlex.py", line 172, in read_token
    raise ValueError, "No closing quotation"
ValueError: No closing quotation

I've found that I must escape the # ("12\#3456") to have it to work. Seems to return the right password without the "\". I know that I could check all this password to escape the #, but I'm so lazy, and as the string is quoted, it looks like a bug, isn't it ?
Other characters like "$" "%" "," ";" are not problematic.

Thanks
Frank

Michael DeHaan

unread,
Oct 20, 2014, 5:06:51 PM10/20/14
to ansible...@googlegroups.com
Tracebacks are errors, so please report this one on GitHub with how to reproduce it.

Thanks!



--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d3784876-09b8-4a02-8f58-e81d158c2f7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages