Hi Barun

You say "When I assign a variable containing double quotes to another
variable" - what variable are you assigning to what other variable?
What you post appears to be the output of a cmd task (I'm guessing, since
you didn't post the original playbook, nor the task).
That is JSON formatted output and looks fine to me.

But then you say:


Expected value to store in variable : [\"dev/xvdj\",\"dev/xvdk\"]
But it is storing this variable value: [u'dev/xvdj', u'dev/xvdk']


What variables are you referring to, and what values do you think are
assigned to them?

Maybe first things first: what are you actually trying to achieve? What do
you need?


Dick

On Mon, 17 Feb 2020 at 12:19, Barun kumar <[email protected]> wrote:

> When I assign a variable containing double quotes to another variable the
> double quotes (") sometimes get converted to single quotes ('). .can you
> please suggest how to solve this.
>
>
>
>
>
> TASK [asm_pdb_disk_mapping : debug]
> ************************************************************************************************************************************
>
> ok: [10.0.0.10] => {
>
>     "device_name": {
>
>         "changed": true,
>
>         "cmd": "a1=( \"xvda\" \"xvdb\" \"xvdc\" \"xvdd\" \"xvde\" \"xvdf\"
> \"xvdg\" \"xvdh\" \"xvdi\" \"xvdj\" \"xvdk\" \"xvdl\" \"xvdm\" \"xvdn\"
> \"xvdo\" \"xvdp\" \"xvdq\" \"xvdr\" \"xvds\" \"xvdt\" \"xvdu\" \"xvdv\"
> \"xvdw\" \"xvdx\" \"xvdy\" \"xvdz\")\nfor i in `cat /tmp/volume.txt | sed
> -e 's/\\[//' | sed -e 's/\\]//' | sed -e 's/\\\"//g' | sed -e 's/,/
> /g'`\ndo\na2+=(\"$i\")\ndone\na3=()\nfor i in \"${a1[@]}\"; do\nskip=\nfor
> j in \"${a2[@]}\"; do\n  [[ $i == $j ]] && { skip=1; break; }\ndone\n  [[
> -n $skip ]] || a3+=(\"$i\")\ndone\njoined=$(printf
> \",\"\\\"\"dev/\"%s\"\\\"\" \"${a3[@]:0:2}\") \necho
> \"[\"${joined:1}\"]\"\n",
>
>         "delta": "0:00:00.088902",
>
>         "end": "2020-02-17 21:50:56.868731",
>
>         "failed": false,
>
>         "rc": 0,
>
>         "start": "2020-02-17 21:50:56.779829",
>
>         "stderr": "",
>
>         "stderr_lines": [],
>
>         "stdout": "[\"dev/xvdj\",\"dev/xvdk\"]",
>
>         "stdout_lines": [
>
>             "[\"dev/xvdj\",\"dev/xvdk\"]"
>
>         ]
>
>     }
>
> }
>
>
>
> Expected value to store in variable : [\"dev/xvdj\",\"dev/xvdk\"]
>
>
>
> But it is storing this variable value: [u'dev/xvdj', u'dev/xvdk']
>
>
>
> Tel me know how to solve this issue.
>
>
> *Regards,*Barun Kumar
> Mobile: +91 8297380006, India
> Coming Soon.......
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CADG%3DkotAgP8RdwBmyHjG9nv8GO-0Kqr5Zt%3DH_FTfmfk09Aomwg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CADG%3DkotAgP8RdwBmyHjG9nv8GO-0Kqr5Zt%3DH_FTfmfk09Aomwg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwNowDf2ixf1%2Bgi0KL5RUHPBoHgZE_wpYQPqm74TZXObvA%40mail.gmail.com.

Reply via email to