strange issue when using variable in shell module

Hi guys

i met a wield issue in ansible when using variable including ‘@’ sign, if my variable including @, it will turn to empty totally and the debug infomation is hello world, when i remove @ sign, the result is normal, is there anyone could help? thanks in advance! :-)

TASK: [vas | debug username] **************************************************

ok: [cnshget04.xxx] => {
“msg”: “Hello world!”

TASK: [vas | vas installing…] ***********************************************
failed: [cnshget04.xxx] => {“cmd”: "/opt/quest/bin/vastool -u ‘’

task file:

  • name: vas installing…
    shell: >
    “{{vastool_binary}}” -u “{{username}}”

default file:

-sh-4.1$ cat defaults/main.yml | grep username
username: ‘username’

my playbook:

  • role: vas
    username: abc@eapac.abc.se

my ansible version is 1.9.4

@ is special in bash, use single quotes to avoid interpolation -u '{{username}}'

thanks for your quick replay, unfortunately, it works the same like before.

TASK: [vas | vas installing…] ***********************************************
failed: [cnshget04.xxx] => {“cmd”: "/opt/quest/bin/vastool -u ‘’

task file:

shell: >
“{{vastool_binary}}” -u ‘{{username}}’

在 2016年3月28日星期一 UTC+8下午11:09:38,Brian Coca写道:

Shouldn't this be like this:

- role: vas
  vars:
    - username: foobar

Johannes

I think it works, please see my whole yml file.