Hi All,

  Request your help with string concatenation whith stdout under with_items.

  - name: _List Name 
    shell: (sysls -l)
    register: sys_list
    ignore_errors: true

  - name: check System Type
    shell: (systype -t {{item.s}}|awk '{if ($3 == "not")  {print "FAILED 
:{{item.s}} is not set"} else {print "OK :{{item.s}} is set"}}')
 with_items:
      - { s:  "{{ sys_list.stdout_lines + [\"t1.dev.com\"] }}" }
      - { s:  "{{ sys_list.stdout_lines + [\"t1.dev.s1.com\"] }}" }

Note:
sys_list.stdout_lines : contains the string  "axe"
systype -t axe.t1.dev.com |awk '{if ($3 == "not")  {print "FAILED 
:{{item.s}} is not set"} else {print "OK :{{item.s}} is set"}}'
systype -t axe.t1.dev.s1.com |awk '{if ($3 == "not")  {print "FAILED 
:{{item.s}} is not set"} else {print "OK :{{item.s}} is set"}}'

Issue:

The above code is interpreting as below with square bracket and considering 
as 2 separate variables as below

V1: [axe]   V2: t1.dev.com
V1:[axe]    V2: 1.dev.s1.com

systype -t [axe],'t1.dev.com' |awk '{if ($3 == "not")  {print "FAILED 
:{{item.s}} is not set"} else {print "OK :{{item.s}} is set"}}'
systype -t [axe],'t1.dev.s1.com' |awk '{if ($3 == "not")  {print "FAILED 
:{{item.s}} is not set"} else {print "OK :{{item.s}} is set"}}'

From,
Vino.B

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a7ff18ae-b3d6-4480-834d-1baca11ae38f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to