script task strips empty string('') from parameters which leads to a infinite hang

21 views
Skip to first unread message

xin zhang

unread,
Mar 1, 2015, 5:15:43 PM3/1/15
to ansible...@googlegroups.com
I use script task to change mysql password by mysqladmin; when the password is an empty string(''), the script task strips it and leads ansible hang because mysqladmin will prompt for a password

TASK: [script /usr/bin/mysqladmin -u root password ''] ************************ 
<192.168.0.214> ESTABLISH CONNECTION FOR USER: root on PORT 22 TO 192.168.0.214
<192.168.0.214> EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1462733147.95-186442598016946 && echo $HOME/.ansible/tmp/ansible-tmp-1462733147.95-186442598016946'
<192.168.0.214> PUT /usr/bin/mysqladmin TO /root/.ansible/tmp/ansible-tmp-1462733147.95-186442598016946/mysqladmin
<192.168.0.214> EXEC /bin/sh -c 'chmod +rx /root/.ansible/tmp/ansible-tmp-1462733147.95-186442598016946/mysqladmin'
<192.168.0.214> EXEC /root/.ansible/tmp/ansible-tmp-1462733147.95-186442598016946/mysqladmin -u root password

see command marked in blue does have a "" at last, but the real command in red strips it.

How can I handle such case?

Erik-jan Riemers

unread,
Mar 1, 2015, 5:20:49 PM3/1/15
to ansible...@googlegroups.com
Should that not be pointing to a "{{ $var }}" then? How does the task look to start with? This is just the output :)

Op zondag 1 maart 2015 23:15:43 UTC+1 schreef xin zhang:

xin zhang

unread,
Mar 1, 2015, 5:22:45 PM3/1/15
to ansible...@googlegroups.com
The task is like:

- script: /tmp/mysql.sh

and mysql.sh is a single line script like:

/usr/bin/mysqladmin -u root password ''

Erik-Jan Riemers

unread,
Mar 1, 2015, 5:55:55 PM3/1/15
to ansible...@googlegroups.com
Did you try it with "''" too?

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/uGKqMP1jAA8/unsubscribe.
To unsubscribe from this group and all its topics, 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/533a305a-25af-4b3e-88c9-338f4376a1ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

xin zhang

unread,
Mar 1, 2015, 6:31:38 PM3/1/15
to ansible...@googlegroups.com
I tried. It's still not working

xin zhang

unread,
Mar 1, 2015, 7:21:03 PM3/1/15
to ansible...@googlegroups.com
I tried defining a variable, it's not working too

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/uGKqMP1jAA8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Erik-jan Riemers

unread,
Mar 2, 2015, 2:31:27 AM3/2/15
to ansible...@googlegroups.com
Did you try and escape them with \ so say \`\` or \"``\" (just suggestions, since i am uncertain of it too) for all we know you might need to quote the command even.

Reply all
Reply to author
Forward
0 new messages