I have below playbook. There is also output of this playbook bottom. I want to print elements of below bold list variable. Could you please help me for this how to do?
---
- name: Build Switch Config
hosts: cvp
connection: local
gather_facts: no
tasks:
- name: "collecting facts from CVP {{inventory_hostname}}"
arista.cvp.cv_facts:
facts:
containers
- name: "Print out facts from CVP"
debug:
msg:
- " IT HAS BELOW CONTAINER_CONFIGLETS :"
- " {{item.configlets}}"
with_items: "{{containers}}"
loop_control:
[root@centos7 ansible]# ansible-playbook test_facts.yml
PLAY [Build Switch Config] **************************************************************************************************************************************************************************************************************
TASK [collecting facts from CVP 172.16.91.3] ********************************************************************************************************************************************************************************************
ok: [172.16.91.3]
TASK [Print out facts from CVP] *********************************************************************************************************************************************************************************************************
ok: [172.16.91.3] => (item={
item.name}}) => {
"msg": [
"CONTAINERS NAME is : Tenant",
" IT HAS BELOW CONTAINER_CONFIGLETS :",
" []"
]
}
ok: [172.16.91.3] => (item={
item.name}}) => {
"msg": [
"CONTAINERS NAME is : Spine",
" IT HAS BELOW CONTAINER_CONFIGLETS :",
" [u'Mahmut_Leaf_Initial', u'SYS_TelemetryBuilderV2', u'Mahmut_Spine_Builder']"
]
}
ok: [172.16.91.3] => (item={
item.name}}) => {
"msg": [
"CONTAINERS NAME is : Leaf",
" IT HAS BELOW CONTAINER_CONFIGLETS :",
" [u'Mahmut_Leaf_Initial', u'SYS_TelemetryBuilderV3', u'Mahmut_Leaf_Builder']"
]
}
ok: [172.16.91.3] => (item={
item.name}}) => {
"msg": [
"CONTAINERS NAME is : Internet",
" IT HAS BELOW CONTAINER_CONFIGLETS :",
" [u'Mahmut_Leaf_Initial', u'SYS_TelemetryBuilderV2', u'Mahmut_Internet_Builderv2']"
]
}
ok: [172.16.91.3] => (item={
item.name}}) => {
"msg": [
"CONTAINERS NAME is : Undefined",
" IT HAS BELOW CONTAINER_CONFIGLETS :",
" []"
]
}