Hi All,

I am trying create logical volume group and need to get the vg name and 
device list from the json variable..  i am not sure what is the logic i 
need to use to get the desired result.. 

Below is the current output:

{
    "msg": [
        {
            "vg_hana_data": "/dev/sdf"
        },
        {
            "vg_hana_data": "/dev/sdg"
        },
        {
            "vg_hana_data": "/dev/sdh"
        },
        {
            "vg_hana_log": "/dev/sdi"
        },
        {
            "vg_hana_log": "/dev/sdj"
        }
    ]
}


Here is my code:

 - name: Filesystem data gather from input file
     set_fact:
       fs: "{{jsondata | json_query(jmesquery) }}"
     vars:
             jmesquery: 
'filesystem[*].{hostname:hostname,devicename:Devicename,path:MountPath,type:FileSystemType,owner:FSOwner,group:FSGroup,vgname:vgname}'
   - name: creating dictionary to store vgname
     set_fact:
             #diskdata: "{{ diskdata|default({})|combine ([ {item.vgname: 
item.devicename} ]) }}"
        diskdata: "{{ diskdata|default([]) + [ {item.vgname: 
item.devicename} ] }}"
             #    vg_dict: "{{vg_dict|combine( {item.vgname : item.path}) 
}}"
     with_items:
       - "{{fs}}"
     when: "'{{item.vgname}}'.startswith('vg_hana')"
   - name:
     debug:
       msg: "{{diskdata}}"
   - name: Appending data variable
     set_fact:
       hana_data: "{{hana_data}} + ['{{item.vgname}}']"
     with_items: "{{fs}}"
     when: "'{{item.vgname}}'.startswith('vg_hana')"
     vars:
       hana_data: []
   - debug:
       msg: "{{hana_data}}"

Badly need some help on this.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/a783b97c-d5b1-4651-b597-bf93c5ac7e90n%40googlegroups.com.

Reply via email to