Hello Dear All,

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:
          - "CONTAINERS NAME is : {{item.name}}"
          - " IT HAS BELOW CONTAINER_CONFIGLETS :"
          -* " {{item.configlets}}"*
      with_items: "{{containers}}"
      loop_control:
        label: "{item.name}}"

***************************************************
[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 :", 
        " []"
    ]
}

-- 
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/26717a7a-4c19-440a-9746-bc883dff934e%40googlegroups.com.

Reply via email to