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\"] }}" }
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
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